This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes JMS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JMS" Watch "JMS" New topic
Author

JMS

Deva Devan
Ranch Hand

Joined: Sep 22, 2010
Posts: 39
How can i publish message to a queue and receving from that queue without using app server?
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
By running a standalone JMS server like OpenJMS, OpenMQ or ActiveMQ.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9927
    
158

And now, even HornetQ

[My Blog] [JavaRanch Journal]
Deva Devan
Ranch Hand

Joined: Sep 22, 2010
Posts: 39
Hi,

When i am going to start hornetq server with jndi configuration, the following error will come.

--------------------------------------------------------------------------------------------------
javax.naming.CommunicationException [Root exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: No ClassLoaders found for: org.hornetq.jms.referenceable.SerializableObjectRefAddr (no security manager: RMI class loader disabled)]
at org.jnp.interfaces.NamingContext.rebind(NamingContext.java:602)
at org.jnp.interfaces.NamingContext.rebind(NamingContext.java:540)
at org.hornetq.jms.server.impl.JMSServerManagerImpl.bindToJndi(JMSServerManagerImpl.java:740)
at org.hornetq.jms.server.impl.JMSServerManagerImpl.createQueue(JMSServerManagerImpl.java:276)
at org.hornetq.jms.server.impl.JMSServerDeployer.createAndBindObject(JMSServerDeployer.java:402)
at org.hornetq.jms.server.impl.JMSServerDeployer.deploy(JMSServerDeployer.java:107)
at org.hornetq.core.deployers.impl.XmlDeployer.deploy(XmlDeployer.java:181)
at org.hornetq.core.deployers.impl.FileDeploymentManager.registerDeployer(FileDeploymentManager.java:131)
at org.hornetq.core.deployers.impl.XmlDeployer.start(XmlDeployer.java:210)
at org.hornetq.jms.server.impl.JMSServerManagerImpl.activated(JMSServerManagerImpl.java:146)
at org.hornetq.core.server.impl.HornetQServerImpl.callActivateCallbacks(HornetQServerImpl.java:936)
at org.hornetq.core.server.impl.HornetQServerImpl.initialisePart2(HornetQServerImpl.java:1133)
at org.hornetq.core.server.impl.HornetQServerImpl.start(HornetQServerImpl.java:301)
at org.hornetq.jms.server.impl.JMSServerManagerImpl.start(JMSServerManagerImpl.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:241)
at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:70)
at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBean(AbstractKernelDeployer.java:319)
at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBeans(AbstractKernelDeployer.java:297)
at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deploy(AbstractKernelDeployer.java:130)
at org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer.deploy(BeanXMLDeployer.java:96)
at org.hornetq.integration.bootstrap.HornetQBootstrapServer.deploy(HornetQBootstrapServer.java:237)
at org.hornetq.integration.bootstrap.HornetQBootstrapServer.deploy(HornetQBootstrapServer.java:207)
at org.hornetq.integration.bootstrap.HornetQBootstrapServer.bootstrap(HornetQBootstrapServer.java:156)
at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.run(AbstractBootstrap.java:83)
at org.hornetq.integration.bootstrap.HornetQBootstrapServer.run(HornetQBootstrapServer.java:117)
at org.hornetq.integration.bootstrap.HornetQBootstrapServer.main(HornetQBootstrapServer.java:73)
----------------------------------------------------------------------------------------------------------------------------------

Please let me know the reason for this error..


Thanks,

Bharathi..
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9927
    
158

Which version did you download and how did you start the HornetQ server? And did you do any changes?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9927
    
158

"Bharathi India"

Please check your private messages for a message from JavaRanch.
Deva Devan
Ranch Hand

Joined: Sep 22, 2010
Posts: 39
Hi,
I have download HornetQ-2.0.0 GA

And Changed /hornetq-2.0.0.GA/config/stand-alone/non-clustered/hornetq-configuration.xml file

<connectors>
<connector name="netty">
<factory-class>org.hornetq.integration.transports.netty.NettyConnectorFactory</factory-class>
<param key="host" value="10.2.1.12"/>
<param key="port" value="${hornetq.remoting.netty.port:5445}"/>
</connector>
</connectors>

<acceptors>
<acceptor name="netty">
<factory-class>org.hornetq.integration.transports.netty.NettyAcceptorFactory</factory-class>
<param key="host" value="10.2.1.12"/>
<param key="port" value="${hornetq.remoting.netty.port:5445}"/>
</acceptor>
</acceptors>


------------------
/hornetq-2.0.0.GA/config/stand-alone/non-clustered/jndi.properties

java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.namingrg.jnp.interfaces
java.naming.provider.url=jnp://10.2.1.12:1099



/hornetq-2.0.0.GA/bin/sh run.sh

[root@DEV-01-GW-01-12 bin]# sh run.sh
***********************************************************************************
java -Djnp.port=1099 -Djnp.host=localhost -Dhornetq.remoting.netty.host=localhost -Dhornetq.remoting.netty.port=5445 -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Dhornetq.config.dir=../config/stand-alone/non-clustered -Djava.util.logging.config.file=../config/stand-alone/non-clustered/logging.properties -Djava.library.path=. -classpath ../lib/netty.jar:../lib/jnpserver.jar:../lib/jnp-client.jar:../lib/jboss-mc.jar:../lib/jboss-jms-api.jar:../lib/hornetq-transports.jar:../lib/hornetq-logging.jar:../lib/hornetq-jms.jar:../lib/hornetq-jms-client.jar:../lib/hornetq-jboss-as-integration.jar:../lib/hornetq-core.jar:../lib/hornetq-bootstrap.jar:../config/stand-alone/non-clustered:../schemas/ org.hornetq.integration.bootstrap.HornetQBootstrapServer hornetq-beans.xml
***********************************************************************************
[main] 10:28:47,399 INFO [org.hornetq.integration.bootstrap.HornetQBootstrapServer] Starting HornetQ Server
[main] 10:28:48,765 INFO [org.hornetq.core.server.impl.HornetQServerImpl] live server is starting..
[main] 10:28:48,811 INFO [org.hornetq.core.persistence.impl.journal.JournalStorageManager] Using AIO Journal
[main] 10:28:48,829 WARNING [org.hornetq.core.server.impl.HornetQServerImpl] Security risk! It has been detected that the cluster admin user and password have not been changed from the installation default. Please see the HornetQ user guide, cluster chapter, for instructions on how to do this.
[main] 10:28:49,710 SEVERE [org.hornetq.core.deployers.impl.XmlDeployer] Unable to deploy node [queue: null] MessageQueue
javax.naming.CommunicationException [Root exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: No ClassLoaders found for: org.hornetq.jms.referenceable.SerializableObjectRefAddr (no security manager: RMI class loader disabled)]
at org.jnp.interfaces.NamingContext.rebind(NamingContext.java:602)


The above error will come..


Thanks,

Bharathi..
Deva Devan
Ranch Hand

Joined: Sep 22, 2010
Posts: 39
I am adding providerURL, then only the hornetq server giving exception while i am starting.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9927
    
158

1) Always download the latest stable version (2.1.2 in this case)
2) First start the server without any changes and see if that works and then follow the quick start guide and/or the user manual here
Deva Devan
Ranch Hand

Joined: Sep 22, 2010
Posts: 39
Thank you very much
Deva Devan
Ranch Hand

Joined: Sep 22, 2010
Posts: 39
I have download hornetq2.1.2 final, and start the server. it started well.
but i added configuration for jndi naming. that time server doesnt start.
it given following exception :

[root@DEV-02-GW-02-13 bin]# sh run.sh
***********************************************************************************
java -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Dhornetq.config.dir=../config/stand-alone/non-clustered -Djava.util.logging.config.file=../config/stand-alone/non-clustered/logging.properties -Djava.library.path=. -classpath ../lib/twitter4j-core.jar:../lib/netty.jar:../lib/jnpserver.jar:../lib/jnp-client.jar:../lib/jboss-mc.jar:../lib/jboss-jms-api.jar:../lib/hornetq-twitter-integration.jar:../lib/hornetq-logging.jar:../lib/hornetq-jms.jar:../lib/hornetq-jms-client-java5.jar:../lib/hornetq-jms-client.jar:../lib/hornetq-jboss-as-integration.jar:../lib/hornetq-core.jar:../lib/hornetq-core-client-java5.jar:../lib/hornetq-core-client.jar:../lib/hornetq-bootstrap.jar:../config/stand-alone/non-clustered:../schemas/ org.hornetq.integration.bootstrap.HornetQBootstrapServer hornetq-beans.xml
***********************************************************************************
[main] 12:43:11,829 INFO [org.hornetq.integration.bootstrap.HornetQBootstrapServer] Starting HornetQ Server
[main] 12:43:13,164 INFO [org.hornetq.core.server.impl.HornetQServerImpl] live server is starting..
[main] 12:43:13,201 INFO [org.hornetq.core.persistence.impl.journal.JournalStorageManager] Using AIO Journal
[main] 12:43:13,221 WARNING [org.hornetq.core.server.impl.HornetQServerImpl] Security risk! It has been detected that the cluster admin user and password have not been changed from the installation default. Please see the HornetQ user guide, cluster chapter, for instructions on how to do this.
[main] 12:43:17,950 WARNING [org.hornetq.jms.server.impl.JMSServerManagerImpl] Binding for /queue/DLQ already exists
[main] 12:43:17,999 SEVERE [org.hornetq.core.deployers.impl.XmlDeployer] Unable to deploy node [queue: null] ExpiryQueue
javax.naming.CommunicationException [Root exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: No ClassLoaders found for: org.hornetq.jms.referenceable.SerializableObjectRefAddr (no security manager: RMI class loader disabled)]
at org.jnp.interfaces.NamingContext.rebind(NamingContext.java:602)
at org.jnp.interfaces.NamingContext.rebind(NamingContext.java:540)
at org.hornetq.jms.server.impl.JMSServerManagerImpl.bindToJndi(JMSServerManagerImpl.java:1410)
at org.hornetq.jms.server.impl.JMSServerManagerImpl.createQueue(JMSServerManagerImpl.java:379)
at org.hornetq.jms.server.impl.JMSServerDeployer.deployQueue(JMSServerDeployer.java:174)
at org.hornetq.jms.server.impl.JMSServerDeployer.createAndBindObject(JMSServerDeployer.java:114)
at org.hornetq.jms.server.impl.JMSServerDeployer.deploy(JMSServerDeployer.java:97)
at org.hornetq.core.deployers.impl.XmlDeployer.deploy(XmlDeployer.java:181)
at org.hornetq.core.deployers.impl.FileDeploymentManager.registerDeployer(FileDeploymentManager.java:131)
at org.hornetq.core.deployers.impl.XmlDeployer.start(XmlDeployer.java:210)
at org.hornetq.jms.server.impl.JMSServerManagerImpl.activated(JMSServerManagerImpl.java:200)
at org.hornetq.core.server.impl.HornetQServerImpl.callActivateCallbacks(HornetQServerImpl.java:876)
at org.hornetq.core.server.impl.HornetQServerImpl.initialisePart2(HornetQServerImpl.java:1088)
at org.hornetq.core.server.impl.HornetQServerImpl.start(HornetQServerImpl.java:313)
at org.hornetq.jms.server.impl.JMSServerManagerImpl.start(JMSServerManagerImpl.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:241)
at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:70)
at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBean(AbstractKernelDeployer.java:319)
at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBeans(AbstractKernelDeployer.java:297)
at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deploy(AbstractKernelDeployer.java:130)
at org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer.deploy(BeanXMLDeployer.java:96)
at org.hornetq.integration.bootstrap.HornetQBootstrapServer.deploy(HornetQBootstrapServer.java:236)
at org.hornetq.integration.bootstrap.HornetQBootstrapServer.deploy(HornetQBootstrapServer.java:206)
at org.hornetq.integration.bootstrap.HornetQBootstrapServer.bootstrap(HornetQBootstrapServer.java:155)
at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.run(AbstractBootstrap.java:83)
at org.hornetq.integration.bootstrap.HornetQBootstrapServer.run(HornetQBootstrapServer.java:116)
at org.hornetq.integration.bootstrap.HornetQBootstrapServer.main(HornetQBootstrapServer.java:73)


i am not using jboss app server.

Can i publish message in standalone jms application withut using jndi naming?

Thanks.

Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9927
    
158

Thamizh Bharathi wrote:
but i added configuration for jndi naming.
it given following exception :


How did you do that? Can you point us to the chapter in that doc, which you used to do the changes? (I personally haven't used HornetQ much, so just want to make sure, I understand what you are doing)

Can i publish message in standalone jms application withut using jndi naming?


Yes you can. The documentation that I pointed you to has the details.
Deva Devan
Ranch Hand

Joined: Sep 22, 2010
Posts: 39
Thanks
Deva Devan
Ranch Hand

Joined: Sep 22, 2010
Posts: 39
Hi,

Can we send and receiving message to queue without using jms and any app server? (without starting any third party like hornetq, MQseries - I dont want to start any seperate server, i want handle with my code, i can use jars )

Thanks.

 
 
subject: JMS
 
Similar Threads
a Collection type that is fixed in size and like a Queue
Upload Rights
URLyBird : Need Suggestions on record number
ConcurrentLinkedQueue ??
How to redirect request to a new queue based on url-pattern