jms - ActiveMQ servlet connect with java client -
i'm trying connect java running activemq servlet(on weblogic 12), i'm getting following exception on conn.start();
:
javax.jms.jmsexception: not post command: connectioninfo {commandid = 1, responserequired = true, connectionid = id:lmdesetup-jab-38449-1378221016985-2:1, clientid = id:lmdesetup-jab-38449-1378221016985-1:1, clientip = null, username = null, password = *****, brokerpath = null, brokermasterconnector = false, manageable = true, clientmaster = true, faulttolerant = false, failoverreconnect = false} due to: java.io.ioexception: failed post command: connectioninfo {commandid = 1, responserequired = true, connectionid = id:lmdesetup-jab-38449-1378221016985-2:1, clientid = id:lmdesetup-jab-38449-1378221016985-1:1, clientip = null, username = null, password = *****, brokerpath = null, brokermasterconnector = false, manageable = true, clientmaster = true, faulttolerant = false, failoverreconnect = false} response was: http/1.1 500 internal server error [connection: close, date: tue, 03 sep 2013 15:11:02 gmt, content-length: 3092, content-type: text/html; charset=utf-8, x-powered-by: servlet/3.0 jsp/2.2] @ org.apache.activemq.util.jmsexceptionsupport.create(jmsexceptionsupport.java:62) @ org.apache.activemq.activemqconnection.syncsendpacket(activemqconnection.java:1409) @ org.apache.activemq.activemqconnection.ensureconnectioninfosent(activemqconnection.java:1496) @ org.apache.activemq.activemqconnection.start(activemqconnection.java:524)
the code here:
queueconnectionfactory factory = new activemqconnectionfactory("http://localhost:8888/myapp/amq"); connection conn = factory.createconnection(); conn.start();
(the code based on example: http://activemq.apache.org/hello-world.html)
i'm quite sure activemq broker , ajaxservlet fine, because can send , receive messages using js client.
the servlet defined in web.xml:
<context-param> <param-name>org.apache.activemq.brokerurl</param-name> <param-value>vm://localhost</param-value> </context-param> <context-param> <param-name>org.apache.activemq.embeddedbroker</param-name> <param-value>true</param-value> </context-param> <servlet> <servlet-name>ajaxservlet</servlet-name> <servlet-class>org.apache.activemq.web.ajaxservlet</servlet-class> <load-on-startup>1</load-on-startup> <async-supported>true</async-supported> </servlet> <servlet-mapping> <servlet-name>ajaxservlet</servlet-name> <url-pattern>/amq/*</url-pattern> </servlet-mapping> ...
i have found wlse same problem, solution not there: http://blog.gmane.org/gmane.comp.java.activemq.user/month=20090501
here's exception weblogic:
####<sep 3, 2013 4:19:32 pm utc> <error> <kernel> <mymachine> <myserver> <[active] executethread: '1' queue: 'weblogic.kernel.default (self-tuning)'> <<wls kernel>> <> <> <1378225172656> <bea-000802> <executerequest failed java.lang.illegalstateexception: can not error @ state: asynccompleted. java.lang.illegalstateexception: can not error @ state: asynccompleted @ weblogic.servlet.internal.async.defaultstate.notifyerror(asyncstates.java:62) @ weblogic.servlet.internal.async.asynccontextimpl.handleerror(asynccontextimpl.java:125) @ weblogic.servlet.internal.async.dispatchhandler.run(dispatchhandler.java:33) @ weblogic.work.selftuningworkmanagerimpl$workadapterimpl.run(selftuningworkmanagerimpl.java:545) @ weblogic.work.executethread.execute(executethread.java:256) @ weblogic.work.executethread.run(executethread.java:221) > ####<sep 3, 2013 4:19:32 pm utc> <error> <http> <mymachine> <myserver> <[active] executethread: '1' queue: 'weblogic.kernel.default (self-tuning)'> <<wls kernel>> <> <> <1378225172779> <bea-101020> <[servletcontext@1154401993[app:ino-all module:ino path:null spec-version:3.0]] servlet failed exception java.lang.unsupportedoperationexception: destination must specified. @ org.apache.activemq.activemqmessageproducer.send(activemqmessageproducer.java:257) @ org.apache.activemq.activemqmessageproducer.send(activemqmessageproducer.java:224) @ org.apache.activemq.activemqmessageproducersupport.send(activemqmessageproducersupport.java:300) @ org.apache.activemq.web.webclient.send(webclient.java:243) @ org.apache.activemq.web.messagelistenerservlet.dopost(messagelistenerservlet.java:219) @ javax.servlet.http.httpservlet.service(httpservlet.java:751) @ javax.servlet.http.httpservlet.service(httpservlet.java:844) @ weblogic.servlet.internal.stubsecurityhelper$servletserviceaction.run(stubsecurityhelper.java:242) @ weblogic.servlet.internal.stubsecurityhelper$servletserviceaction.run(stubsecurityhelper.java:216) @ weblogic.servlet.internal.stubsecurityhelper.invokeservlet(stubsecurityhelper.java:132) @ weblogic.servlet.internal.servletstubimpl.execute(servletstubimpl.java:338) @ weblogic.servlet.internal.tailfilter.dofilter(tailfilter.java:25) @ weblogic.servlet.internal.filterchainimpl.dofilter(filterchainimpl.java:74) @ org.apache.activemq.web.sessionfilter.dofilter(sessionfilter.java:45) @ weblogic.servlet.internal.filterchainimpl.dofilter(filterchainimpl.java:74)
i don't think need create activemqconnectionfactory
in java client if going try using ajax servlet. if @ javascript files bundled distribution, javascript doing constructing post request put message queue.
if @ client sending messages section of activemq ajax docs explains little of happens behind scene. think if want use ajaxservlet java client need construct httpservletrequest similar way javascript creating xmlhttprequest
.
alternatively, if want follow example linked to, believe need connect this:
// create connectionfactory activemqconnectionfactory connectionfactory = new activemqconnectionfactory("tcp://localhost:61616"); // create connection connection connection = connectionfactory.createconnection(); connection.start();
tcp://localhost:61616
should work because by default activemq adds tcp connector on port 61616.
Comments
Post a Comment