The JMS Resource Adapter (which is the class that is throwing that exception) is only for use within the application
client container, or the Glassfish server itself. And because you defined your connection factory in Glassfish it is
configured to use a resource adapter.
If you want to define your connection factories using Glassfish's JNDI you need to use the Application Client Container
(see
http://docs.sun.com/app/docs/doc/820-4336/beaku?a=view for how to use this).
(You could also by-pass Glassfish altogether and use a simple MQ client, creating your connection factory either in code
or using the MQ admin console).
Nigel
xuqingkang2 wrote, on 14/07/2010 02:34:
> Hi Nigel:
> Thanks for you reply.
> I am not using the Application Client Container, I only coded one Java
> Main class(add glassfish's jar to classpath) and run it.
> I had configured jms connection factory with two properties(AddressList
> and imqAddressList:value is http://localhost:8080/httpjms/tunnel), but
> it always failed because the same exception which has been mentioned
> previously. It has nothing to do with the AddressList or imqAddressList
> of jms connection factory. When i try to get connection from jms
> connection factory lookuped from JNDI,It always use the
> [http://$host:7676/httpjms],it uses the MQ's primary port(7676) rather
> than the http listener's port.This URL is not right obviously.
>
> At 2010-07-14 01:06:05£¬"Nigel Deakin" <nigel.deakin_at_oracle.com> wrote:
>
> The steps you describe for deploying the tunnel servlet and
> configuring the MQ broker seem just fine. I would expect you to be
> able to connect to this broker from a client (running in a separate
> JVM) using imqAddressList=http://localhost:8080/httpjms/tunnel .
>
> Is your client using the Application Client Container?
>
> Your description doesn't make clear that value of imqAddressList the
> exception you give relates to. If your connection factory is
> configured with imqAddressList=http://localhost:8080/httpjms/tunnel,
> exactly what exception is logged on the client?
>
> Nigel
>
>
> xuqingkang2 wrote, on 12/07/2010 08:51:
>> 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!
>> ---
>>
>>
>>
>>
>
>