1 Reply Latest reply on Apr 12, 2019 8:43 AM by mayerw01

    Get WildFly version at runtime

    niclasbuerger

      Hi,

       

      im trying to get the WildFly Version at runtime.

      This is my current code:

       

      ModelControllerClient client = ModelControllerClient.Factory.create( InetAddress.getByName( "localhost" ), 9990 );

      ModelNode modelNode = new ModelNode();
      modelNode.get( ClientConstants.OP ).set( "read-resource" );
      ModelNode returnValue = client.execute( modelNode );
      wildflyVersion = returnValue.get( "result" ).get( "release-version" ).asString();

      System.out.println("wildflyVersion");

       

      But this dosent work:

       

      java.io.IOException: java.net.ConnectException: JBAS012144: Could not connect to remote://localhost:9990. The connection timed out

      12:42:36,516 ERROR [stderr] (ServerService Thread Pool -- 27) at deployment.project.war//org.jboss.as.controller.client.impl.AbstractModelControllerClient.executeForResult(AbstractModelControllerClient.java:129)

      12:42:36,516 ERROR [stderr] (ServerService Thread Pool -- 27) at deployment.project.war//org.jboss.as.controller.client.impl.AbstractModelControllerClient.execute(AbstractModelControllerClient.java:71)

      12:42:36,517 ERROR [stderr] (ServerService Thread Pool -- 27) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      12:42:36,518 ERROR [stderr] (ServerService Thread Pool -- 27) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

      12:42:36,518 ERROR [stderr] (ServerService Thread Pool -- 27) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      12:42:36,519 ERROR [stderr] (ServerService Thread Pool -- 27) at java.base/java.lang.reflect.Method.invoke(Method.java:564)

      12:42:36,519 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.as.ee@14.0.1.Final//org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptor.java:96)

      12:42:36,519 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.invocation@1.5.1.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)

      12:42:36,520 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.as.weld.common@14.0.1.Final//org.jboss.as.weld.interceptors.Jsr299BindingsInterceptor.doLifecycleInterception(Jsr299BindingsInterceptor.java:122)

      12:42:36,520 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.as.weld.common@14.0.1.Final//org.jboss.as.weld.interceptors.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:111)

      12:42:36,521 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.invocation@1.5.1.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)

      12:42:36,521 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.invocation@1.5.1.Final//org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:509)

      12:42:36,522 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.weld.core@3.0.5.Final//org.jboss.weld.module.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:81)

      12:42:36,522 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.as.weld.common@14.0.1.Final//org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:89)

      12:42:36,523 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.invocation@1.5.1.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)

      12:42:36,524 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.as.weld@14.0.1.Final//org.jboss.as.weld.injection.WeldInjectionInterceptor.processInvocation(WeldInjectionInterceptor.java:53)

      12:42:36,524 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.invocation@1.5.1.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)

      12:42:36,525 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.as.ee@14.0.1.Final//org.jboss.as.ee.component.AroundConstructInterceptorFactory$1.processInvocation(AroundConstructInterceptorFactory.java:28)

      12:42:36,525 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.invocation@1.5.1.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)

      12:42:36,526 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.as.weld@14.0.1.Final//org.jboss.as.weld.injection.WeldInterceptorInjectionInterceptor.processInvocation(WeldInterceptorInjectionInterceptor.java:56)

      12:42:36,526 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.invocation@1.5.1.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)

      12:42:36,526 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.as.weld@14.0.1.Final//org.jboss.as.weld.interceptors.Jsr299BindingsCreateInterceptor.processInvocation(Jsr299BindingsCreateInterceptor.java:105)

      12:42:36,527 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.invocation@1.5.1.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)

      12:42:36,527 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.as.ee@14.0.1.Final//org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)

      12:42:36,527 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.invocation@1.5.1.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)

      12:42:36,528 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.as.ejb3@14.0.1.Final//org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:237)

      12:42:36,528 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.as.ejb3@14.0.1.Final//org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:388)

      12:42:36,528 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.as.ejb3@14.0.1.Final//org.jboss.as.ejb3.tx.LifecycleCMTTxInterceptor.processInvocation(LifecycleCMTTxInterceptor.java:68)

      12:42:36,528 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.invocation@1.5.1.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)

      12:42:36,529 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.as.weld@14.0.1.Final//org.jboss.as.weld.injection.WeldInjectionContextInterceptor.processInvocation(WeldInjectionContextInterceptor.java:43)

      12:42:36,529 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.invocation@1.5.1.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)

      12:42:36,529 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.as.ejb3@14.0.1.Final//org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)

      12:42:36,530 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.invocation@1.5.1.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)

      12:42:36,530 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.as.ee@14.0.1.Final//org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)

      12:42:36,531 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.invocation@1.5.1.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)

      12:42:36,531 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.invocation@1.5.1.Final//org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:60)

      12:42:36,531 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.invocation@1.5.1.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)

      12:42:36,531 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.as.ejb3@14.0.1.Final//org.jboss.as.ejb3.component.singleton.StartupCountDownInterceptor.processInvocation(StartupCountDownInterceptor.java:25)

      12:42:36,532 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.invocation@1.5.1.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)

      12:42:36,532 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.invocation@1.5.1.Final//org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:53)

      12:42:36,533 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.as.ee@14.0.1.Final//org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161)

      12:42:36,533 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.as.ee@14.0.1.Final//org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:134)

      12:42:36,534 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.as.ee@14.0.1.Final//org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:88)

      12:42:36,534 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.as.ejb3@14.0.1.Final//org.jboss.as.ejb3.component.singleton.SingletonComponent.getComponentInstance(SingletonComponent.java:127)

      12:42:36,535 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.as.ejb3@14.0.1.Final//org.jboss.as.ejb3.component.singleton.SingletonComponent.start(SingletonComponent.java:141)

      12:42:36,535 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.as.ee@14.0.1.Final//org.jboss.as.ee.component.ComponentStartService$1.run(ComponentStartService.java:54)

      12:42:36,535 ERROR [stderr] (ServerService Thread Pool -- 27) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)

      12:42:36,536 ERROR [stderr] (ServerService Thread Pool -- 27) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)

      12:42:36,536 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.threads@2.3.2.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)

      12:42:36,536 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.threads@2.3.2.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)

      12:42:36,536 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.threads@2.3.2.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)

      12:42:36,537 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.threads@2.3.2.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)

      12:42:36,537 ERROR [stderr] (ServerService Thread Pool -- 27) at java.base/java.lang.Thread.run(Thread.java:844)

      12:42:36,538 ERROR [stderr] (ServerService Thread Pool -- 27) at org.jboss.threads@2.3.2.Final//org.jboss.threads.JBossThread.run(JBossThread.java:485)

       

      Does anyone know this issue and can help my ?

       

      Greetings

        • 1. Re: Get WildFly version at runtime
          mayerw01

          I guess the easiest approach would be via cli scripting like:

           

               CLI cli = CLI.newInstance();

               cli.connect(protocol , host, port, user, password.toCharArray());

               Result result = null;

               ModelNode response = null;

               result = cli.cmd(":product-info");

               response = result.getResponse();

               List<ModelNode> sumary = response.asList();

                  .......