• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem lookingup entity EJB on Orion 2.0

 
Razvan Droscaru
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm new to J2EE technology, so, I apologise for my stupid problem, but I can't handle it.
I use Orion 2.0, and MySql 4.0.13. I have a table in a database, an entity bean for that table, and a simple web application for selecting and inserting using the entity bean.
I have the following structure dir/files:
/WLTestOrionEAR
/WLTestOrionEAR/META-INF
/WLTestOrionEAR/META-INF/Manifest.mf
/WLTestOrionEAR/META-INF/application.xml
/WLTestOrionEAR/wltest.jar
/WLTestOrionEAR/WLTestOrionWEB.war
application.xml looks like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd">
<application>
<display-name>WLTestOrionEAR</display-name>
<module>
<ejb>wltest.jar</ejb>
</module>
<module>
<web>
<web-uri>WLTestOrionWEB.war</web-uri>
<context-root>WLTestOrionWEB</context-root>
</web>
</module>
</application>
wltest.jar contains:
/META-INF
/META-INF/MANIFEST.MF
/META-INF/ejb-jar.xml
/wltest
/wltest/Users.class
/wltest/UsersBean.class
/wltest/UsersHome.class
ejb-jar.xml looks like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<enterprise-beans>
<entity>
<display-name>Users</display-name>
<ejb-name>wltest.Users</ejb-name>
<local-home>wltest.UsersHome</local-home>
<local>wltest.Users</local>
<ejb-class>wltest.UsersBean</ejb-class>
<persistence-type>Bean</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>Users</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>

In the client application I use the following code to lookup the EJB:
InitialContext ic = new InitialContext();
Object objRef = ic.lookup("java:comp/env/ejb/Users");
home = (UsersHome)PortableRemoteObject.narrow(objRef, UsersHome.class);
I tried:
.. ic.lookup("ejb/Users");
.. ic.lookup("Users");
.. ic.lookup("wltest.Users");
.. and many others ....

The error is:
javax.naming.NameNotFoundException: ejb/Users not found in WLTestOrion/WLTestOrionWEB, there are no bound values
at com.evermind._jm.lookup(.:79)
at com.evermind._au._rw(.:129)
at com.evermind._au.lookup(.:62)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at util.WLManage.<init>(WLManage.java:21)
at __jspPage0_index_jsp._jspService(__jspPage0_index_jsp.java:34)
at com.orionserver.http.OrionHttpJspPage.service(.:68)
at com.evermind._ay._rfb(.:5737)
at com.evermind.server.http.JSPServlet.service(.:31)
at com.evermind._cub._phd(.:518)
at com.evermind._cub._bgc(.:174)
at com.evermind._ax._lqc(.:614)
at com.evermind._ax._tvb(.:189)
at com.evermind._bf.run(.:62)
It seems to me that the name I use for lookingup the bean is wrong.
Thanks for any advice!
Razvan Droscaru
 
Razvan Droscaru
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My /WLTestOrionEAR/WLTestOrionWEB/Web-inf/web.xml looked like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app />
and it should look like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<ejb-local-ref>
<ejb-ref-name>ejb/Users</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>wltest.UsersHome</local-home>
<local>wltest.Users</local>
</ejb-local-ref>
</web-app>
Razvan Droscaru
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic