ActiveMq

The OpenShift forums have been retired.
You can still read and search them, but for help, please post a question on Stack Overflow.

Hi Everyone, This is my first time deploying an app in Openshift.

I have an activemq running on our local server. To become familiar with OpenShift, I decided to try deploying ActiveMQ from https://github.com/shekhargulati/activemq-openshift-quickstart

After pushing the files and checking the status by running ctl_app status I got a message "Application is either stopped or inaccessible".

I executed tail_all the message was "/usr/bin/tail: cannot open `/logs/' for reading: No such file or directory"

In the example it used OPENSHIFT_INTERNAL_IP in the (action_hooks, jetty.xml and activemq.xml )and changed it to OPENSHIFT_DIY_IP, but did not work as well.

My url is http://activemq-morgansolar.rhcloud.com/

Appreciate any help you can give.

Regards, Walter

Hello Walter,

Recently OpenShift updated to V2 Cartridge system which resulted in some changes. I have updated the quickstart and it seem to be working fine. Just recreate the application by following the commands shown below. The example is running here http://activemq-cix.rhcloud.com/

$ rhc app create activemq diy
$ cd activemq/
$ git remote add upstream https://github.com/shekhargulati/activemq-openshift-quickstart.git
$ git pull -s recursive -X theirs upstream master
$ git push

Thanks

Shekhar (OpenShift Developer Evangelist)

Hi Shekhar,

I have re-created activemq and it's working properly now.

I tried editing the configuration file activemq.xml by changing the broker name from localhost to savanna and restarted the application. I went to http://activemq-morgansolar.rhcloud.com/admin/index.jsp and I did not reflect the change. I even tried to kill the broker then restarted activemq app but still did not work.

Do you have any idea how to make it work?

Thanks, Walter

Hello Walter,

Yes, you can change the broker name. I just updated the quickstart with some more changes https://github.com/shekhargulati/activemq-openshift-quickstart. I would suggest recreate the app again. The example app http://activemq1-cix.rhcloud.com/admin/. You can see that I am now using shekhar as my broker name.

Thanks

Shekhar

Hi Shekhar,

I was able to change the broker name. I tried to use ActiveMQ and tried to subscribe to a queue using websocket over stomp coming from the browser. It appears that the http server and the broker should reside in the same host. Is there a way that an app in a PHP 5.1 cartridge can communicate to an app in a diy(ActiveMQ) cartridge ?

Thank you so much for responding.

More power,
Walter

Hello Walter,

There are couple of ways you can use it but you have to understand that we are using ActiveMQ REST interface.

1) Within your PHP code you can send messages using ActiveMQ REST Post endpoint and Get messages using ActiveMQ Get endpoint. Read this http://activemq.apache.org/rest.html

2) Use ActiveMQ Ajax interface. So, you can use ActiveMQ javascript library amq.js to send message or subscribe to the channel. Read this http://activemq.apache.org/ajax.html.

I have not tried the above two approaches so you can give them a try. Also, it would be good if you can blog about your experience.

Thanks

Shekhar

Hi Shekhar,

Thank your for your suggestions. I decided to try using the websocket demo (http://activemq-morgansolar.rhcloud.com/demo/websocket/index.html). It is not working when I tried to connect. I curiously change the Server url from ws://localhost:61614/stomp to ws://mylocalhost:61614/stomp, surprisingly I was able to connect to my existing broker. That means it is possible for web browser using websocket/stomp to connect to a broker in a different host. I also checked my activemq.log and there was an error during startup and maybe this is the reason why the websocket was not working properly. Here is the error log

Regards, Walter

2013-07-04 14:36:25,610 | INFO | ActiveMQ 5.6.0 JMS Message Broker (savanna) is starting | org.apache.activemq.broker.BrokerService | main 2013-07-04 14:36:25,621 | INFO | For help or more information please see: http://activemq.apache.org/ | org.apache.activemq.broker.BrokerService | main 2013-07-04 14:36:25,751 | WARN | could not generate unique stub by using DNS and binding to local port | org.apache.activemq.util.IdGenerator | main java.net.BindException: Permission denied at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376) at java.net.ServerSocket.bind(ServerSocket.java:376) at java.net.ServerSocket.(ServerSocket.java:237) at java.net.ServerSocket.(ServerSocket.java:128) at org.apache.activemq.util.IdGenerator.(IdGenerator.java:54) at org.apache.activemq.broker.region.RegionBroker.(RegionBroker.java:66) at org.apache.activemq.broker.BrokerService.createRegionBroker(BrokerService.java:1996) at org.apache.activemq.broker.BrokerService.createRegionBroker(BrokerService.java:1990) at org.apache.activemq.broker.BrokerService.createBroker(BrokerService.java:1947) at org.apache.activemq.broker.BrokerService.getBroker(BrokerService.java:802) at org.apache.activemq.broker.BrokerService.getAdminConnectionContext(BrokerService.java:2207) at org.apache.activemq.broker.BrokerService.startVirtualConsumerDestinations(BrokerService.java:2368) at org.apache.activemq.broker.BrokerService.startDestinations(BrokerService.java:2198) at org.apache.activemq.broker.BrokerService.start(BrokerService.java:527) at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1544) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1485) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) at org.apache.xbean.spring.context.ResourceXmlApplicationContext.(ResourceXmlApplicationContext.java:64) at org.apache.xbean.spring.context.ResourceXmlApplicationContext.(ResourceXmlApplicationContext.java:52) at org.apache.activemq.xbean.XBeanBrokerFactory$1.(XBeanBrokerFactory.java:108) at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:108) at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:72) at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71) at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54) at org.apache.activemq.console.command.StartCommand.startBroker(StartCommand.java:115) at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:74) at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57) at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:148) at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57) at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:90) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.activemq.console.Main.runTaskClass(Main.java:257) at org.apache.activemq.console.Main.main(Main.java:111) 2013-07-04 14:36:26,516 | INFO | jetty-7.6.1.v20120215 | org.eclipse.jetty.server.Server | main 2013-07-04 14:36:26,750 | INFO | started o.e.j.s.ServletContextHandler{/,null} | org.eclipse.jetty.server.handler.ContextHandler | main 2013-07-04 14:36:26,916 | INFO | Started SelectChannelConnector@127.9.58.129:15005 | org.eclipse.jetty.server.AbstractConnector | main 2013-07-04 14:36:26,916 | INFO | Connector http Started | org.apache.activemq.broker.TransportConnector | main 2013-07-04 14:36:27,075 | INFO | Listening for connections at: tcp://127.9.58.129:15006?brokerName=savanna | org.apache.activemq.transport.TransportServerThreadSupport | main 2013-07-04 14:36:27,077 | INFO | Connector openwire Started | org.apache.activemq.broker.TransportConnector | main 2013-07-04 14:36:27,113 | INFO | Listening for connections at: stomp://127.9.58.129:15007?brokerName=savanna | org.apache.activemq.transport.TransportServerThreadSupport | main 2013-07-04 14:36:27,113 | INFO | Connector stomp Started | org.apache.activemq.broker.TransportConnector | main 2013-07-04 14:36:27,133 | INFO | jetty-7.6.1.v20120215 | org.eclipse.jetty.server.Server | main 2013-07-04 14:36:27,133 | INFO | started o.e.j.s.ServletContextHandler{/,null} | org.eclipse.jetty.server.handler.ContextHandler | main 2013-07-04 14:36:27,233 | INFO | Started SelectChannelConnector@127.9.58.129:15008 | org.eclipse.jetty.server.AbstractConnector | main 2013-07-04 14:36:27,233 | INFO | Connector websocket Started | org.apache.activemq.broker.TransportConnector | main 2013-07-04 14:36:27,303 | INFO | ActiveMQ JMS Message Broker (savanna, ID:ex-std-node183.prod.rhcloud.com-1-1372962985806-0:1) started | org.apache.activemq.broker.BrokerService | main 2013-07-04 14:36:27,303 | WARN | Store limit is 102400 mb, whilst the data directory: /var/lib/openshift/51d5bbe7e0b8cd6caf000075/app-root/data/activemq-data/kahadb only has 64079 mb of usable space | org.apache.activemq.broker.BrokerService | main 2013-07-04 14:36:27,540 | INFO | jetty-7.6.1.v20120215 | org.eclipse.jetty.server.Server | main 2013-07-04 14:36:29,699 | INFO | ActiveMQ WebConsole initialized. | org.apache.activemq.web.WebConsoleStarter | main 2013-07-04 14:36:29,699 | INFO | started o.e.j.w.WebAppContext{/admin,file:/var/lib/openshift/51d5bbe7e0b8cd6caf000075/app-root/runtime/repo/diy/activemq/webapps/admin/} | org.eclipse.jetty.server.handler.ContextHandler | main 2013-07-04 14:36:29,817 | INFO | Logging to org.slf4j.impl.Log4jLoggerAdapter(org.mortbay.log) via org.mortbay.log.Slf4jLog | org.mortbay.log | main 2013-07-04 14:36:30,250 | INFO | Initializing Spring FrameworkServlet 'dispatcher' | /admin | main 2013-07-04 14:36:32,148 | INFO | ActiveMQ Console at http://127.9.58.129:8080/admin | org.eclipse.jetty.webapp.WebAppContext | main 2013-07-04 14:36:32,439 | INFO | started o.e.j.w.WebAppContext{/demo,file:/var/lib/openshift/51d5bbe7e0b8cd6caf000075/app-root/runtime/repo/diy/activemq/webapps/demo/} | org.eclipse.jetty.server.handler.ContextHandler | main 2013-07-04 14:36:32,544 | INFO | ActiveMQ Web Demos at http://127.9.58.129:8080/demo | org.eclipse.jetty.webapp.WebAppContext | main 2013-07-04 14:36:32,732 | INFO | started o.e.j.w.WebAppContext{/fileserver,file:/var/lib/openshift/51d5bbe7e0b8cd6caf000075/app-root/runtime/repo/diy/activemq/webapps/fileserver/} | org.eclipse.jetty.server.handler.ContextHandler | main 2013-07-04 14:36:32,852 | INFO | RESTful file access application at http://127.9.58.129:8080/fileserver | org.eclipse.jetty.webapp.WebAppContext | main 2013-07-04 14:36:32,899 | INFO | Started SelectChannelConnector@127.9.58.129:8080 | org.eclipse.jetty.server.AbstractConnector | main 2013-07-04 15:20:31,597 | WARN | Broker localhost not started so using savanna instead | org.apache.activemq.broker.BrokerRegistry | qtp17391146-46 2013-07-04 15:20:31,625 | INFO | Connector vm://localhost Started | org.apache.activemq.broker.TransportConnector | qtp17391146-46 2013-07-04 15:21:30,988 | WARN | Broker localhost not started so using savanna instead | org.apache.activemq.broker.BrokerRegistry | qtp17391146-44 2013-07-04 15:51:33,341 | INFO | Connector vm://localhost Stopped | org.apache.activemq.broker.TransportConnector | HashSessionScavenger-1 2013-07-05 11:51:27,297 | WARN | Broker localhost not started so using savanna instead | org.apache.activemq.broker.BrokerRegistry | qtp17391146-42 2013-07-05 11:51:27,297 | INFO | Connector vm://localhost Started | org.apache.activemq.broker.TransportConnector | qtp17391146-42 2013-07-05 12:23:40,164 | INFO | Connector vm://localhost Stopped | org.apache.activemq.broker.TransportConnector | HashSessionScavenger-1 2013-07-05 13:20:37,213 | WARN | /admin/sendMessage.action | org.eclipse.jetty.servlet.ServletHandler | qtp17391146-65 java.lang.NullPointerException at org.apache.activemq.web.handler.BindingBeanNameUrlHandlerMapping.getHandlerInternal(BindingBeanNameUrlHandlerMapping.java:57) at org.springframework.web.servlet.handler.AbstractHandlerMapping.getHandler(AbstractHandlerMapping.java:184) at org.springframework.web.servlet.DispatcherServlet.getHandler(DispatcherServlet.java:930) at org.springframework.web.servlet.DispatcherServlet.getHandler(DispatcherServlet.java:915) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:753) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:585) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:565) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1360) at org.apache.activemq.web.AuditFilter.doFilter(AuditFilter.java:59) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1331) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1331) at org.apache.activemq.web.filter.ApplicationContextFilter.doFilter(ApplicationContextFilter.java:81) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1331) at com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129) at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1331) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:477) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:499) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:499) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111) at org.eclipse.jetty.server.Server.handle(Server.java:349) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452) at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:894) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:948) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:857) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534) at java.lang.Thread.run(Thread.java:724) 2013-07-05 13:21:27,633 | WARN | Broker localhost not started so using savanna instead | org.apache.activemq.broker.BrokerRegistry | qtp17391146-65 2013-07-05 13:21:27,634 | INFO | Connector vm://localhost Started | org.apache.activemq.broker.TransportConnector | qtp17391146-65 2013-07-05 13:48:38,257 | INFO | Connector vm://localhost Stopped | org.apache.activemq.broker.TransportConnector | Timer-1

Hi Everyone,

I am a newbie to openshift., I deployed activemq using this "how to" https://www.openshift.com/blogs/activemq-on-paas successfully but the broker name still referring to shekhar even after I changed the name to something else.

I followed these steps to change the broker name

Changed the name reference in activemq.xml locally

then

git add activemq.xml git commit activemq.xml m '.xxx' git push

and also re-starting the gear does not seem to help either. I am getting a message on the browser that an exception is thrown but when I checked activemq.log file, the file is empty.

Any idea what I am doing wrong?

Did you change both lines in your activemq.xml?

<broker xmlns="http://activemq.apache.org/schema/core" brokerName="shekhar" dataDirectory="${activemq.data}">
And... 
<transportConnector name="http" uri="http://OPENSHIFT_DIY_IP:15005?brokerName=shekhar"/>
        </transportConnectors>
</code

Thanks for the response. Yes, I did but that doesn't seem to have any effect.