2 Replies Latest reply on Jul 19, 2010 8:13 AM by Ahmad El Rajabi

    use System Property in MBean Scheduler jboss-service.xml

    Ahmad El Rajabi Newbie

      I'm working on jboss migration project, we are moving projects from Jboss 4.0.5 to Jboss EAP 5.0.0, I have a couple of Mbean scheduler projects which are deployed and been working for a couple of years,  In jboss-service.xml we used system properties in order to set some values such as InitialStartDate, SchedulePeriod both values are saved in a property file controlled by jboss property-service.xml, which make it easier on the admin to change the values without rebuilding the project. so when we moved both sar projects to Jboss EAP 5.0.0 the scheduler failed to deploy when we restart JBOSS, but it deploys without any problems if the server is already running. In the case where we encounter failure we notice that the .SAR file is getting deployed before <mbean code="org.jboss.varia.property.SystemPropertiesService"

      name="jboss:type=Service,name=SystemProperties">.  the following is jboss-service.xml, a sample file i was using in order to find a solution for this issue. 

       

      <?xml version="1.0" encoding="UTF-8"?>

       

      <server>

           <mbean code="org.jboss.varia.scheduler.Scheduler"

        name=":service=Scheduler,name=Hello_World_Scheduler">

      <attribute name="StartAtStartup">true</attribute>

        <attribute name="SchedulableClass">com.elrajabia.test.app.TestService</attribute>

      <attribute name="InitialStartDate">${com.elrajabia.test.app.prop.initialstartdate}</attribute>

        <attribute name="SchedulePeriod">${com.elrajabia.test.app.prop.scheduleperiod}</attribute>

        <attribute name="InitialRepetitions">-1</attribute>

        <attribute name="FixedRate">true</attribute>

      </server>

       

      After some research i tried to add <depends>jboss:name=SystemProperties,type=Service</depends> so the SAR wont deploy until properties are loaded into the container, also I tried to add SAR into an ear project so it will be deployed with other EAR project I also added <depends> jboss.j2ee:service=EARDeployer</depends>, but in both cases i got the following error

       

       

       

      16:09:04,326 INFO  [TestService:service=Hello_World_Scheduler] postRegister()

      16:09:04,327 INFO  [STDOUT] postRegister()

      16:09:04,328 INFO  [TestService:service=Hello_World_Scheduler] jbossInternalStart()

      16:09:04,328 INFO  [STDOUT] jbossInternalStart()

      16:09:04,374 ERROR [Scheduler] Could not parse given date string: ${com.elrajabia.test.app.prop.initialstartdate}

      java.text.ParseException: Unparseable date: "${com.elrajabia.test.app.prop.initialstartdate}"

      at java.text.DateFormat.parse(DateFormat.java:337)

      at org.jboss.varia.scheduler.Scheduler.setInitialStartDate(Scheduler.java:993)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      at java.lang.reflect.Method.invoke(Method.java:597)

      at org.jboss.mx.interceptor.AttributeDispatcher.invoke(AttributeDispatcher.java:136)

      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)

      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)

      at org.jboss.mx.interceptor.ModelMBeanAttributeInterceptor.invoke(ModelMBeanAttributeInterceptor.java:103)

      at org.jboss.mx.interceptor.PersistenceInterceptor.invoke(PersistenceInterceptor.java:76)

      at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)

      at org.jboss.mx.server.AbstractMBeanInvoker.setAttribute(AbstractMBeanInvoker.java:461)

      at org.jboss.mx.server.MBeanServerImpl.setAttribute(MBeanServerImpl.java:617)

      at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:166)

      at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:114)

      at org.jboss.system.microcontainer.ConfigureAction.installAction(ConfigureAction.java:58)

      at org.jboss.system.microcontainer.ConfigureAction.installAction(ConfigureAction.java:42)

      at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)

      at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)

      at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)

      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)

      at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:297)

      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633)

      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935)

      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083)

      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985)

      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:823)

      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)

      at org.jboss.system.ServiceController.doChange(ServiceController.java:688)

      at org.jboss.system.ServiceController.install(ServiceController.java:274)

      at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:90)

      at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)

      at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)

      at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)

      at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)

      at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1440)

      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1158)

      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1179)

      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1211)

      at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1099)

      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)

      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633)

      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935)

      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083)

      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985)

      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:823)

      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)

      at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:782)

      at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)

      at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)

      at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)

      at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)

      at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:403)

      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)

      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633)

      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935)

      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083)

      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985)

      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:775)

      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)

      at org.jboss.system.server.profileservice.repository.AbstractProfileService.registerProfile(AbstractProfileService.java:308)

      at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:256)

      at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)

      at org.jboss.Main.boot(Main.java:221)

      at org.jboss.Main$1.run(Main.java:556)

      at java.lang.Thread.run(Thread.java:619)

       

      I was wondering if some else encounter the same issue, I appreciate the help in advance