Yesterday saw a small part of the EJB sessionbean, a lot of theoretical knowledge in the book to see me in the fog, such as: remote master interface, remote interface, remote implementation class, ejb-jar.xml, weblogic-ejb-jar.xml. after reading it several times, I felt a little confused. I decided to practice it on my computer.
Software environment: myeclipse + weblogic8.1. use XDoclet to automatically generate the file. If you need to generate the file, proceed with instructions!
It was quite good when I did it. Then, when I deployed the EJB project to WebLogic and started running a test program in the customer segment, I encountered the following exceptions (I posted some of them, but I think it's okay to read the above main exception information, because some of the following prompts are the underlying content, as a beginner, I don't want to go to the underlying code first ):
Exception in thread "Main" javax. naming. namenotfoundexception: while trying to lookup 'ejb. COM/genuitec/trader/EJB/traderhome 'did' t find subcontext 'ejb 'resolved [root exception is javax. naming. namenotfoundexception: while trying to lookup 'ejb. COM/genuitec/trader/EJB/traderhome 'did' t find subcontext 'ejb 'resolved]; remaining name 'ejb/COM/genuitec/trader/EJB/traderhome' At weblogic. rjvm. basicoutboundrequest. sendreceive (basicoutboundrequest. java: 108)
At the beginning, I felt very depressed when I saw this exception, because I did it on books. there is no way to go to Baidu or Google. There are still a lot of content on the Internet, but I did not find a solution. most of it is said to check the ejb-har.xml and weblogic-ejb-jar.xml (especially the file contains a configuration is used for the server and client to communicate with the URL <JNDI-Name> EJB/Hello </JNDI-name >, if the value must be the same as that of lookup, see the following solution)
If the configuration file above is absolutely correct, log onto the Weblogic homepage, find the myserver under servers, right-click View JNDI tree, and open a new page. If the deployment is successful, you should have your deployed EJB project, then you can click the EJB tree to have your remote interface. At this time, 80% may be due to the XM configuration problem I mentioned above.
You have not seen the deployed EJB project in the JNDI tree. You don't have to think about it as if it was not successfully deployed! If you want to confirm, you can check the log file in your own domian domain to see if there is any exception. My exception is probably as follows:
<CST> <warning> <deployer> <Gao> <myserver> <executethread: '4' for queue: 'weblogic. kernel. system '> <WLS kernel> <BEA-149004> <failures were detected while initiating deploy task for application _ partition dir_testejb_jar.> #### <10:08:26 A.M. CST>
<Error> <deployer> <Gao> <myserver> <executethread: '4' for queue: 'weblogic. kernel. system'> <WLS kernel >>< BEA-149201>
<Failed to complete the deployment task with ID 0 for the Application _ includir_testejb_jar.java.lang.throwable:
This is the reason why I cannot deploy it. The JDK version is incorrect. Weblogic8.1 comes with JDK. We recommend that you use JDK of the same version as WebLogic for your EJB project during deployment, why?
I used jdk1.5 before and was unable to deploy it on weblogic. After a long time, I found out the problem (because I checked the configuration file ).
This is probably the cause of the error.
I use eclipse, so when a project is under construction, the default JRE version is 1.5. If you use the same tool as I used, you can right-click the project and select "Java compiler" next to "properties". The default value of "complier compliance level" is 5.0 In the list. You can select "1.4" to redeploy the project, running! ~~
OK. It took me a day to solve this problem.