2 Replies Latest reply on Sep 10, 2010 1:12 PM by jaikiran pai

    Annotation processing in war files too aggressive?

    jaikiran pai Master

      I have got a simple war file which contains an EJB3 bean (testing against AS trunk). The bean looks like this: {code:java} @Stateless public class SimpleSLSB extends SimpleBase { ... {code} The SimpleBase class (from which this bean extends) looks like: {code:java} public class SimpleBase {    @Resource    private EJBContext ejbContext; {code} So this base class is just a POJO with @Resource injection for EJBContext. During deployment of this .war on AS trunk, the web application deployer incorrectly starts processing this SimpleBase class and throws this exception: {code} 14:32:31,422 ERROR [StandardContext] Context [/myapp] startup failed due to previous errors: java.lang.RuntimeException: mapped-name is required for org.myapp.ejb3.impl.SimpleBase/ejbContext of deployment myapp.war         at org.jboss.web.tomcat.service.injection.WebResourceHandler.loadXmlResourceEnvRefs(WebResourceHandler.java:287) [:6.0.0-SNAPSHOT]         at org.jboss.web.tomcat.service.injection.WebResourceHandler.loadXml(WebResourceHandler.java:325) [:6.0.0-SNAPSHOT]         at org.jboss.web.tomcat.service.TomcatInjectionContainer.processMetadata(TomcatInjectionContainer.java:593) [:6.0.0-SNAPSHOT]         at org.jboss.web.tomcat.service.WebCtxLoader.start(WebCtxLoader.java:157) [:6.0.0-SNAPSHOT]         at org.apache.catalina.core.StandardContext.start(StandardContext.java:3737) [:]         at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:309) [:6.0.0-SNAPSHOT]         at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:144) [:6.0.0-SNAPSHOT]         at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461) [:6.0.0-SNAPSHOT]         at org.jboss.web.deployers.WebModule.startModule(WebModule.java:116) [:6.0.0-SNAPSHOT]         at org.jboss.web.deployers.WebModule.start(WebModule.java:95) [:6.0.0-SNAPSHOT] {code} The real issue here is that the WarAnnotationDeployer picks up this SimpleBase class for annotation processing and creates metadata for @Resource and adds it to the WebAppMetaData (resourceEnvRefGroups). Shouldn't the annotation deployer just pick up servlets (and maybe some additional classes for Servlet 3.0 spec?) for annotation processing? IMO, the SimpleBase class should have been completely skipped from annotation processing in the WarAnnotationDeployer.