This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JBoss/WildFly and the fly likes Dependency Injection in war deployed to jboss Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Dependency Injection in war deployed to jboss" Watch "Dependency Injection in war deployed to jboss" New topic
Author

Dependency Injection in war deployed to jboss

Gaurav Bhatia
Ranch Hand

Joined: Jan 01, 2007
Posts: 49
Is it possible to inject beans to war deployed in jboss 5?
After searching through documentation and online tutorials, i understand need to package beans + war into an EAR and then deploy.

What is did :
Added beans to the war file, added listener to web.xml, added spring configuration file to WEB-INF folder and deployed the war.
Deployment fails with errors like

2011-09-07 02:45:59,356 INFO [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (main) deploy, ctxPath=/ServerTime
2011-09-07 02:45:59,403 WARN [org.jboss.web.tomcat.service.injection.WebEJBRemoteHandler] (main) EJBTHREE-1289: Using legacy EjbEncInjector, because mappedName for enc "env/com.test.ws.server.ServerTime/bean", field "null" is null (container.environmentRefGroup.annotatedEjbReferences = [AnnotatedEJBReferenceMetaData{name=com.test.ws.server.ServerTime/bean,ejb-ref-type=null,link=null,ignore-dependecy=false,mapped/jndi-name=null,resolved-jndi-name=null,beanInterface=class com.test.ws.server.TestBean}])
2011-09-07 02:45:59,466 ERROR [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (main) ENC setup failed
java.lang.IllegalStateException: Resolution should not happen via injection container
at org.jboss.web.tomcat.service.TomcatInjectionContainer.getEjbJndiName(TomcatInjectionContainer.java:640)
at org.jboss.injection.EjbEncInjector.inject(EjbEncInjector.java:80)
at org.jboss.web.tomcat.service.TomcatInjectionContainer.populateEnc(TomcatInjectionContainer.java:482)
at org.jboss.web.tomcat.service.deployers.TomcatDeployment$EncListener.lifecycleEvent(TomcatDeployment.java:471)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4388)
at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:310)



... 69 more
2011-09-07 02:45:59,622 INFO [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (main) deploy, ctxPath=/jmx-console
2011-09-07 02:45:59,731 ERROR [org.jboss.system.server.profileservice.ProfileServiceBootstrap] (main) Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

DEPLOYMENTS IN ERROR:
Deployment "vfszip:/C:/DevTools/jboss-5.1.0.GA/server/default/deploy/ServerTime.war/" is in error due to the following reason(s): java.lang.IllegalStateException: Resolution should not happen via injection container


~Gaurav<br />SCJP5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dependency Injection in war deployed to jboss
 
Similar Threads
Running application on web start
problems on getting access to an java bean class from a servlet
DI ejb into JSF bean, JBoss 6
Newbie to JBoss
another project can run in tomcat inside eclipse but cannot run in jboss 5.0.1