4 Replies Latest reply on Oct 11, 2011 5:48 PM by Mariano Kocalka Machala

    [jboss6] deployment fails when servlet in jar inherits a class with an EJB property

    Chris Wesdorp Newbie

      Hello,

       

      Deploying an application developed on Glassfish to JBoss 6 final I ran into a problem which seems to be related to inheritence between different projects. Attached you will find a project to reproduce the problem.

       

      The project is an EAR project, in the project are EJB jar, a WAR and two jars containing a web-fragment.xml. The project fragment contains a base class for other servlets called BaseServlet. This class has a property "@EJB CounterBeanLocal counterBean;". In the same package is a servlet called CounterServlet which inherits from BaseServlet. When the project is included in the WAR and deployed everything works well.

       

      When the second project, fragment2, is added a deployment error is raised. The second JAR contains a servlet called StatServlet which also inherits from BaseServlet. When this project is deployed almost immediatly JBoss throws an error.

       

       

      2011-05-11 15:48:38,113 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (HDScanner) Error installing to PostClassLoader: name=vfs:///C:/Develop/servers/jboss-6.0.0.Final/server/default/deploy/jboss-singleton-deploy-ear-1.0-SNAPSHOT.ear state=ClassLoader mode=Manual requiredState=PostClassLoader: org.jboss.deployers.spi.DeploymentException: Deployment error processing fragment for JAR: jboss-singleton-deploy-fragment2-1.0-SNAPSHOT.jar
          at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49) [:2.2.0.GA]
          at org.jboss.web.deployers.MergedJBossWebMetaDataDeployer.deploy(MergedJBossWebMetaDataDeployer.java:394) [:6.0.0.Final]
      ...
      Caused by: java.lang.IllegalStateException: Unresolved conflict on EJB reference named: nl.chriswedorp.demos.jbosssingletondeployfragment.BaseServlet/counterBean
          at org.jboss.metadata.javaee.spec.AnnotatedEJBReferencesMetaData.augment(AnnotatedEJBReferencesMetaData.java:116) [:2.0.0.Alpha24]
          at org.jboss.metadata.javaee.spec.RemoteEnvironmentRefsGroupMetaData.augment(RemoteEnvironmentRefsGroupMetaData.java:615) [:2.0.0.Alpha24]
      

       

      After some searching and trying to rebuild the problem I found out the inheritence of StatServlet in fragment2 causes the problem. When the inheritence is removed, or the EJB injection from BaseServlet is removed it all works.

       

      Glassfish 3 doesn't complain about this construction. Is this a bug?

       

      Regards,

       

      Chris