- This topic has 6 replies, 2 voices, and was last updated 19 years, 3 months ago by dandubinsky.
-
AuthorPosts
-
dandubinskyParticipantI have a web project and an EJB project created with My Eclipse. The Web project deploys fine, but I’m having some trouble deploying the EJB. The project has one session bean (TestSession) , but I can’t access it from the utility class generated by MyEclipse. I get a
javax.naming.NameNotFoundException: ejb/TestSession not found in Test3Web
at com.oracle.naming.J2EEContext.getSubContext(J2EEContext.java:93)
at com.oracle.naming.J2EEContext.lookup(J2EEContext.java:76)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.ApplicationContext.lookup(ApplicationContext.java:177)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.ApplicationContext.lookup(ApplicationContext.java:119)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at testBean.interfaces.TestSessionUtil.lookupHome(TestSessionUtil.java:22)
at testBean.interfaces.TestSessionUtil.getHome(TestSessionUtil.java:42)
at _MyJsp._jspService(_MyJsp.java:61)I’m not sure what’s wrong. Are there any manual steps you have to follow after creating a bean for OC4J with the wizard generated classes and/or xml files before you can use them?
Riyad KallaMemberIf you want to access your EJB from your Web Project, you need to setup a Enterprise Application and make the EJB and Web projects modules of it. Then deploy the EAR.
The reason I assumed you are doing this is because your error says “Test3Web”, looks like you are tryign to access the EJB from the Web project, but I could be wrong.
dandubinskyParticipantThanks rkalla. I used the wizard to create an enterprise application and in there checked the boxes to create a web application and a ejb application. I created a stateless session bean and a simple Jsp page, generated the supporting classes and descriptors with xdoclet and then deployed everything.
The jsp in the web app is trying to call the ejb which is generating the error. The code in the Jsp that’s causing the error is:
<% TestSessionHome home=TestSessionUtil.getHome();
TestSession bean = home.create();
bean.replaceWithRealBusinessMethod();
%>The TestSessionHome, TestSession and TestSessionUtil along with all the related descriptors was generated by the xdoclet stuff that comes with MyEclipse. It’s all simple stuff (basically hello world). I think maybe xdoclet didn’t generate something correctly, or maybe I’m using the generated stuff wrong somehow.
Riyad KallaMemberIf the error you are getting is pertaining to “Cannot find class TestSession” or somethign to that effect, be sure to add your EJB project to the build path of your web project. The EAR project takes care of deploying the two of them and the app server will setup the classpath accordingly, but during development you will need to make the Web Project see the EJB project manully.
dandubinskyParticipantI do have the EJB project in the build path for the web project. I don’t see any errors in the console, just no bean. I have a feeling that the problem is in the generated orion-ejb-jar.xml. The only thing in there is:
<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE orion-ejb-jar PUBLIC “-//Evermind//DTD Enterprise JavaBeans 1.1 runtime//EN” “http://xmlns.oracle.com/ias/dtds/orion-ejb-jar.dtd”>
<orion-ejb-jar deployment-version=”9.0.4.0.0″><enterprise-beans>
<!– Session Beans deployment –>
<session-deployment name=”TestSession”
>
</session-deployment>
<!– Entity Beans deployment –>
<!– Message Driven Beans deployment –>
<!–
To add additional beans that you have deployment descriptor info for, put
a file in your XDoclet merge directory called oc4j-beans.ent that contains
the session-deployment, entity-deployment or message-driven-deployment
markup for those beans.
–>
</enterprise-beans>
</orion-ejb-jar>It has a “red x” in the development environment indicating that <assembly-descriptor> tag is missing. Also there is no jndi name in there. Is there an example somewhere of a properly formed descriptor for a stateless session bean for this file?
Thanks,
Dan
Riyad KallaMemberDan,
We are outside the realm of what I know here, so I kicked this to our enterprise group, let’s see if they have any sanity left to reply (4.0 release is #1 priority).
dandubinskyParticipantAfter some hacking around, I think I have it. It looks like it’s deploying the EJB as it’s named in ebj-jar.xml and the orion-ejb-jar.xml doesn’t seem to effect anything. The generated ejb-jar.xml had the bean named “TestSession”. The generated service locator TestSessionUtil was trying to find it under “java:comp/env/ejb/TestSession”.
-
AuthorPosts