3 Replies Latest reply on Oct 9, 2017 5:23 PM by alessandromoscatelli

    Is there way to ensure that one subsystem is fully initialized before another one?

    atchijov-vgw

      I m trying to use JDBC_PING protocol in jgroups on WF10.0.  I use datasource_jndi_name property to refer to our of data sources configured in my standalone.xml file.  It works most of the time... but some times I get exception like this:

       

      2016-08-03 11:51:30,091 ERROR U() [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.jgroups.channel.ee: org.jboss.msc.service.StartException in service jboss.jgroups.channel.ee: java.lang.IllegalArgumentException: Could not lookup datasource java:/jdbc/acmeDS
          at org.wildfly.clustering.jgroups.spi.service.ChannelBuilder.start(ChannelBuilder.java:80)
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.6.Final.jar:1.2.6.Final]
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.6.Final.jar:1.2.6.Final]
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_92]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_92]
          at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_92]
      Caused by: java.lang.IllegalArgumentException: Could not lookup datasource java:/jdbc/acmeDS
          at org.jgroups.protocols.JDBC_PING.getDataSourceFromJNDI(JDBC_PING.java:436)
          at org.jgroups.protocols.JDBC_PING.init(JDBC_PING.java:129)
          at org.jgroups.stack.ProtocolStack.initProtocolStack(ProtocolStack.java:860)
          at org.jgroups.stack.ProtocolStack.setup(ProtocolStack.java:481)
          at org.jgroups.JChannel.init(JChannel.java:853)
          at org.jgroups.JChannel.<init>(JChannel.java:159)
          at org.jboss.as.clustering.jgroups.JChannelFactory$1.run(JChannelFactory.java:95)
          at org.jboss.as.clustering.jgroups.JChannelFactory$1.run(JChannelFactory.java:92)
          at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:636) [wildfly-elytron-1.0.2.Final.jar:1.0.2.Final]
          at org.jboss.as.clustering.jgroups.JChannelFactory.createChannel(JChannelFactory.java:98)
          at org.wildfly.clustering.jgroups.spi.service.ChannelBuilder.start(ChannelBuilder.java:78)
          ... 5 more
      Caused by: javax.naming.NameNotFoundException: jdbc/acmeDS [Root exception is java.lang.IllegalStateException]
          at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:153)
          at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:83)
          at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:207)
          at org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:235)
          at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:193)
          at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:189)
          at javax.naming.InitialContext.lookup(InitialContext.java:417) [rt.jar:1.8.0_92]
          at javax.naming.InitialContext.lookup(InitialContext.java:417) [rt.jar:1.8.0_92]
          at org.jgroups.protocols.JDBC_PING.getDataSourceFromJNDI(JDBC_PING.java:423)
          ... 15 more
      Caused by: java.lang.IllegalStateException
          at org.jboss.msc.value.InjectedValue.getValue(InjectedValue.java:47) [jboss-msc-1.2.6.Final.jar:1.2.6.Final]
          at org.jboss.as.naming.service.BinderService.getValue(BinderService.java:138)
          at org.jboss.as.naming.service.BinderService.getValue(BinderService.java:46)
          at org.jboss.msc.service.ServiceControllerImpl.getValue(ServiceControllerImpl.java:1158) [jboss-msc-1.2.6.Final.jar:1.2.6.Final]
          at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:131)
          ... 23 more
      
      

       

      I could be wrong... but the way I interpret this - my data source have not been fully initialized before JGroup's JDBC_PING protocol tried to use it.

       

      Am I correct in my diagnosis? How can I address this issue?

       

      Your help would be highly appreciated,

       

           Cheers, Andrei