File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes How to use Hornet Q in JBoss 6.0 Final Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "How to use Hornet Q in JBoss 6.0 Final" Watch "How to use Hornet Q in JBoss 6.0 Final" New topic
Author

How to use Hornet Q in JBoss 6.0 Final

Jose Alvarez de Lara
Ranch Hand

Joined: May 10, 2008
Posts: 92
Hi

I am trying to configure and deploy on JBoss 6.0 AS an app client that includes a MDB Topic with a selector.

This is the code,



I use an EJB 3.0 to publish messages. It has a remote interface,





How must I do to configure the server using Hornet Q?

I am using Eclipse Helios SR1 to develop and deploy this MDB app

Thanks in advance,
Jose
anandraj tadkal
Ranch Hand

Joined: Feb 22, 2011
Posts: 98

Hi Jose,

Refer the below link for a sample configuration of HornetQ with JBoss Messaging with sample Queue Sender / Receiver Program.

http://weblogic-wonders.com/weblogic/2010/12/01/jboss-jms-using-hornetq/

Cheers,
Anandraj
http://weblogic-wonders.com


Regards,
Anandraj
http://weblogic-wonders.com
Follow us on facebook:
https://www.facebook.com/weblogicwonders
Jose Alvarez de Lara
Ranch Hand

Joined: May 10, 2008
Posts: 92
Hi,

Thanks Anandraj for your helping.

Your link took me to the user manual of Hornet Q and at the end to download hornetq-2.1.1.Final.
Now I am trying topic-selector-example1 but I am having some problems. I have created two projects
in Eclipse Helios SR1: one for the common feature and the second is topic-selector-example1 witch the
main class extends HornetQExample from common. I have included the common project into the build
path of the topic-selector-example1 project so the compiling is right.

But when I try to run the application I find the main() method of the main class is waiting for some arguments
from the command line (my system is Win XP). This means the output of the program is the following exception,


serverProps = null
28-feb-2011 18:49:47 org.hornetq.common.example.HornetQExample run
INFO: hornetq.example.runServer is true
28-feb-2011 18:49:47 org.hornetq.common.example.HornetQExample getContext
INFO: using server0\client-jndi.properties for jndi
log4j:WARN No appenders could be found for logger (org.jnp.interfaces.TimedSocketFactory).
log4j:WARN Please initialize the log4j system properly.
javax.naming.NameNotFoundException: topic not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:396)
at sun.reflect.GeneratedMethodAccessor266.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.hornetq.jms.example.TopicSelectorExample1.runExample(TopicSelectorExample1.java:51)
at org.hornetq.common.example.HornetQExample.run(HornetQExample.java:73)
at org.hornetq.jms.example.TopicSelectorExample1.main(TopicSelectorExample1.java:35)

#####################
### FAILURE! ###
#####################


From the start can you see the first line? (serverProps = null) I guess this is the reason I am getting the exception
but I am not sure if it is all or there be some errors in the configuration of the projects.

Let me know if you need more information because we are talking about a lot of several files between code and configuration files.

Best Regards,
Jose
Jose Alvarez de Lara
Ranch Hand

Joined: May 10, 2008
Posts: 92
Here is my code.

This is the main class where I run the app from,



Here is HornetQExample witch is causing me (I guess) the problems,



And here are the configuration files.

hornetq-jms.xml


and the client-jndi.properties,


Thanks in advance,
Jose
Jose Alvarez de Lara
Ranch Hand

Joined: May 10, 2008
Posts: 92
Hi,

I have made some changes in the code and the configuration files as well.
And now the app works fine.

These are the changes,

In TopicSelectorExample1.java


Now look up /jms/Topic instead of /topic/exampleTopic so the configuration files leave as follow,

hornetq-jms.xml


here I have changed the name of the topic. It was exampleTopic and now is Topic and
the entry name was /topic/exampleTopic

hornetq-configuration.xml


here I have changed <security-setting match="jms.topic.exampleTopic">

And that was all. Resolved!!!
anandraj tadkal
Ranch Hand

Joined: Feb 22, 2011
Posts: 98

Great job!!

Thanks for sharing the solution. That would definitely help out many people running into similar issues.

Cheers,
Anandraj
http://weblogic-wonders.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use Hornet Q in JBoss 6.0 Final