Uploaded image for project: 'Thorntail'
  1. Thorntail
  2. THORN-1175

topology-webapp missing a dependency on WF naming service: NoInitialContextException

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 2017.4.0
    • Component/s: None
    • Labels:
      None
    • Steps to Reproduce:
      Hide
      cd ~/scratch
      rm -Rf /tmp/consul
      consul agent -ui --data-dir=/tmp/consul -bind 127.0.0.1 -server -bootstrap
      git clone https://github.com/wildfly-swarm/wildfly-swarm-examples.git
      cd wildfly-swarm-examples
      git checkout 2017.3.3
      mvn clean install -DskipTests -pl base -am
      cd ribbon-consul
      mvn clean verify -Pconsul -Dswarm.consul.url=http://127.0.0.1:8500
      

      EXPECTED: the above mvn clean verify should pass
      ACTUAL:

      ...
      [INFO] --- wildfly-swarm-plugin:2017.3.3:multistart (multistart) @ example-ribbon-consul-test ---
      [INFO] Starting .jar
      Dependencies not bundled, will resolve from local M2REPO
      2017-03-12 21:37:11,612 INFO  [org.wildfly.swarm] (main) WFSWARM0018: Installed fraction:                  Logging - STABLE          org.wildfly.swarm:logging:2017.3.3
      2017-03-12 21:37:11,623 INFO  [org.wildfly.swarm] (main) WFSWARM0018: Installed fraction:         Hashicorp Consul - STABLE          org.wildfly.swarm:topology-consul:2017.3.3
      2017-03-12 21:37:11,623 INFO  [org.wildfly.swarm] (main) WFSWARM0018: Installed fraction:                 Undertow - STABLE          org.wildfly.swarm:undertow:2017.3.3
      2017-03-12 21:37:11,623 WARN  [org.wildfly.swarm] (main) WFSWARM0018: Installed fraction:              Topology UI - UNSTABLE        org.wildfly.swarm:topology-webapp:2017.3.3
      2017-03-12 21:37:12,734 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
      2017-03-12 21:37:12,777 INFO  [org.jboss.as] (MSC service thread 1-6) WFLYSRV0049: WildFly Swarm 2017.3.3 (WildFly Core 2.2.1.CR1) starting
      2017-03-12 21:37:12,827 INFO  [org.wildfly.swarm] (MSC service thread 1-6) WFSWARM0029: Install MSC service for command line args: []
      2017-03-12 21:37:13,299 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 12) WFLYNAM0001: Activating Naming Subsystem
      2017-03-12 21:37:13,306 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 9) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors
      2017-03-12 21:37:13,307 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service swarm.topology.proxy: org.jboss.msc.service.StartException in service swarm.topology.proxy: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
              at org.wildfly.swarm.topology.webapp.runtime.TopologyProxyService.start(TopologyProxyService.java:65)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
              at java.lang.Thread.run(Thread.java:745)
      Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
              at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
              at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
              at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:350)
              at javax.naming.InitialContext.lookup(InitialContext.java:417)
              at org.wildfly.swarm.topology.Topology.lookup(Topology.java:32)
              at org.wildfly.swarm.topology.webapp.runtime.TopologyProxyService.start(TopologyProxyService.java:62)
              ... 5 more
      
      2017-03-12 21:37:13,311 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0003: Undertow 1.4.0.Final starting
      2017-03-12 21:37:13,321 INFO  [org.jboss.as.naming] (MSC service thread 1-7) WFLYNAM0003: Starting Naming Service
      2017-03-12 21:37:13,331 INFO  [org.xnio] (MSC service thread 1-1) XNIO version 3.4.0.Final
      2017-03-12 21:37:13,337 INFO  [org.xnio.nio] (MSC service thread 1-1) XNIO NIO Implementation Version 3.4.0.Final
      2017-03-12 21:37:13,369 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0012: Started server default-server.
      2017-03-12 21:37:13,406 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0006: Undertow HTTP listener default listening on 0.0.0.0:8080
      2017-03-12 21:37:13,529 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: WildFly Swarm 2017.3.3 (WildFly Core 2.2.1.CR1) started (with errors) in 816ms - Started 69 of 77 services (1 services failed or missing dependencies, 14 services are lazy, passive or on-demand)
      2017-03-12 21:37:13,540 ERROR [stderr] (main) Exception in thread "main" java.lang.reflect.InvocationTargetException
      2017-03-12 21:37:13,541 ERROR [stderr] (main)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2017-03-12 21:37:13,541 ERROR [stderr] (main)   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      2017-03-12 21:37:13,541 ERROR [stderr] (main)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      2017-03-12 21:37:13,541 ERROR [stderr] (main)   at java.lang.reflect.Method.invoke(Method.java:498)
      2017-03-12 21:37:13,541 ERROR [stderr] (main)   at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:39)
      2017-03-12 21:37:13,541 ERROR [stderr] (main)   at org.wildfly.swarm.bootstrap.MainInvoker.main(MainInvoker.java:70)
      2017-03-12 21:37:13,542 ERROR [stderr] (main) Caused by: java.lang.RuntimeException: org.jboss.msc.service.StartException in service swarm.topology.proxy: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
      2017-03-12 21:37:13,542 ERROR [stderr] (main)   at org.wildfly.swarm.spi.api.ClassLoading.withTCCL(ClassLoading.java:45)
      2017-03-12 21:37:13,542 ERROR [stderr] (main)   at org.wildfly.swarm.container.runtime.ServerBootstrapImpl.bootstrap(ServerBootstrapImpl.java:109)
      2017-03-12 21:37:13,542 ERROR [stderr] (main)   at org.wildfly.swarm.Swarm.start(Swarm.java:369)
      2017-03-12 21:37:13,542 ERROR [stderr] (main)   at org.wildfly.swarm.examples.netflix.ribbon.frontend.Main.main(Main.java:13)
      2017-03-12 21:37:13,542 ERROR [stderr] (main)   ... 6 more
      2017-03-12 21:37:13,543 ERROR [stderr] (main) Caused by: org.jboss.msc.service.StartException in service swarm.topology.proxy: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
      2017-03-12 21:37:13,543 ERROR [stderr] (main)   at org.wildfly.swarm.topology.webapp.runtime.TopologyProxyService.start(TopologyProxyService.java:65)
      2017-03-12 21:37:13,543 ERROR [stderr] (main)   at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
      2017-03-12 21:37:13,543 ERROR [stderr] (main)   at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
      2017-03-12 21:37:13,543 ERROR [stderr] (main)   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      2017-03-12 21:37:13,543 ERROR [stderr] (main)   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      2017-03-12 21:37:13,543 ERROR [stderr] (main)   at java.lang.Thread.run(Thread.java:745)
      2017-03-12 21:37:13,544 ERROR [stderr] (main) Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
      2017-03-12 21:37:13,544 ERROR [stderr] (main)   at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
      2017-03-12 21:37:13,544 ERROR [stderr] (main)   at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
      2017-03-12 21:37:13,544 ERROR [stderr] (main)   at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:350)
      2017-03-12 21:37:13,544 ERROR [stderr] (main)   at javax.naming.InitialContext.lookup(InitialContext.java:417)
      2017-03-12 21:37:13,544 ERROR [stderr] (main)   at org.wildfly.swarm.topology.Topology.lookup(Topology.java:32)
      2017-03-12 21:37:13,545 ERROR [stderr] (main)   at org.wildfly.swarm.topology.webapp.runtime.TopologyProxyService.start(TopologyProxyService.java:62)
      2017-03-12 21:37:13,545 ERROR [stderr] (main)   ... 5 more
      

      Additional Info

      The issue is not reproducible in 100% of cases. Apparently, sometimes topology-webapp is lucky enough to start after Naming Subsystem was initialized. But sometimes, when Topology.lookup() is run before Naming Subsystem is there, the above exception is thrown.

      As per http://lists.jboss.org/pipermail/wildfly-dev/2015-March/003683.html , we probably need to add .addDependency(DefaultNamespaceContextSelectorService.SERVICE_NAME) in TopologyWebAppActivator

      Show
      cd ~/scratch rm -Rf /tmp/consul consul agent -ui --data-dir=/tmp/consul -bind 127.0.0.1 -server -bootstrap git clone https: //github.com/wildfly-swarm/wildfly-swarm-examples.git cd wildfly-swarm-examples git checkout 2017.3.3 mvn clean install -DskipTests -pl base -am cd ribbon-consul mvn clean verify -Pconsul -Dswarm.consul.url=http: //127.0.0.1:8500 EXPECTED: the above mvn clean verify should pass ACTUAL: ... [INFO] --- wildfly-swarm-plugin:2017.3.3:multistart (multistart) @ example-ribbon-consul-test --- [INFO] Starting .jar Dependencies not bundled, will resolve from local M2REPO 2017-03-12 21:37:11,612 INFO [org.wildfly.swarm] (main) WFSWARM0018: Installed fraction: Logging - STABLE org.wildfly.swarm:logging:2017.3.3 2017-03-12 21:37:11,623 INFO [org.wildfly.swarm] (main) WFSWARM0018: Installed fraction: Hashicorp Consul - STABLE org.wildfly.swarm:topology-consul:2017.3.3 2017-03-12 21:37:11,623 INFO [org.wildfly.swarm] (main) WFSWARM0018: Installed fraction: Undertow - STABLE org.wildfly.swarm:undertow:2017.3.3 2017-03-12 21:37:11,623 WARN [org.wildfly.swarm] (main) WFSWARM0018: Installed fraction: Topology UI - UNSTABLE org.wildfly.swarm:topology-webapp:2017.3.3 2017-03-12 21:37:12,734 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final 2017-03-12 21:37:12,777 INFO [org.jboss.as] (MSC service thread 1-6) WFLYSRV0049: WildFly Swarm 2017.3.3 (WildFly Core 2.2.1.CR1) starting 2017-03-12 21:37:12,827 INFO [org.wildfly.swarm] (MSC service thread 1-6) WFSWARM0029: Install MSC service for command line args: [] 2017-03-12 21:37:13,299 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 12) WFLYNAM0001: Activating Naming Subsystem 2017-03-12 21:37:13,306 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 9) WFLYIO001: Worker ' default ' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors 2017-03-12 21:37:13,307 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service swarm.topology.proxy: org.jboss.msc.service.StartException in service swarm.topology.proxy: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial at org.wildfly.swarm.topology.webapp.runtime.TopologyProxyService.start(TopologyProxyService.java:65) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang. Thread .run( Thread .java:745) Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313) at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:350) at javax.naming.InitialContext.lookup(InitialContext.java:417) at org.wildfly.swarm.topology.Topology.lookup(Topology.java:32) at org.wildfly.swarm.topology.webapp.runtime.TopologyProxyService.start(TopologyProxyService.java:62) ... 5 more 2017-03-12 21:37:13,311 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0003: Undertow 1.4.0.Final starting 2017-03-12 21:37:13,321 INFO [org.jboss.as.naming] (MSC service thread 1-7) WFLYNAM0003: Starting Naming Service 2017-03-12 21:37:13,331 INFO [org.xnio] (MSC service thread 1-1) XNIO version 3.4.0.Final 2017-03-12 21:37:13,337 INFO [org.xnio.nio] (MSC service thread 1-1) XNIO NIO Implementation Version 3.4.0.Final 2017-03-12 21:37:13,369 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0012: Started server default -server. 2017-03-12 21:37:13,406 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0006: Undertow HTTP listener default listening on 0.0.0.0:8080 2017-03-12 21:37:13,529 ERROR [org.jboss.as] (Controller Boot Thread ) WFLYSRV0026: WildFly Swarm 2017.3.3 (WildFly Core 2.2.1.CR1) started (with errors) in 816ms - Started 69 of 77 services (1 services failed or missing dependencies, 14 services are lazy, passive or on-demand) 2017-03-12 21:37:13,540 ERROR [stderr] (main) Exception in thread "main" java.lang.reflect.InvocationTargetException 2017-03-12 21:37:13,541 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2017-03-12 21:37:13,541 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 2017-03-12 21:37:13,541 ERROR [stderr] (main) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 2017-03-12 21:37:13,541 ERROR [stderr] (main) at java.lang.reflect.Method.invoke(Method.java:498) 2017-03-12 21:37:13,541 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:39) 2017-03-12 21:37:13,541 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.MainInvoker.main(MainInvoker.java:70) 2017-03-12 21:37:13,542 ERROR [stderr] (main) Caused by: java.lang.RuntimeException: org.jboss.msc.service.StartException in service swarm.topology.proxy: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial 2017-03-12 21:37:13,542 ERROR [stderr] (main) at org.wildfly.swarm.spi.api.ClassLoading.withTCCL(ClassLoading.java:45) 2017-03-12 21:37:13,542 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.ServerBootstrapImpl.bootstrap(ServerBootstrapImpl.java:109) 2017-03-12 21:37:13,542 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.start(Swarm.java:369) 2017-03-12 21:37:13,542 ERROR [stderr] (main) at org.wildfly.swarm.examples.netflix.ribbon.frontend.Main.main(Main.java:13) 2017-03-12 21:37:13,542 ERROR [stderr] (main) ... 6 more 2017-03-12 21:37:13,543 ERROR [stderr] (main) Caused by: org.jboss.msc.service.StartException in service swarm.topology.proxy: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial 2017-03-12 21:37:13,543 ERROR [stderr] (main) at org.wildfly.swarm.topology.webapp.runtime.TopologyProxyService.start(TopologyProxyService.java:65) 2017-03-12 21:37:13,543 ERROR [stderr] (main) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) 2017-03-12 21:37:13,543 ERROR [stderr] (main) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) 2017-03-12 21:37:13,543 ERROR [stderr] (main) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 2017-03-12 21:37:13,543 ERROR [stderr] (main) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 2017-03-12 21:37:13,543 ERROR [stderr] (main) at java.lang. Thread .run( Thread .java:745) 2017-03-12 21:37:13,544 ERROR [stderr] (main) Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial 2017-03-12 21:37:13,544 ERROR [stderr] (main) at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662) 2017-03-12 21:37:13,544 ERROR [stderr] (main) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313) 2017-03-12 21:37:13,544 ERROR [stderr] (main) at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:350) 2017-03-12 21:37:13,544 ERROR [stderr] (main) at javax.naming.InitialContext.lookup(InitialContext.java:417) 2017-03-12 21:37:13,544 ERROR [stderr] (main) at org.wildfly.swarm.topology.Topology.lookup(Topology.java:32) 2017-03-12 21:37:13,545 ERROR [stderr] (main) at org.wildfly.swarm.topology.webapp.runtime.TopologyProxyService.start(TopologyProxyService.java:62) 2017-03-12 21:37:13,545 ERROR [stderr] (main) ... 5 more Additional Info The issue is not reproducible in 100% of cases. Apparently, sometimes topology-webapp is lucky enough to start after Naming Subsystem was initialized. But sometimes, when Topology.lookup() is run before Naming Subsystem is there, the above exception is thrown. As per http://lists.jboss.org/pipermail/wildfly-dev/2015-March/003683.html , we probably need to add .addDependency(DefaultNamespaceContextSelectorService.SERVICE_NAME) in TopologyWebAppActivator

      Gliffy Diagrams

        Attachments

          Activity

            People

            • Assignee:
              ppalaga Peter Palaga
              Reporter:
              ppalaga Peter Palaga
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: