-
1. Re: Problem with EJB Injection in Servlet
sarabjit Aug 13, 2009 7:49 AM (in response to sarabjit)My ear structure is
EAR
|->Meta-inf
|-------|->application.xml-(defines-the-two-ejb-and-war-modules)
|-------|->jboss-app.xml-(empty)
|->my-war.war
|-------|->WEB-INF
|--------------|->web.xml-(no-declaration-of-ejb-here)
|->myejb.jar
|-------|->META-INF
|--------------|->jboss.xml-(which-is-basically-empty---just-usual-xml-markup)
|--------------|->ejb-jar.xml(which-is-empty-too)
|->all-shared-libraries -
2. Re: Problem with EJB Injection in Servlet
jaikiran Aug 13, 2009 10:23 AM (in response to sarabjit)If you are starting with EJB3 then i would recommend you to use the latest AS5 version (i.e. 5.1.0) because it has better spec compliant support for EJB3.
Injection of EJB3 in servlets isn't supported in 4.2.x for reasons mentioned in our Sticky here http://www.jboss.org/index.html?module=bb&op=viewtopic&t=107353
I've put shared libraries directly under the ear but they are not visible to my war. How can i fix that?
Place those common jars in the EAR/lib folder. -
3. Re: Problem with EJB Injection in Servlet
sarabjit Aug 22, 2009 3:46 AM (in response to sarabjit)Hey Jaikiran,
Thanks for your reply. I tried using the same annotation in JBoss 5.1 but it gives the same error. I've now used pitchfork to support annotations in my servlets and web modules.
One more quick question about shared libraries here. I've put my shared libs directly under ear. And the libs specific to war in WEB-INF/lib
myear.ear
|____myjar.jar
|____mywar.war
............|___WEB-INF
.....................|__lib
...........................|__mywarlib.jar
Manifest.mf in mywar.war is
Class-Path: myjar.jar mywarlib.war
My war is able to access files in myjar.jar but it gives a NoClassDefFound for all classes n mywarlib.war
Can you please tell me how i can specify relative paths in manifest? -
4. Re: Problem with EJB Injection in Servlet
sarabjit Aug 22, 2009 4:16 AM (in response to sarabjit)btw i already tried changing manifest to
Class-Path: myjar.jar WEB-INF/lib/mywarlib.war -
5. Re: Problem with EJB Injection in Servlet
wolfgangknauf Aug 24, 2009 7:38 AM (in response to sarabjit)Hi,
the JAR files in WEB-INF\lib are automatically added to the classpath, no need to add those to META-INF\Manifest.mf.
As you are using EJB3, you don't need any deployment descriptors besides web.xml, if you use annotations. You might try to remove them all, just to check that no error in one of them breaks your app.
You might post the relevant parts of your servlet code, which don't work. And what is the error message?
Best regards
Wolfgang