on 12-06-2006 2:46 PM
Hi All,
i am using Eclipse 3.2 to create an EJB module.
i created a new EJB project......in it in ejbModule, i created a package and a JAVA class in it...........
when in the JAVA class, i wrote import javax.ejb.SessionBean; it gave error on javax.ejb saying "javax.ejb cant be resolved"............
Can anybody suggest how to rectify this error.
Thanks,
Rajeev Gupta
Hi,
You need to put in the classpath a jar file containing that interface. You could download this from the official sun J2EE site or perhaps take it from some application server on which you are planning to run your EJB. For example on Netweaver 2004 you could take such jar file from
:\usr\sap\<sid>\<instance>\j2ee\j2eeclient\ejb20.jar
HTH
Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
yah i got the ejb20 file - so now the import is okay.........
i am trying to develop a demo EJB project in Eclipse 3.2 so after it, i will try to generate an EAR file for it so that then i can use it in some other demo project.....
now i am facing a problem that i am not able to see EJB Candidate in my project, so i am not able to add my class file to ejb.jar xml file........i am also not able to see ejb-j2ee-engine.xml............
So can anybody help me to rectify this situation.
Thanks,
Rajeev Gupta
Hi All,
i created a jar file for my ejb project...........
Now i imported that jar file in a new java prj, then i am able to instantiate that ejb class in the main method of the new java prj.........
In the window i can also see all methods of the ejb class.........
My ejb-jar xml file is having the below content:
<ejb-jar id="ejb-jar_ID" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">;
<description>Hello World EJB description</description>
<display-name>prjHelloWorldEJB</display-name>
<enterprise-beans>
<ejb-name>HelloWorldEJB</ejb-name>
<ejb-class>pkgHelloWorldEJB.HelloWorldEJB</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</enterprise-beans>
</ejb-jar>
Like i declared a function:
public String strReturn(){
return "Hello JAVA EJB World";
}
When i called this function by obj.strReturn() then no compilation error was there.
<b>But when i run this JAVA prj application, it gave error java.lang.NoClassDefFoundError: pkgEJB/ClassEJB
at pkg.class.main of JAVA prj application</b>.
Can anybody suggest me what should i do to rectify this situation.
Thanks,
Rajeev Gupta
Hi Rajeev,
you have to add the ejb20.jar to your classpath.
Alex
Message was edited by:
Alexander Birkle
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.