1 Reply Latest reply on Oct 7, 2008 12:40 PM by peterj

    Unwanted deployment of the shared STLBs

    havramm

      We have one shared library that contains several STLBs. This library needs to be deployed either as single EJB-JAR or
      as shared JAR from which STLBs will be deployed using XML descriptors.

      In the case when we need to deploy same STLB several times (using ejb-jar.xml) under different names we are using following structure of EAR:

      +-test.ear
      |
      +-META-INF
      | +-MANIFEST.INF
      | +-application.xml (1)
      |
      +-depl.jar
      | +-META-INF
      | +-MANIFEST.MF
      | +-ejb-jar.xml (2)
      |
      +-lib
       +-shared-ejbs.jar
       +-META-INF
       | +-MANIFEST.MF
       |
       +-test
       +-SharedLocal.class (3)
       +-SharedBean.class (4)


      With following contents:

      application.xml (1):

      <?xml version="1.0" encoding="UTF-8"?>
      <application xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
       version="5">
       <description>SDMS Enterprise Application</description>
       <display-name>test-ear</display-name>
       <module>
       <ejb>depl.jar</ejb>
       </module>
      </application>


      ejb-jar.xml (2):

      <?xml version="1.0" encoding="UTF-8"?>
      <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
       version="3.0">
       <enterprise-beans>
      
       <session>
       <ejb-name>FirstSharedBean</ejb-name>
       <ejb-class>test.SharedBean</ejb-class>
       </session>
      
       <session>
       <ejb-name>SecondSharedBean</ejb-name>
       <ejb-class>test.SharedBean</ejb-class>
       </session>
      
       </enterprise-beans>
      </ejb-jar>


      SharedLocal.class (3):

      package test;
      
      import javax.ejb.Local;
      
      @Local
      public interface SharedLocal {
       String sayHello();
      }
      


      SharedBean.class (4):

      package test;
      
      import javax.ejb.Stateless;
      
      @Stateless
      public class SharedBean implements SharedLocal {
       String sayHello() {
       return "Hello, World!";
       }
      }
      


      Using this approach we have not problems with JBoss v4.2.2 and v4.2.3 - one shared STLB has been deployed under two different names.
      These days we are testing our deployments on JBoss v5.0.0.CR2 and we have noticed that our shared STLB is deployed not two but three times -
      beside two explicitly deployed (FirstSharedBean and SecondSharedBean) there is one more instance deployed as SharedBean:

      [url=http://img383.imageshack.us/img383/4513/sshot1be6.jpg][img]http://img383.imageshack.us/img383/4513/sshot1be6.jpg[/img][/url]
      [Click on link to see the JNDI View...]

      Also, here is the log of deployment:

      11:21:06,185 WARN [EjbMetadataJndiPolicyDecoratorDeployer] Defaulting to DefaultJndiBindingPolicy of "org.jboss.metadata.ejb.jboss.jndipolicy.plugins.BasicJndiBindingPolicy" for Session Bean SharedBean
      11:21:06,185 WARN [EjbMetadataJndiPolicyDecoratorDeployer] Defaulting to DefaultJndiBindingPolicy of "org.jboss.metadata.ejb.jboss.jndipolicy.plugins.BasicJndiBindingPolicy" for Session Bean FirstSharedBean
      11:21:06,185 WARN [EjbMetadataJndiPolicyDecoratorDeployer] Defaulting to DefaultJndiBindingPolicy of "org.jboss.metadata.ejb.jboss.jndipolicy.plugins.BasicJndiBindingPolicy" for Session Bean SecondSharedBean
      11:21:06,205 INFO [JBossASKernel] Created KernelDeployment for: test-ear.ear
      11:21:06,205 INFO [JBossASKernel] installing bean: jboss.j2ee:ear=test-ear.ear,jar=test-ear.ear,name=SharedBean,service=EJB3
      11:21:06,205 INFO [JBossASKernel] with dependencies:
      11:21:06,205 INFO [JBossASKernel] and demands:
      11:21:06,205 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService
      11:21:06,205 INFO [JBossASKernel] and supplies:
      11:21:06,205 INFO [JBossASKernel] Class:test.SharedLocal
      11:21:06,205 INFO [JBossASKernel] jndi:SharedBean/remote
      11:21:06,205 INFO [JBossASKernel] jndi:SharedBean/local
      11:21:06,205 INFO [JBossASKernel] jndi:SharedBean/local-test.SharedLocal
      11:21:06,205 INFO [JBossASKernel] Added bean(jboss.j2ee:ear=test-ear.ear,jar=test-ear.ear,name=SharedBean,service=EJB3) to KernelDeployment of: test-ear.ear
      11:21:06,247 INFO [JBossASKernel] Created KernelDeployment for: depl.jar
      11:21:06,247 INFO [JBossASKernel] installing bean: jboss.j2ee:ear=test-ear.ear,jar=depl.jar,name=FirstSharedBean,service=EJB3
      11:21:06,247 INFO [JBossASKernel] with dependencies:
      11:21:06,247 INFO [JBossASKernel] and demands:
      11:21:06,247 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService
      11:21:06,247 INFO [JBossASKernel] and supplies:
      11:21:06,247 INFO [JBossASKernel] Class:test.SharedLocal
      11:21:06,247 INFO [JBossASKernel] jndi:test-ear/FirstSharedBean/local
      11:21:06,247 INFO [JBossASKernel] jndi:test-ear/FirstSharedBean/local-test.SharedLocal
      11:21:06,247 INFO [JBossASKernel] jndi:test-ear/FirstSharedBean/remote
      11:21:06,247 INFO [JBossASKernel] Added bean(jboss.j2ee:ear=test-ear.ear,jar=depl.jar,name=FirstSharedBean,service=EJB3) to KernelDeployment of: depl.jar
      11:21:06,248 INFO [JBossASKernel] installing bean: jboss.j2ee:ear=test-ear.ear,jar=depl.jar,name=SecondSharedBean,service=EJB3
      11:21:06,248 INFO [JBossASKernel] with dependencies:
      11:21:06,248 INFO [JBossASKernel] and demands:
      11:21:06,248 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService
      11:21:06,248 INFO [JBossASKernel] and supplies:
      11:21:06,248 INFO [JBossASKernel] jndi:test-ear/SecondSharedBean/remote
      11:21:06,248 INFO [JBossASKernel] Class:test.SharedLocal
      11:21:06,248 INFO [JBossASKernel] jndi:test-ear/SecondSharedBean/local-test.SharedLocal
      11:21:06,248 INFO [JBossASKernel] jndi:test-ear/SecondSharedBean/local
      11:21:06,248 INFO [JBossASKernel] Added bean(jboss.j2ee:ear=test-ear.ear,jar=depl.jar,name=SecondSharedBean,service=EJB3) to KernelDeployment of: depl.jar
      11:21:06,307 INFO [SessionSpecContainer] Starting jboss.j2ee:ear=test-ear.ear,jar=test-ear.ear,name=SharedBean,service=EJB3
      11:21:06,307 INFO [EJBContainer] STARTED EJB: test.SharedBean ejbName: SharedBean
      11:21:06,307 WARN [SessionSpecContainer] Populating JBoss-specific annotation metadata manually until done by deployers: jboss.j2ee:ear=test-ear.ear,jar=test-ear.ear,name=SharedBean,service=EJB3
      11:21:06,385 INFO [SessionSpecContainer] Starting jboss.j2ee:ear=test-ear.ear,jar=depl.jar,name=FirstSharedBean,service=EJB3
      11:21:06,385 INFO [EJBContainer] STARTED EJB: test.SharedBean ejbName: FirstSharedBean
      11:21:06,385 WARN [SessionSpecContainer] Populating JBoss-specific annotation metadata manually until done by deployers: jboss.j2ee:ear=test-ear.ear,jar=depl.jar,name=FirstSharedBean,service=EJB3
      11:21:06,464 INFO [SessionSpecContainer] Starting jboss.j2ee:ear=test-ear.ear,jar=depl.jar,name=SecondSharedBean,service=EJB3
      11:21:06,465 INFO [EJBContainer] STARTED EJB: test.SharedBean ejbName: SecondSharedBean
      11:21:06,465 WARN [SessionSpecContainer] Populating JBoss-specific annotation metadata manually until done by deployers: jboss.j2ee:ear=test-ear.ear,jar=depl.jar,name=SecondSharedBean,service=EJB3
      


      Obviously, deployment strategy within JBoss has been changed (we do not consider which one is "by spec").
      Our problem is that we do not want to have such unwanted deployment of our SharedBean - is there anything we can do to prevent implicit deployment
      of STLBs from shared libs?