HornetQ - JBAS011843: Failed instantiate InitialContextFactory org.jboss.nam ing.remote.client.InitialContextFactory in JBoss EAP 6
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.x
Issue
We are seeing this warning :
14:45:49,899 WARN [org.hornetq.ra] (default-threads - 1) HQ152005: Failure in HornetQ activation org.hornetq.ra.inflow.HornetQActivationSpec(ra=org.hornetq.ra.HornetQResourceAdapter@1f575ec destination=java:/jms/queue/remoteTestQueue destinationType=javax.jms.Queue ack=Auto-acknowledge durable=false clientID=null user=applicationUser password=**** maxSession=15): javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory org.jboss.nam ing.remote.client.InitialContextFactory from classloader ModuleClassLoader for Module "org.hornetq.ra:main" from local module loader @136a1a1 (finder: local module finder @1ad6b4b (roots: C:\jboss-eap-6.1\modules,C:\jboss-eap-6.1\modules\system\layers\base))
at org.jboss.as.naming.InitialContextFactoryBuilder.createInitialContextFactory(InitialContextFactoryBuilder.java:64)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:664) [rt.jar:1.6.0_10]
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288) [rt.jar:1.6.0_10]
at javax.naming.InitialContext.init(InitialContext.java:223) [rt.jar:1.6.0_10]
at javax.naming.InitialContext.<init>(InitialContext.java:175) [rt.jar:1.6.0_10]
at org.hornetq.ra.inflow.HornetQActivation.setupDestination(HornetQActivation.java:494) [hornetq-ra-2.3.1.Final-redhat-1.jar:2.3.1.Final-redhat-1]
at org.hornetq.ra.inflow.HornetQActivation.setup(HornetQActivation.java:305) [hornetq-ra-2.3.1.Final-redhat-1.jar:2.3.1.Final-redhat-1]
at org.hornetq.ra.inflow.HornetQActivation$SetupActivation.run(HornetQActivation.java:702) [hornetq-ra-2.3.1.Final-redhat-1.jar:2.3.1.Final-redhat-1]
at org.jboss.jca.core.workmanager.WorkWrapper.run(WorkWrapper.java:218)
at org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:33)
at org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:806)
at org.jboss.threads.QueueExecutor.access$100(QueueExecutor.java:45)
at org.jboss.threads.QueueExecutor$Worker.run(QueueExecutor.java:826)
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_10]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
We have set these system properties in your JBoss profile xml :
<system-properties>
<property name="java.naming.factory.initial" value="org.jboss.nam ing.remote.client.InitialContextFactory"/>
<property name="java.naming.provider.url" value="remote://myremoteserver:4447"/>
<property name="java.naming.security.principal" value="remoteServer"/>
<property name="java.naming.security.credentials" value="remoteServerPassword1!"/>
</system-properties>
Resolution
Remove these properties as these are global and should not be hard coded. If you have a client that needs to setup InitialContext to call a different server, you should use pass these properties in via a Properties or Hashtable via new InitialContext(properties)
<property name="java.naming.provider.url" value="remote://myremoteserver:4447"/>
<property name="java.naming.security.principal" value="remoteServer"/>
<property name="java.naming.security.credentials" value="remoteServerPassword1!"/>
<property name="java.naming.factory.initial" value="org.jboss.nam ing.remote.client.InitialContextFactory"/>
Related Solutions:
Root Cause
Hard coding the InitialContext properties which should not be done globally, and specifying an invalid value (a space in this case)
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
