7 Replies Latest reply on Apr 1, 2011 11:07 AM by rhinmass

    Execute stuff on server startup / EAR deployment: new problem. better solution?

    Frank Langelage Master

      I'm using the current JBossAS-6.0.0-SNAPSHOT version in test coming from version 4.2.3.

      The application is deployed as an ear file with war (Webservices) and jar (Session and Entity Beans) files included.

      On server startup or ear deployment some initialization has to be executed.

      So there is one war file containing

      public class StartupTimers implements ServletContextListener
      {

      ...

      }

       

      The web-app.xml for this module is

      <web-app version="2.5" 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/web-app_2_5.xsd">
          <listener>
              <listener-class>biz.mbisoftware.fn.web.StartupTimers</listener-class>
          </listener>
      </web-app>

       

      The application.xml file has this war file as the last module and jboss-app.xml defines <module-order>strict</module-order>.

       

      Thix concept worked fine on AS 4.2.3 but now I get sometimes, not every time, an error like this on startup:

      2010-12-12 16:56:01,064 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/mbi/mbi2e-lafr-sb2000-ipc/web].contextListenerStart] (Thread-2) Exception sending context initialized event to listener instance of class biz.mbisoftware.fn.web.StartupTimers: org.jboss.ejb3.common.registrar.spi.NotBoundException: Object is bound at key jboss.j2ee:ear=mbi2e-lafr-sb2000-ipc.ear,jar=ejb-session-planning.jar,name=MbiDiverEraser,service=EJB3, but is not fully installed, instead of state: MapControllerStateModel$ControllerStateWrapper@1e502d8{Start}
          at org.jboss.ejb3.common.registrar.plugin.mc.Ejb3McRegistrar.lookup(Ejb3McRegistrar.java:170) [:1.0.2]
          at org.jboss.ejb3.common.registrar.plugin.mc.Ejb3McRegistrar.lookup(Ejb3McRegistrar.java:134) [:1.0.2]
          at org.jboss.ejb3.proxy.impl.handler.session.SessionLocalProxyInvocationHandler.getContainer(SessionLocalProxyInvocationHandler.java:99) [:1.0.11]
          at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:178) [:1.0.11]
          at $Proxy619.schedule(Unknown Source)   at biz.mbisoftware.fn.web.StartupTimers.contextInitialized(StartupTimers.java:226) [:]
          at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3369) [:]
          at org.apache.catalina.core.StandardContext.start(StandardContext.java:3828) [:]
          at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:292) [:6.0.0-SNAPSHOT]
          at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:145) [:6.0.0-SNAPSHOT]
          at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:477) [:6.0.0-SNAPSHOT]
          at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118) [:6.0.0-SNAPSHOT]
          at org.jboss.web.deployers.WebModule.start(WebModule.java:95) [:6.0.0-SNAPSHOT]
          at sun.reflect.GeneratedMethodAccessor519.invoke(Unknown Source) [:1.6.0_23]

       

      So the StartupTimers class is run but the EJB are not fully installed yet.

       

      Is there anything to be changed for JBossAS 6.0?

      Is there a better way now to execute stuff on server startup / deployment?