In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is about how to access EJB through the local interface under JBoss. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
When accessing EJB in JBoss, you will encounter problems if the jar,JBoss access EJB that contains EJB and the war that accesses EJB through local interface are not packaged as an ear to deploy.
If your war contains the class of EJB's local interface, war throws ClassCastException when it gets a reference to EJB through jndi and tries to convert it to an interface type. If the class of the local interface is not included in the war, the exception of the class not found will be thrown. This is all caused by the pesky classloader problem. Each deployment unit placed in JBoss's deploy directory has its own independent classloader tree, which is level in jvm's classloader.
If both war and EJB jar contain the class of an EJB's local interface, then the same class exists in two classloader trees. The type of reference obtained through jndi is the type of local interface in EJB jar, and there is an error converting it to the local interface type in war because they are not the same class.
Classloader cannot access other classes under the classloader of the same level, so if the war does not contain the class of the interface, there will be an error because the class cannot be found.
JBoss accesses EJB when using ear. The classloader of EJB jar in the same ear is the parent classloader of war's classloader.
In this way, only one interface class needs to be deployed, and war can access it, because the child classloader can access the class loaded by the parent classloader.
Thank you for reading! This is the end of the article on "how to access EJB through the local interface under JBoss". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.