avoid including jms-client library in WebApplication Deployed in JBoss / Wildfly
lauradp Feb 3, 2017 2:38 PMHello everybody,
I read that jboss-client.jar library available with jboss and wildfly distribution jar should be used with standalone clients only, not with deployments are that deployed to an ASx instance (see your AS_HOME/bin/client/README-EJB-JMS.txt) and I agree it should not be used.
I'm trying to deploy a Web application (WAR) under a Wildfly 10.0 instance, but when I try to lookUp a queue I get the exception reported below.
To write my code I started from this example: Writing java based JMS Client for WildFly10 default ActiveMQ Artemis broker. « JBoss
Is there any example of jms queue lookup without using jboss-cleint library?
ModuleClassLoader for Module "deployment.myApp.war:main" from Service Module Loader [Root exception is java.lang.ClassNotFoundException: org.jboss.naming.remote.client.InitialContextFactory from [Module "deployment.myApp.war:main" from Service Module Loader]]
at org.jboss.as.naming.InitialContext.getDefaultInitCtx(InitialContext.java:118)
at org.jboss.as.naming.InitialContext.init(InitialContext.java:99)
at javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:154)
at org.jboss.as.naming.InitialContext.<init>(InitialContext.java:89)
at org.jboss.as.naming.InitialContextFactory.getInitialContext(InitialContextFactory.java:43)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
at javax.naming.InitialContext.init(InitialContext.java:244)
at javax.naming.InitialContext.<init>(InitialContext.java:216)
at com.custom.myApp.applicationLayer.jms.BpmLaunchersArtemisJmsConsumersManager.getInitialContext(BpmLaunchersArtemisJmsConsumersManager.java:164)
at com.custom.myApp.applicationLayer.jms.BpmLaunchersArtemisJmsConsumersManager.getJmsSession(BpmLaunchersArtemisJmsConsumersManager.java:142)
at com.custom.myApp.applicationLayer.jms.BpmLaunchersArtemisJmsConsumersManager.setupJmsConsumers(BpmLaunchersArtemisJmsConsumersManager.java:178)
at com.custom.myApp.applicationLayer.jms.BpmLaunchersArtemisJmsConsumersManager.<init>(BpmLaunchersArtemisJmsConsumersManager.java:114)
at com.custom.myApp.applicationLayer.jms.BpmLaunchersArtemisJmsConsumersManager.getInstance(BpmLaunchersArtemisJmsConsumersManager.java:65)
at com.custom.myApp.applicationLayer.servlet.StartupServlet.init(StartupServlet.java:171)
at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)
at org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)
at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103)
at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:231)
at io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:132)
at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:526)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:101)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: java.lang.ClassNotFoundException: org.jboss.naming.remote.client.InitialContextFactory from [Module "deployment.myApp.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.jboss.as.naming.InitialContext.getDefaultInitCtx(InitialContext.java:113)
... 28 more
Thanks in advance,
Laura