9 Replies Latest reply on Mar 4, 2011 4:33 AM by jaikiran

    Incorrect Redeployment of ejb/service module in JBoss 6

    fambad

      Hi,

       

      I have a litte test project with a service bean. In the service start method I log some test output. Then I changed the log output and deploy the module again without starting the jboss again. After redeploying the log output is the same like before and not the new one. The same situation can be observed when deploying and simple stateless session bean. When I changed one method and redeploy the bean then the old code is being executed.

       

      Beispiel:

       

      @Service(objectName="mst.test.ejb:service=TestService1")

      @Management(ITestService1MBean.class)

      public class TestService1 implements ITestService1MBean {

          private static final Logger logger = Logger.getLogger( TestService1.class );

       

       

          public void start() throws Exception {       

              logger.info( "Test 1"); // --> the test output

          }

      }

       

      Now I start the server and when the service is being started I see the log output: Test 1

       

       

      The I changed the log output to: logger.info( "Test 2"); and deploy the module again. The service is being initialized and the start method will be called. But the output I see is: Test 1 (but I should see Test 2)

       

       

      So what is the problem. Is something wrong in my code?

        • 1. Incorrect Redeployment of ejb/service module in JBoss 6
          jaikiran

          How do you redeploy the application? And how do you ensure that the new .class file is indeed available in the redeployed app? And how is your application packaged (.ear, .war or .jar)?

          • 2. Incorrect Redeployment of ejb/service module in JBoss 6
            fambad

            I deployed is as jar-file. After redeploying the jar I opened the jar file and decompile the service class. And so I saw that the new code is within the class.

             

            I deploy the jar using my own specified deployment directory of jboss (JBOSS_HOME/server/default/my-deploy).

            • 3. Incorrect Redeployment of ejb/service module in JBoss 6
              jaikiran

              Marco Strauch wrote:

               

              I deploy the jar using my own specified deployment directory of jboss (JBOSS_HOME/server/default/my-deploy).

              I am not sure hot deployment is enabled by default to custom deploy folders like the one you have. How did you setup the server to use my-deploy as a deploy location?

              • 4. Incorrect Redeployment of ejb/service module in JBoss 6
                fambad

                I setup the deploy folder using the profile.xml in bootstrap folder:

                 

                    <bean name="UserProfileFactory"

                        class="org.jboss.system.server.profileservice.bootstrap.StaticBootstrapProfileFactory">

                        <property name="confURI">${jboss.server.config.url}</property>

                        <property name="deployersURI">${jboss.server.home.url}deployers</property>

                        <property name="applicationURIs">

                            <list elementClass="java.net.URI">

                                <value>${jboss.server.home.url}deploy</value>

                               <value>${jboss.server.home.url}my-deploy</value>

                            </list>

                        </property>

                        <property name="attachmentStoreRoot">${jboss.server.data.dir}/attachments</property>

                    </bean>

                 

                 

                At the same time I tested a little bit more. And no I must admit that it was my error. Because I tested some use case I deployed some classes in a previous sample in the lib dir. Because that the service class was also available in the lib folder and so this class were used and not the class in the deploy folder.

                 

                Sorry for that. I don't recognized this.

                • 5. Incorrect Redeployment of ejb/service module in JBoss 6
                  jaikiran

                  Marco Strauch wrote:

                   

                  Because I tested some use case I deployed some classes in a previous sample in the lib dir. Because that the service class was also available in the lib folder and so this class were used and not the class in the deploy folder.

                   

                   

                  Yes, that would explain this behaviour.

                   

                   

                   

                  Marco Strauch wrote:

                   

                  Sorry for that. I don't recognized this.

                  No problem!

                  • 6. Incorrect Redeployment of ejb/service module in JBoss 6
                    fambad

                    Maybe I can ask another question here.

                     

                    When I have two ejb modules as jars deployed and want to reference a stateless session bean using the @EJB annotation that is situated in the other jar I have to set the mappedName of the @EJB annotation. Why have I to set this. In JBoss 4.2.x I don't have to set this mappedName property.

                     

                    Sample:

                     

                    ejb-module-1.jar

                     

                    @Stateless

                    public class TestSessionBean1 {

                     

                      // methods

                    }

                     

                     

                    ejb-module-2.jar

                     

                    @Stateless

                    public class TestSessionBean2 {

                     

                      @EJB

                      private TestSessionBean1 test; // will not work

                     

                      @EJB( mappedName = "TestSessionBean1/no-interface" )

                      private TestSessionBean1 test; // will work

                     

                    }

                    • 7. Incorrect Redeployment of ejb/service module in JBoss 6
                      jaikiran

                      Injection across separate deployments (like the one you have) isn't supported https://issues.jboss.org/browse/JBAS-6332

                       

                      You can however package both those jars in a single .ear (if you application allows you to do that) and then you can just inject using @EJB without the mappedName.

                      • 8. Incorrect Redeployment of ejb/service module in JBoss 6
                        fambad

                        OK. Thanks for the quick answers.

                         

                        In our case we want to deploy several modules outside one big ear to be more flexibel. So we will set the mappedName.

                         

                        Will this issue be resolved in future or will this stay unsupported?

                        • 9. Incorrect Redeployment of ejb/service module in JBoss 6
                          jaikiran

                          Marco Strauch wrote:

                           


                          Will this issue be resolved in future or will this stay unsupported?

                          No one has yet taken it up and it's not marked for any release yet. But if there's enough interest in this one then it might get fixed in AS7 (which is currently under development).