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