Hi All:
I want use HTTP connection Service of Open MQ in glassfish, but i can't do it,Please help me!
I have do following setting:
1,Configure the Open MQ for supporting HTTP Service(add "httpjms" to imq.service.activelist),the domains/domain1/imq/instances/imqbroker/props/config.properties is like
---
imq.service.activelist=jms,admin,httpjms
---
2,start glassfish v2.1.1's domain
3,deploy the Web Application which contains HTTP Tunnel Servlet to glassfish's DAS, Specify "httpjms" as Context root.
So far,I checked the Open MQ and HTTP Tunnel Servlet.
I use [imqcmd list svc],I looked following message which means Http Service had been startup along with Open MQ's startup.
-----------------------------------------------
Service Name Port Number Service State
-----------------------------------------------
admin 3697 (dynamic) RUNNING
httpjms - RUNNING
httpsjms - UNKNOWN
jms 3695 (dynamic) RUNNING
I open Browser, visit URL[
http://localhost:8080/httpjms/tunnel],I have seen following message which means HTTP Tunnel Servlet work well.
---
HTTP tunneling servlet ready.
Servlet Start Time : Mon Jul 12 11:47:52 CST 2010
Accepting TCP connections from brokers on port : 7675
Total available brokers = 1
Broker List :
localhost:imqbroker
4,create a JMS Connection Factory(JNDI Name is:jms/connFac)
5,Use following Java Code for get Connection from "jms/connFac", But it failed.I add the "AddressList" property(value:
http://localhost:8080/httpjms/tunnel) to "jms/connFac", it also failed because the same exception.
Please tell me how can i get the connection from "jms/connFac" while specified "http" as the JMS Service's MQ schema.
---
Properties properties = new Properties();
properties.setProperty(InitialContext.URL_PKG_PREFIXES,
"com.sun.enterprise.naming");
properties.setProperty(InitialContext.INITIAL_CONTEXT_FACTORY,
"com.sun.enterprise.naming.SerialInitContextFactory");
properties.setProperty(InitialContext.STATE_FACTORIES,
"com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
properties.setProperty(InitialContext.PROVIDER_URL, "localhost:3700");
Context context;
Connection conn = null;
Session session = null;
try {
context = new InitialContext(properties);
ConnectionFactory connectionFactory = (ConnectionFactory)context.lookup("jms/connFac");
System.out.println("Found JMS Connection Factory From JNDI Context.");
conn = connectionFactory.createConnection();
session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
......
The exception message are:
2010-7-12 14:49:21 com.sun.messaging.jms.ra.ResourceAdapter start
佚連: MQJMSRA_RA1101: SJSMQ JMS Resource Adapter starting...
2010-7-12 14:49:22 com.sun.messaging.jmq.jmsclient.ExceptionHandler throwConnectionException
少御: [C4003]: Error occurred on connection creation [
http://borland-s:7676/httpjms]. - cause: java.net.ConnectException: Connection refused : Failed to receive response
2010-7-12 14:49:27 com.sun.messaging.jmq.jmsclient.ExceptionHandler throwConnectionException
少御: [C4003]: Error occurred on connection creation [
http://borland-s:7676/httpjms]. - cause: java.net.ConnectException: Connection refused : Failed to receive response
2010-7-12 14:49:32 com.sun.messaging.jmq.jmsclient.ExceptionHandler throwConnectionException
少御: [C4003]: Error occurred on connection creation [
http://borland-s:7676/httpjms]. - cause: java.net.ConnectException: Connection refused : Failed to receive response
2010-7-12 14:49:37 com.sun.messaging.jmq.jmsclient.ExceptionHandler throwConnectionException
少御: [C4003]: Error occurred on connection creation [
http://borland-s:7676/httpjms]. - cause: java.net.ConnectException: Connection refused : Failed to receive response
2010-7-12 14:49:42 com.sun.messaging.jmq.jmsclient.ExceptionHandler throwConnectionException
少御: [C4003]: Error occurred on connection creation [
http://borland-s:7676/httpjms]. - cause: java.net.ConnectException: Connection refused : Failed to receive response
2010-7-12 14:49:47 com.sun.messaging.jmq.jmsclient.ExceptionHandler throwConnectionException
少御: [C4003]: Error occurred on connection creation [
http://borland-s:7676/httpjms]. - cause: java.net.ConnectException: Connection refused : Failed to receive response
2010-7-12 14:49:52 com.sun.messaging.jmq.jmsclient.ExceptionHandler throwConnectionException
少御: [C4003]: Error occurred on connection creation [
http://borland-s:7676/httpjms]. - cause: java.net.ConnectException: Connection refused : Failed to receive response
2010-7-12 14:49:57 com.sun.messaging.jmq.jmsclient.ExceptionHandler throwConnectionException
少御: [C4003]: Error occurred on connection creation [
http://borland-s:7676/httpjms]. - cause: java.net.ConnectException: Connection refused : Failed to receive response
2010-7-12 14:50:02 com.sun.messaging.jmq.jmsclient.ExceptionHandler throwConnectionException
少御: [C4003]: Error occurred on connection creation [
http://borland-s:7676/httpjms]. - cause: java.net.ConnectException: Connection refused : Failed to receive response
2010-7-12 14:50:02 com.sun.messaging.jms.ra.ResourceAdapter start
冢嶷: MQJMSRA_RA4001: start:Aborting:JMSException on createConnection=[C4003]: Error occurred on connection creation [
http://borland-s:7676/httpjms]. - cause: java.net.ConnectException: Connection refused : Failed to receive response
com.sun.messaging.jms.JMSException: [C4003]: Error occurred on connection creation [
http://borland-s:7676/httpjms]. - cause: java.net.ConnectException: Connection refused : Failed to receive response
at com.sun.messaging.jmq.jmsclient.ExceptionHandler.throwConnectionException(ExceptionHandler.java:274)
at com.sun.messaging.jmq.jmsclient.ExceptionHandler.handleConnectException(ExceptionHandler.java:232)
at com.sun.messaging.jmq.jmsclient.protocol.http.HTTPConnectionHandler.<init>(HTTPConnectionHandler.java:93)
at com.sun.messaging.jmq.jmsclient.protocol.http.HTTPStreamHandler.openConnection(HTTPStreamHandler.java:101)
at com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnection(ConnectionInitiator.java:778)
at com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnectionNew(ConnectionInitiator.java:254)
at com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnection(ConnectionInitiator.java:208)
at com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnection(ConnectionInitiator.java:158)
at com.sun.messaging.jmq.jmsclient.ProtocolHandler.init(ProtocolHandler.java:836)
at com.sun.messaging.jmq.jmsclient.ProtocolHandler.<init>(ProtocolHandler.java:1528)
at com.sun.messaging.jmq.jmsclient.ConnectionImpl.openConnection(ConnectionImpl.java:2363)
at com.sun.messaging.jmq.jmsclient.ConnectionImpl.init(ConnectionImpl.java:1044)
at com.sun.messaging.jmq.jmsclient.ConnectionImpl.<init>(ConnectionImpl.java:430)
at com.sun.messaging.jmq.jmsclient.UnifiedConnectionImpl.<init>(UnifiedConnectionImpl.java:60)
at com.sun.messaging.jmq.jmsclient.XAConnectionImpl.<init>(XAConnectionImpl.java:58)
at com.sun.messaging.XAConnectionFactory.createXAConnection(XAConnectionFactory.java:91)
at com.sun.messaging.XAConnectionFactory.createXAConnection(XAConnectionFactory.java:69)
at com.sun.messaging.jms.ra.ResourceAdapter.start(ResourceAdapter.java:315)
at com.sun.enterprise.connectors.ActiveInboundResourceAdapter$1.run(ActiveInboundResourceAdapter.java:180)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.enterprise.connectors.ActiveInboundResourceAdapter.startResourceAdapter(ActiveInboundResourceAdapter.java:174)
at com.sun.enterprise.connectors.ActiveInboundResourceAdapter.<init>(ActiveInboundResourceAdapter.java:132)
at com.sun.enterprise.connectors.system.ActiveJmsResourceAdapter.<init>(ActiveJmsResourceAdapter.java:234)
at com.sun.enterprise.connectors.ActiveRAFactory.createActiveResourceAdapter(ActiveRAFactory.java:107)
at com.sun.enterprise.connectors.ResourceAdapterAdminServiceImpl.createActiveResourceAdapter(ResourceAdapterAdminServiceImpl.java:300)
at com.sun.enterprise.connectors.ConnectorRuntime.createActiveResourceAdapter(ConnectorRuntime.java:212)
at com.sun.enterprise.naming.factory.ConnectorObjectFactory.getObjectInstance(ConnectorObjectFactory.java:101)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:414)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at JMSMessageProducer.main(JMSMessageProducer.java:35)
Caused by: java.net.ConnectException: Connection refused : Failed to receive response
at com.sun.messaging.jmq.transport.httptunnel.client.HttpTunnelClientDriver.doConnect(HttpTunnelClientDriver.java:222)
at com.sun.messaging.jmq.transport.httptunnel.HttpTunnelSocket.<init>(HttpTunnelSocket.java:64)
at com.sun.messaging.jmq.jmsclient.protocol.http.HTTPConnectionHandler.<init>(HTTPConnectionHandler.java:91)
... 28 more
Caused by: java.io.IOException: Failed to receive response
at com.sun.messaging.jmq.transport.httptunnel.client.HttpTunnelPush.sendPacketDirect(HttpTunnelPush.java:156)
at com.sun.messaging.jmq.transport.httptunnel.client.HttpTunnelClientDriver.doConnect(HttpTunnelClientDriver.java:163)
... 30 more
Thanks in advance!
---