0 Replies Latest reply on Dec 5, 2012 4:26 AM by sourcedev

    Datasource vs Application Deployment Order

    sourcedev

      Hi,

       

      I have defined a simple datasource in my standalone.xml and I have another simple service (a sar implementing a ServiceActivator) that uses that datasource.  Frequently when I start the server, the sar is deployed before the server's datasources so I get a javax.naming.NameNotFoundException immediately followed by the datasource being created and bound.

       

      09:16:33,908 ERROR [simpletest.SimpleJDBCServiceActivator] (MSC service thread 1-4) Failed to lookup DatasourceIM: javax.naming.NameNotFoundException: Error looking up datasource/DatasourceIM, service service jboss.naming.context.java.datasource.DatasourceIM is not started

          at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:126)

          at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:74)

          at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:178)

          at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:119)

          at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:214)

          at javax.naming.InitialContext.lookup(InitialContext.java:392) [rt.jar:1.6.0_31]

          at simpletest.SimpleJDBCServiceActivator.activate(SimpleJDBCServiceActivator.java:21)

          at org.jboss.as.server.deployment.service.ServiceActivatorProcessor.deploy(ServiceActivatorProcessor.java:62) [jboss-as-server-7.1.2.Final-redhat-1.jar:7.1.2.Final-redhat-1]

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:116) [jboss-as-server-7.1.2.Final-redhat-1.jar:7.1.2.Final-redhat-1]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1]

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_31]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_31]

          at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_31]

       

      09:16:33,939 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) JBAS010400: Bound data source [java:/datasource/DatasourceIM]

       

      I was hoping that JBoss might bootstrap all its services and extensions before deploying my applications but clearly it does not by default.  How do I prevent this happening?  Perhaps place a dependency in my sar's jboss-deployment-structure.xml - but on what?

       

      Thanks,

       

      Alex