Wildfly 12 - unable to lookup JNDI - returns Invalid URL scheme name
kabeer313 Nov 5, 2018 1:46 AMHi,
We are in the process of migrating our application from Jboss 5.1 to Wildfly 12.0. Due to the high dependency on org.jboss.system.ServiceMBeanSupport (the old package), we are still extending our services to this package by using the new JAR file wildfly-system-jmx-12.0.0.Final.jar.
We are getting some exceptions during a JNDI look-up. Can any one please point out the possible reasons?
Exception details
javax.naming.InvalidNameException: WFNAM00007: Invalid URL scheme name "java"
at util.task.AbstractReceiveTask.setup(AbstractReceiveTask.java:361)
at util.task.AbstractReceiveTask.startService(AbstractReceiveTask.java:305)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:255)
at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:162)
at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:233)
at org.jboss.system.ServiceMBeanSupport.create(ServiceMBeanSupport.java:158)
at org.jboss.system.ServiceMBeanSupport.postRegister(ServiceMBeanSupport.java:372)
at com.sun.jmx.mbeanserver.MBeanSupport.postRegister(MBeanSupport.java:182)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.postRegister(DefaultMBeanServerInterceptor.java:1024)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:974)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324)
at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
at org.jboss.as.jmx.PluggableMBeanServerImpl$TcclMBeanServer.registerMBean(PluggableMBeanServerImpl.java:1499)
at org.jboss.as.jmx.PluggableMBeanServerImpl.registerMBean(PluggableMBeanServerImpl.java:871)
at org.jboss.as.jmx.MBeanRegistrationService.start(MBeanRegistrationService.java:101)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1714)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1693)
at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1540)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.naming.InvalidNameException: WFNAM00007: Invalid URL scheme name "java"
at org.wildfly.naming.client.WildFlyRootContext.getProviderContext(WildFlyRootContext.java:808)
at org.wildfly.naming.client.WildFlyRootContext.lookup(WildFlyRootContext.java:140)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at
JNDI details passed as System properties
# DO NOT EDIT THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING
java.naming.factory.initial=org.wildfly.naming.client.WildFlyInitialContextFactory
java.naming.provider.url=remote+https://localhost:8491
java.naming.security.principal=userid
java.naming.security.credentials=password
The code snippet
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, System.getProperty("java.naming.factory.initial"));
properties.put(Context.PROVIDER_URL, System.getProperty("java.naming.provider.url"));
properties.put(Context.SECURITY_PRINCIPAL, System.getProperty("java.naming.security.principal"));
properties.put(Context.SECURITY_CREDENTIALS, System.getProperty("java.naming.security.credentials"));
InitialContext context = new InitialContext(properties);
messageSender = (MessageSender)context.lookup(senderName); //senderName v= java:/jms/test/sender/receive
Configuration in the standalone-full.xml
<subsystem xmlns="urn:jboss:domain:messaging-activemq:3.0">
<server name="default" persistence-enabled="true">
<cluster password="${jboss.messaging.cluster.password:password}"/>
<journal type="ASYNCIO" file-size="102400" min-files="2"/>
<shared-store-master/>
<security-setting name="#">
<role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
</security-setting>
<address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10"/>
<http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
<in-vm-connector name="in-vm" server-id="0"/>
<http-acceptor name="http-acceptor" http-listener="default"/>
<in-vm-acceptor name="in-vm" server-id="0"/>
<broadcast-group name="bg-group1" jgroups-cluster="activemq-cluster" connectors="http-connector"/>
<discovery-group name="dg-group1" jgroups-cluster="activemq-cluster"/>
<cluster-connection name="my-cluster" address="jms" connector-name="http-connector" discovery-group="dg-group1"/>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<jms-queue name="testQueue" entries="queue/test java:jboss/exported/jms/queue/test"/>
<jms-queue name="WSQueue1" entries="java:/jms/test/sender/null java:jboss/exported/jms/test/sender/null"/>
<jms-queue name="WSQueue" entries="java:/jms/test/sender/receive java:jboss/exported/jms/test/sender/receive"/>
<jms-topic name="WSTopic" entries="java:/jms/test/queues/receive java:jboss/exported/jms/test/queues/receive"/>
<jms-topic name="testTopic" entries="topic/test java:jboss/exported/jms/topic/test"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector"/>
<!-- <pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/> -->
</server>
<server name="backuper-server" persistence-enabled="true">
<cluster password="${jboss.messaging.cluster.password:password}"/>
<journal type="ASYNCIO" file-size="102400" min-files="2"/>
<shared-store-slave/>
<bindings-directory path="activemq-backup/bindings"/>
<journal-directory path="activemq-backup/journal"/>
<large-messages-directory path="activemq-backup/largemessages"/>
<paging-directory path="activemq-backup/paging"/>
<http-connector name="http-connector-backup" socket-binding="http" endpoint="http-acceptor-backup"/>
<http-acceptor name="http-acceptor-backup" http-listener="default"/>
<broadcast-group name="bg-group1" jgroups-cluster="activemq-cluster" connectors="http-connector-backup"/>
<discovery-group name="dg-group1" jgroups-cluster="activemq-cluster"/>
<cluster-connection name="my-cluster" address="jms" connector-name="http-connector-backup" discovery-group="dg-group1"/>
</server>