Pojo bean deployment lifecycle is not behaving properly
saltnlight5 Jul 29, 2012 10:34 PMHi there,
I tried the POJO bean sample from https://github.com/danbev/migrate/tree/master/mcbeans with "test-jboss-beans.xml" as follow:
<deployment xmlns="urn:jboss:pojo:7.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:pojo:7.0 jboss-pojo_7_0.xsd"> <bean name="testBean" class="se.rl.mcbeans.TestBean"> <install method="start"/> <uninstall method="stop"/> </bean> </deployment>
I will paste the bean class for convenient here:
package se.rl.mcbeans;
import org.apache.log4j.Logger;
public class TestBean {
private Logger log = Logger.getLogger(TestBean.class);
public TestBean() {
System.out.println("created TestBean");
}
public void start() {
log.info("start ");
}
public void stop() {
log.info("stop ");
}
}
When I deploy mcbeans.jar in JBossAS7, it deployed successfully, however, it called the "start" method twice! Is there reason for this behavior? See my log here:
10:25:18,600 WARN [org.jboss.as.dependency.private] (MSC service thread 1-3) JBAS018567: Deployment "deployment.mcbeans.jar" is using a private module ("org.apache.log4j:main") which may be changed or removed in future versions without notice.
10:25:18,646 INFO [stdout] (MSC service thread 1-6) created TestBean
10:25:18,662 INFO [se.rl.mcbeans.TestBean] (MSC service thread 1-6) start
10:25:18,662 INFO [se.rl.mcbeans.TestBean] (MSC service thread 1-2) start
10:25:18,662 INFO [org.jboss.as] (MSC service thread 1-7) JBAS015951: Admin console listening on http://127.0.0.1:9990
10:25:18,678 INFO [org.jboss.as] (MSC service thread 1-7) JBAS015874: JBoss AS 7.1.1.Final "Brontes" started in 3015ms - Started 153 of 231 services (77 services are passive or on-demand)
10:25:18,787 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "mcbeans.jar"
Also, second problem is that "stop" method seems to only called when I redeploy the "mcbeans.jar" while server is still running ("stop" also got called twice during redeploy btw). However, when I shutdown the server, the "mcbeans.jar" is undeployed, but the "stop" did not get called! See my log here:
10:25:24,802 INFO [org.jboss.as.osgi] (MSC service thread 1-5) JBAS011942: Stopping OSGi Framework 10:25:24,818 INFO [org.jboss.as.logging] JBAS011503: Restored bootstrap log handlers 10:25:24,818 INFO [org.apache.catalina.core.StandardContext] Container org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/] has not been started 10:25:24,834 INFO [com.arjuna.ats.jbossatx] ARJUNA032018: Destroying TransactionManagerService 10:25:24,834 INFO [com.arjuna.ats.jbossatx] ARJUNA032014: Stopping transaction recovery manager 10:25:24,865 INFO [org.jboss.as.server.deployment] JBAS015877: Stopped deployment mcbeans.jar in 75ms 10:25:24,865 INFO [org.jboss.as] JBAS015950: JBoss AS 7.1.1.Final "Brontes" stopped in 73ms
These behavior is NOT what i am expecting. Has anyone encountered them?
Thanks,
Zemian Deng
Message was edited by: jaikiran pai - Fixed formatting