I could not get any helpful information, how to auto-start ActiveMQ broker from Tomcat. And thus, I finally, after 4 fruitful hours, configured.
This is my valuable contribution to open-source community.
Step 1
Install ActiveMQ and Tomcat from following places,
http://activemq.apache.org/activemq-542-release.html and
http://apache.ziply.com/tomcat/tomcat-6/v6.0.30/bin/apache-tomcat-6.0.30.zip
Also download activemq web console for autostarting activemq instance from tomcat.
http://repo1.maven.org/maven2/org/apache/activemq/activemq-web-console/5.4.2/
Step 2
Copy “activemq-all-5.4.2.jar” from activemq\lib to tomcat\lib
Copy “activemq-web-console-5.4.2.war” inside tomcat webapps
Step 3
Configure %CATALINA_HOME%\bin\catalina.bat or .sh by adding the following line
set JAVA_OPTS=”-Dwebconsole.jms.url=tcp://localhost:61616 -Dwebconsole.type=properties”
Step 4
If you have already set the java, catalina and activemq path variable then you can start the tomcat service from the console as,
C:\>startup
Step 5
Enter the following on the browser address bar,
Tomcat
ActiveMQ Web Console
http://localhost:8080/activemq-web-console-5.4.2/
If someone needs further information, I’m happy to help.
Open-Source community rocks !!!
Hello, Iam a beginner with JMS, I’m trying to make a Hello World App, a chat. I followed all directions for install activemq, and included a new topic in the configuration page.
But I have a problem getting the JNDI.
I am going to include the sourse and error text.
Sourse:
———————————————————–
public class ClienteJMSChat implements javax.jms.MessageListener {
private static final String CONTEXT_FACTORY =
“org.exolab.jms.jndi.InitialContextFactory”;
/**:::: I think the problem here could be ::::::::::::::::::*/
protected static final String PROVIDER_URL = “tcp://localhost:61616″;
/** this is the name of the topic created by me */
protected static final String TOPIC_CONNECTION_FACTORY =”Friki”;
public void initialize(String topico, String usuario, String password) {
debug(“Cargando configuración…”);
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, CONTEXT_FACTORY);
properties.put(Context.PROVIDER_URL, PROVIDER_URL);
try {
debug(“obtaining the initial context… the excecution collapse after this line”);
InitialContext context = new InitialContext(properties);
TopicConnectionFactory conFactory = (TopicConnectionFactory) context
.lookup(TOPIC_CONNECTION_FACTORY);
TopicConnection conexion = conFactory.createTopicConnection(
usuario, password);
TopicSession sesionP = conexion.createTopicSession(false,
Session.AUTO_ACKNOWLEDGE);
TopicSession sesionS = conexion.createTopicSession(false,
Session.AUTO_ACKNOWLEDGE);
Topic topicObj = (Topic) context.lookup(topico);
TopicSubscriber suscriptor = sesionS.createSubscriber(topicObj);
TopicPublisher publicador = sesionP.createPublisher(topicObj);
suscriptor.setMessageListener(this);
this.conexion = conexion;
this.sesionP = sesionP;
this.sesionS = sesionS;
this.publicador = publicador;
this.usuario = usuario;
conexion.start();
} catch (NamingException ne) {
throw new RuntimeException(“Error JNDI”, ne);
} catch (JMSException jmse) {
throw new RuntimeException(“Error JMS”, jmse);
}
}
————————————————————-
Error text:
————————————————————-
Exception in thread “main” java.lang.RuntimeException: Error JNDI
at jms_test.ClienteJMSChat.initialize(ClienteJMSChat.java:203)
at jms_test.ClienteJMSChat.main(ClienteJMSChat.java:86)
Caused by: javax.naming.NamingException: Operation getNameParser failed: java.io.StreamCorruptedException: invalid stream header: 01416374
at org.exolab.jms.jndi.mipc.NameServiceProxy.checkReply(NameServiceProxy.java:229)
at org.exolab.jms.jndi.mipc.NameServiceProxy.getNameParser(NameServiceProxy.java:85)
at org.exolab.jms.jndi.mipc.IpcJndiInitialContextFactory.getInitialContext(IpcJndiInitialContextFactory.java:144)
at org.exolab.jms.jndi.InitialContextFactory.getInitialContext(InitialContextFactory.java:109)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.(InitialContext.java:197)
at jms_test.ClienteJMSChat.initialize(ClienteJMSChat.java:153)
—————————————————————–
thanks for this wonderful link.
Great info. However how do you configure the
the transport connectors to expose ActiveMQ over a given protocol to remote clients and other brokers that was configured in the activemq.xml file:
I followed the steps to deploy ActiveMQ war and then tried to start Tomcat server and getting the following exception. Do you have any idea to resolve the issue?
Apr 18, 2011 5:23:00 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /activemq-web-console-5.4.2 threw load() exception
javax.servlet.ServletException: Servlet.init() for servlet dispatcher threw exce
ption
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
java:1214)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:99
3)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
t.java:4149)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
458)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:77
1)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:850)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:724
)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:493
)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:314)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
Hi,
Thanks for info provided above.
When i try to build using gradle i am getting this error.
Could not find group:net.sf.josql, module:josql, version:1.5.
Can you please help me to get rid of this error.
How to create one application in activemq server like activemq demo.
Thanks for the great and precise info! It works for me also on Tomcat 7.0.40.
Hi,
Thanks for the above valuable info. I was stuck with this for more than a week and fed up with the task am doing. Finally your post helped me regain my energy. thanks a lot.
Oh my goodness! Incredible article dude! Many thanks,
However I am experiencing difficulties with your RSS. I don’t know
why I cannot subscribe to it. Is there anybody getting
identical RSS issues? Anyone that knows the solution will you kindly respond?
Thanks!!
Thank you for the good writeup. It in truth was a
amusement account it. Glance advanced to far introduced agreeable from
you! By the way, how can we communicate?
Admiring the persistence you put into your blog and detailed information you present.
It’s great to come across a blog every once in a while that isn’t the same unwanted rehashed
material. Great read! I’ve bookmarked your site and I’m including your
RSS feeds to my Google account.
I am actually happy to glance at this blog posts which includes plenty
of helpful data, thanks for providing these statistics.
I read this article completely regarding the comparison of most recent and preceding technologies,
it’s remarkable article.
Quality posts is the important to invite the people to pay a visit the website,
that’s what this web site is providing.
I don’t even know the way I finished up here, but I assumed this post was good.
I do not recognize who you’re however certainly you’re going to a well-known blogger if you happen to aren’t
already. Cheers!
I’ve just bookmarked this page, magnificent web site!
WOW just what I was searching for. Came here by searching
for B.Tech
I have been explorihg for a little for any high quality articles or webloog posts in this kind of house .
Explokring in Yahoo I eventually stumbled upon this site.
Reading thuis info So i’m happy to express
that I’ve an incredibly excellent uncanny feeling
I came upon just what I needed. I most certainly will make certain to don?t overlook this site and give it a lance regularly.
I don’t know if it’s just me or if perhaps everybody
else experiencing problems with your blog. It seems like some of
the written text within your content are running off the screen. Can somebody else please provide
feedback and let me know if this is happening to them as
well? This could be a issue with my web browser because I’ve had this happen before.
Cheers
It’s an amazing post for all the onlone users; they will obtain benefit from it
I am sure.