You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by ehsanshah <ze...@yahoo.com> on 2016/08/06 12:51:32 UTC

Problem Writing java based JMS Client for WildFly10

Hi All :

the HornetQ codebase was donated to the Apache ActiveMQ project, and the
HornetQ community joined to build a next-generation messaging broker. This
materialized in the first major release of the ActiveMQ Artemis project.
ActiveMQ Artemis includes many new features, and also retains protocol
compatibility with the HornetQ broker. WildFly 10 includes this new exciting
project as its JMS broker, and due to the protocol compatibility, it fully
replaces the HornetQ project

I writing java based JMS Client for WildFly10 and I had problem


Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jboss.naming.remote.client.InitialContextFactory");
props.put(Context.PROVIDER_URL, WILDFLY_REMOTING_URL);   // NOTICE:
"http-remoting" and port "8080"
props.put(Context.SECURITY_PRINCIPAL, JMS_USERNAME);
props.put(Context.SECURITY_CREDENTIALS, JMS_PASSWORD);
//props.put("jboss.naming.client.ejb.context", true);
context = new InitialContext(props);

*i run your client code and i got this error:*

Got initial Context: javax.naming.InitialContext@5442a311
Exception in thread “main”
org.jboss.naming.remote.protocol.NamingIOException: Failed to lookup [Root
exception is java.io.IOException: java.lang.ClassNotFoundException:
org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory]
at
org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:49)
at org.jboss.naming.remote.protocol.v1.Protocol$1.execute(Protocol.java:104)
at
org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1.lookup(RemoteNamingStoreV1.java:95)
at
org.jboss.naming.remote.client.HaRemoteNamingStore$1.operation(HaRemoteNamingStore.java:276)
at
org.jboss.naming.remote.client.HaRemoteNamingStore.namingOperation(HaRemoteNamingStore.java:137)
at
org.jboss.naming.remote.client.HaRemoteNamingStore.lookup(HaRemoteNamingStore.java:272)
at
org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:87)
at
org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:129)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at
com.almasprocess.model.bl.WildFlyJmsQueueSender.init(WildFlyJmsQueueSender.java:49)
at
com.almasprocess.model.bl.WildFlyJmsQueueSender.main(WildFlyJmsQueueSender.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: java.io.IOException: java.lang.ClassNotFoundException:
org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory
at org.jboss.naming.remote.protocol.v1.Protocol$1$3.read(Protocol.java:159)
at org.jboss.naming.remote.protocol.v1.Protocol$1$3.read(Protocol.java:149)
at
org.jboss.naming.remote.protocol.v1.BaseProtocolCommand.readResult(BaseProtocolCommand.java:59)
at
org.jboss.naming.remote.protocol.v1.Protocol$1.handleClientMessage(Protocol.java:149)
at
org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1$MessageReceiver$1.run(RemoteNamingStoreV1.java:232)
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: java.lang.ClassNotFoundException:
org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:340)
at
org.jboss.marshalling.AbstractClassResolver.loadClass(AbstractClassResolver.java:131)
at
org.jboss.marshalling.AbstractClassResolver.resolveClass(AbstractClassResolver.java:112)
at
org.jboss.marshalling.river.RiverUnmarshaller.doReadClassDescriptor(RiverUnmarshaller.java:1002)
at
org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1256)
at
org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276)
at
org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
at
org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:41)
at org.jboss.naming.remote.protocol.v1.Protocol$1$3.read(Protocol.java:156)
… 7 more
Process finished with exit code 1

And I changed code like this and add  activemq lib:

Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
props.put(Context.PROVIDER_URL, WILDFLY_REMOTING_URL);   // NOTICE:
"http-remoting" and port "8080"
props.put(Context.SECURITY_PRINCIPAL, JMS_USERNAME);
props.put(Context.SECURITY_CREDENTIALS, JMS_PASSWORD);

 Got initial Context: javax.naming.InitialContext@6842775d
Exception in thread "main" javax.naming.NameNotFoundException:
jms/RemoteConnectionFactory
 at
org.apache.activemq.jndi.ReadOnlyContext.lookup(ReadOnlyContext.java:225)
 at javax.naming.InitialContext.lookup(InitialContext.java:417)
 at
com.almasprocess.model.bl.WildFlyJmsQueueSender.init(WildFlyJmsQueueSender.java:49)
 at
com.almasprocess.model.bl.WildFlyJmsQueueSender.main(WildFlyJmsQueueSender.java:43)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:483)
 at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

and standalone-full like this :

<subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0">
            <server name="default">
                <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"/>
                <http-connector name="http-connector-throughput"
socket-binding="http" endpoint="http-acceptor-throughput">
                    
                </http-connector>
                <in-vm-connector name="in-vm" server-id="0"/>
                <http-acceptor name="http-acceptor"
http-listener="default"/>
                <http-acceptor name="http-acceptor-throughput"
http-listener="default">
                    
                    
                </http-acceptor>
                <in-vm-acceptor name="in-vm" server-id="0"/>
                <jms-queue name="ExpiryQueue"
entries="java:/jms/queue/ExpiryQueue"/>
                <jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
                <jms-queue name="clickQueue"
entries="java:/jms/queue/clickQueue
java:/jboss/exported/jms/queue/clickQueue"/>
                <jms-queue name="emailQueue"
entries="java:/jms/queue/EmailQueue
java:/jboss/exported/jms/queue/EmailQueue"/>
                <jms-queue name="emailSendQueue"
entries="java:/jboss/exported/jms/queue/EmailSendQueue"/>
                <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>
        </subsystem>


can you help me about error???

thanks.






--
View this message in context: http://activemq.2283324.n4.nabble.com/Problem-Writing-java-based-JMS-Client-for-WildFly10-tp4715106.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Re: Problem Writing java based JMS Client for WildFly10

Posted by Justin Bertram <jb...@apache.com>.
Check out the answer(s) to your question on the Wildfly forum [1] where you posted this question on Saturday.


Justin

[1] https://developer.jboss.org/message/961215

----- Original Message -----
From: "ehsanshah" <ze...@yahoo.com>
To: dev@activemq.apache.org
Sent: Saturday, August 6, 2016 7:51:32 AM
Subject: Problem Writing java based JMS Client for WildFly10

Hi All :

the HornetQ codebase was donated to the Apache ActiveMQ project, and the
HornetQ community joined to build a next-generation messaging broker. This
materialized in the first major release of the ActiveMQ Artemis project.
ActiveMQ Artemis includes many new features, and also retains protocol
compatibility with the HornetQ broker. WildFly 10 includes this new exciting
project as its JMS broker, and due to the protocol compatibility, it fully
replaces the HornetQ project

I writing java based JMS Client for WildFly10 and I had problem


Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jboss.naming.remote.client.InitialContextFactory");
props.put(Context.PROVIDER_URL, WILDFLY_REMOTING_URL);   // NOTICE:
"http-remoting" and port "8080"
props.put(Context.SECURITY_PRINCIPAL, JMS_USERNAME);
props.put(Context.SECURITY_CREDENTIALS, JMS_PASSWORD);
//props.put("jboss.naming.client.ejb.context", true);
context = new InitialContext(props);

*i run your client code and i got this error:*

Got initial Context: javax.naming.InitialContext@5442a311
Exception in thread “main”
org.jboss.naming.remote.protocol.NamingIOException: Failed to lookup [Root
exception is java.io.IOException: java.lang.ClassNotFoundException:
org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory]
at
org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:49)
at org.jboss.naming.remote.protocol.v1.Protocol$1.execute(Protocol.java:104)
at
org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1.lookup(RemoteNamingStoreV1.java:95)
at
org.jboss.naming.remote.client.HaRemoteNamingStore$1.operation(HaRemoteNamingStore.java:276)
at
org.jboss.naming.remote.client.HaRemoteNamingStore.namingOperation(HaRemoteNamingStore.java:137)
at
org.jboss.naming.remote.client.HaRemoteNamingStore.lookup(HaRemoteNamingStore.java:272)
at
org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:87)
at
org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:129)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at
com.almasprocess.model.bl.WildFlyJmsQueueSender.init(WildFlyJmsQueueSender.java:49)
at
com.almasprocess.model.bl.WildFlyJmsQueueSender.main(WildFlyJmsQueueSender.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: java.io.IOException: java.lang.ClassNotFoundException:
org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory
at org.jboss.naming.remote.protocol.v1.Protocol$1$3.read(Protocol.java:159)
at org.jboss.naming.remote.protocol.v1.Protocol$1$3.read(Protocol.java:149)
at
org.jboss.naming.remote.protocol.v1.BaseProtocolCommand.readResult(BaseProtocolCommand.java:59)
at
org.jboss.naming.remote.protocol.v1.Protocol$1.handleClientMessage(Protocol.java:149)
at
org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1$MessageReceiver$1.run(RemoteNamingStoreV1.java:232)
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: java.lang.ClassNotFoundException:
org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:340)
at
org.jboss.marshalling.AbstractClassResolver.loadClass(AbstractClassResolver.java:131)
at
org.jboss.marshalling.AbstractClassResolver.resolveClass(AbstractClassResolver.java:112)
at
org.jboss.marshalling.river.RiverUnmarshaller.doReadClassDescriptor(RiverUnmarshaller.java:1002)
at
org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1256)
at
org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276)
at
org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
at
org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:41)
at org.jboss.naming.remote.protocol.v1.Protocol$1$3.read(Protocol.java:156)
… 7 more
Process finished with exit code 1

And I changed code like this and add  activemq lib:

Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
props.put(Context.PROVIDER_URL, WILDFLY_REMOTING_URL);   // NOTICE:
"http-remoting" and port "8080"
props.put(Context.SECURITY_PRINCIPAL, JMS_USERNAME);
props.put(Context.SECURITY_CREDENTIALS, JMS_PASSWORD);

 Got initial Context: javax.naming.InitialContext@6842775d
Exception in thread "main" javax.naming.NameNotFoundException:
jms/RemoteConnectionFactory
 at
org.apache.activemq.jndi.ReadOnlyContext.lookup(ReadOnlyContext.java:225)
 at javax.naming.InitialContext.lookup(InitialContext.java:417)
 at
com.almasprocess.model.bl.WildFlyJmsQueueSender.init(WildFlyJmsQueueSender.java:49)
 at
com.almasprocess.model.bl.WildFlyJmsQueueSender.main(WildFlyJmsQueueSender.java:43)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:483)
 at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

and standalone-full like this :

<subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0">
            <server name="default">
                <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"/>
                <http-connector name="http-connector-throughput"
socket-binding="http" endpoint="http-acceptor-throughput">
                    
                </http-connector>
                <in-vm-connector name="in-vm" server-id="0"/>
                <http-acceptor name="http-acceptor"
http-listener="default"/>
                <http-acceptor name="http-acceptor-throughput"
http-listener="default">
                    
                    
                </http-acceptor>
                <in-vm-acceptor name="in-vm" server-id="0"/>
                <jms-queue name="ExpiryQueue"
entries="java:/jms/queue/ExpiryQueue"/>
                <jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
                <jms-queue name="clickQueue"
entries="java:/jms/queue/clickQueue
java:/jboss/exported/jms/queue/clickQueue"/>
                <jms-queue name="emailQueue"
entries="java:/jms/queue/EmailQueue
java:/jboss/exported/jms/queue/EmailQueue"/>
                <jms-queue name="emailSendQueue"
entries="java:/jboss/exported/jms/queue/EmailSendQueue"/>
                <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>
        </subsystem>


can you help me about error???

thanks.






--
View this message in context: http://activemq.2283324.n4.nabble.com/Problem-Writing-java-based-JMS-Client-for-WildFly10-tp4715106.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.