Skip to main content

How to connect to remote JMS

No replies
Anonymous

Hi all,

I try to setup a jms connection factory to a TIBCO EMS on a remote machine.

The resource type is javax.jms.ConnectionFactory

Pool settings default, no transaction. I added also UserName, Password and AddressList (Format: dev-esb:7222).

However it does not work. If I try to connect (or ping) I'll get the following exception:

WARNING: [C4003]: Error occurred on connection creation [dev-esb:7222]. - cause: java.lang.NumberFormatException: For input string: "

I can easily connect to the JMS programmatically, so I'm sure it works. The only difference is, that the code uses a TIBCO class for the factory: TibjmsQueueConnectionFactory

Is this a bug or did I forget any important settings? What's the precise procedure to connect to a remote JMS?

Cheers,
Andy

The exception:

Dec 20, 2012 9:42:15 AM org.hibernate.validator.internal.util.Version
INFO: HV000001: Hibernate Validator 4.3.0.Final
Dec 20, 2012 9:42:16 AM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter: Version: 4.5.2 Patch 1 (Build 3-d) Compile: Thu Jun 7 10:46:15 PDT 2012
Dec 20, 2012 9:42:16 AM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter starting: broker is REMOTE, connection mode is TCP
Dec 20, 2012 9:42:16 AM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter Started:REMOTE
Dec 20, 2012 9:42:16 AM com.sun.messaging.jmq.jmsclient.ExceptionHandler throwConnectionException
WARNING: [C4003]: Error occurred on connection creation [10.20.13.131:7222]. - cause: java.lang.NumberFormatException: For input string: "

com.sun.messaging.jms.JMSException: [C4003]: Error occurred on connection creation [10.20.13.131:7222]. - cause: java.lang.NumberFormatException: For input string: "
at com.sun.messaging.jmq.jmsclient.ExceptionHandler.throwConnectionException(ExceptionHandler.java:280)
at com.sun.messaging.jmq.jmsclient.ExceptionHandler.handleConnectException(ExceptionHandler.java:226)
at com.sun.messaging.jmq.jmsclient.PortMapperClient.readBrokerPorts(PortMapperClient.java:262)
at com.sun.messaging.jmq.jmsclient.PortMapperClient.init(PortMapperClient.java:156)
at com.sun.messaging.jmq.jmsclient.PortMapperClient.(PortMapperClient.java:98)
at com.sun.messaging.jmq.jmsclient.protocol.tcp.TCPConnectionHandler.(TCPConnectionHandler.java:168)
at com.sun.messaging.jmq.jmsclient.protocol.tcp.TCPStreamHandler.openConnection(TCPStreamHandler.java:141)
at com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnection(ConnectionInitiator.java:785)
at com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnectionNew(ConnectionInitiator.java:260)
at com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnection(ConnectionInitiator.java:214)
at com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnection(ConnectionInitiator.java:164)
at com.sun.messaging.jmq.jmsclient.ProtocolHandler.init(ProtocolHandler.java:843)
at com.sun.messaging.jmq.jmsclient.ProtocolHandler.(ProtocolHandler.java:1562)
at com.sun.messaging.jmq.jmsclient.ConnectionImpl.openConnection(ConnectionImpl.java:2427)
at com.sun.messaging.jmq.jmsclient.ConnectionImpl.init(ConnectionImpl.java:1108)
at com.sun.messaging.jmq.jmsclient.ConnectionImpl.(ConnectionImpl.java:459)
at com.sun.messaging.jmq.jmsclient.UnifiedConnectionImpl.(UnifiedConnectionImpl.java:66)
at com.sun.messaging.jmq.jmsclient.XAConnectionImpl.(XAConnectionImpl.java:64)
at com.sun.messaging.XAConnectionFactory.createXAConnection(XAConnectionFactory.java:97)
at com.sun.messaging.jms.ra.ManagedConnection.(ManagedConnection.java:196)
at com.sun.messaging.jms.ra.ManagedConnectionFactory.createManagedConnection(ManagedConnectionFactory.java:226)
at com.sun.enterprise.resource.allocator.NoTxConnectorAllocator.createResource(NoTxConnectorAllocator.java:128)
at com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:907)
at com.sun.enterprise.resource.pool.ConnectionPool.createResource(ConnectionPool.java:1189)
at com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure.addResource(RWLockDataStructure.java:98)
at com.sun.enterprise.resource.pool.ConnectionPool.addResource(ConnectionPool.java:282)
at com.sun.enterprise.resource.pool.ConnectionPool.createResourceAndAddToPool(ConnectionPool.java:1512)
at com.sun.enterprise.resource.pool.ConnectionPool.createResources(ConnectionPool.java:944)
at com.sun.enterprise.resource.pool.ConnectionPool.initPool(ConnectionPool.java:230)
at com.sun.enterprise.resource.pool.ConnectionPool.internalGetResource(ConnectionPool.java:511)
at com.sun.enterprise.resource.pool.ConnectionPool.getResource(ConnectionPool.java:381)
at com.sun.enterprise.resource.pool.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:245)
at com.sun.enterprise.resource.pool.PoolManagerImpl.getResource(PoolManagerImpl.java:170)
at com.sun.enterprise.connectors.ConnectionManagerImpl.getResource(ConnectionManagerImpl.java:338)
at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:301)
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:236)
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:165)
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:160)
at com.sun.messaging.jms.ra.ConnectionFactoryAdapter._allocateConnection(ConnectionFactoryAdapter.java:181)
at com.sun.messaging.jms.ra.ConnectionFactoryAdapter.createConnection(ConnectionFactoryAdapter.java:168)
at com.sun.messaging.jms.ra.ConnectionFactoryAdapter.createConnection(ConnectionFactoryAdapter.java:150)
at info.junius.GFMessageSender.main(GFMessageSender.java:22)
Caused by: java.lang.NumberFormatException: For input string: "
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:481)
at java.lang.Integer.parseInt(Integer.java:527)
at com.sun.messaging.jmq.io.PortMapperTable.read(PortMapperTable.java:277)
at com.sun.messaging.jmq.jmsclient.PortMapperClient.readBrokerPorts(PortMapperClient.java:243)
... 39 more
Dec 20, 2012 9:42:57 AM com.sun.enterprise.resource.allocator.NoTxConnectorAllocator createResource
WARNING: RAR5038:Unexpected exception while creating resource for pool jms/iiNetTibcoConnectionFactory. Exception : javax.resource.spi.ResourceAdapterInternalException: MQJMSRA_MC4001: constructor:Aborting:JMSException on createConnection=[C4003]: Error occurred on connection creation [10.20.13.131:7222]. - cause: java.lang.NumberFormatException: For input string: "
at com.sun.messaging.jmq.jmsclient.ExceptionHandler.throwConnectionException(ExceptionHandler.java:280)
at com.sun.messaging.jmq.jmsclient.ExceptionHandler.handleConnectException(ExceptionHandler.java:226)
at com.sun.messaging.jmq.jmsclient.PortMapperClient.readBrokerPorts(PortMapperClient.java:262)
at com.sun.messaging.jmq.jmsclient.PortMapperClient.init(PortMapperClient.java:156)
at com.sun.messaging.jmq.jmsclient.PortMapperClient.(PortMapperClient.java:98)
at com.sun.messaging.jmq.jmsclient.protocol.tcp.TCPConnectionHandler.(TCPConnectionHandler.java:168)
at com.sun.messaging.jmq.jmsclient.protocol.tcp.TCPStreamHandler.openConnection(TCPStreamHandler.java:141)
at com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnection(ConnectionInitiator.java:785)
at com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnectionNew(ConnectionInitiator.java:260)
at com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnection(ConnectionInitiator.java:214)
at com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnection(ConnectionInitiator.java:164)
at com.sun.messaging.jmq.jmsclient.ProtocolHandler.init(ProtocolHandler.java:843)
at com.sun.messaging.jmq.jmsclient.ProtocolHandler.(ProtocolHandler.java:1562)
at com.sun.messaging.jmq.jmsclient.ConnectionImpl.openConnection(ConnectionImpl.java:2427)
at com.sun.messaging.jmq.jmsclient.ConnectionImpl.init(ConnectionImpl.java:1108)
at com.sun.messaging.jmq.jmsclient.ConnectionImpl.(ConnectionImpl.java:459)
at com.sun.messaging.jmq.jmsclient.UnifiedConnectionImpl.(UnifiedConnectionImpl.java:66)
at com.sun.messaging.jmq.jmsclient.XAConnectionImpl.(XAConnectionImpl.java:64)
at com.sun.messaging.XAConnectionFactory.createXAConnection(XAConnectionFactory.java:97)
at com.sun.messaging.jms.ra.ManagedConnection.(ManagedConnection.java:196)
... 22 more
Caused by: java.lang.NumberFormatException: For input string: "
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:481)
at java.lang.Integer.parseInt(Integer.java:527)
at com.sun.messaging.jmq.io.PortMapperTable.read(PortMapperTable.java:277)
at com.sun.messaging.jmq.jmsclient.PortMapperClient.readBrokerPorts(PortMapperClient.java:243)
... 39 more

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
David Zhao

Hi Andy,

If you want to connect to a 3rd party JMS provider from glassfish, please try Generic JMSRA (http://genericjmsra.java.net/). The embedded JMSRA in glassfish is for connecting to glassfish MQ only.

Thanks,
David Zhao

> -----Original Message-----
> From: Andreas Junius [mailto:AJunius@internode.com.au]
> Sent: Thursday, December 20, 2012 9:23 AM
> To: users@glassfish.java.net
> Subject: How to connect to remote JMS
>
> Hi all,
>
> I try to setup a jms connection factory to a TIBCO EMS on a remote
> machine.
>
> The resource type is javax.jms.ConnectionFactory
>
> Pool settings default, no transaction. I added also UserName, Password
> and AddressList (Format: dev-esb:7222).
>
> However it does not work. If I try to connect (or ping) I'll get the
> following exception:
>
> WARNING: [C4003]: Error occurred on connection creation [dev-esb:7222].
> - cause: java.lang.NumberFormatException: For input string: "
>
> I can easily connect to the JMS programmatically, so I'm sure it works.
> The only difference is, that the code uses a TIBCO class for the
> factory: TibjmsQueueConnectionFactory
>
>
> Is this a bug or did I forget any important settings? What's the
> precise procedure to connect to a remote JMS?
>
> Cheers,
> Andy
>
>
> The exception:
>
> Dec 20, 2012 9:42:15 AM org.hibernate.validator.internal.util.Version
>
> INFO: HV000001: Hibernate Validator 4.3.0.Final Dec 20, 2012 9:42:16 AM
> com.sun.messaging.jms.ra.ResourceAdapter start
> INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter: Version:
> 4.5.2 Patch 1 (Build 3-d) Compile: Thu Jun 7 10:46:15 PDT 2012 Dec
> 20, 2012 9:42:16 AM com.sun.messaging.jms.ra.ResourceAdapter start
> INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter starting:
> broker is REMOTE, connection mode is TCP Dec 20, 2012 9:42:16 AM
> com.sun.messaging.jms.ra.ResourceAdapter start
> INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter Started:REMOTE
> Dec 20, 2012 9:42:16 AM
> com.sun.messaging.jmq.jmsclient.ExceptionHandler
> throwConnectionException
> WARNING: [C4003]: Error occurred on connection creation
> [10.20.13.131:7222]. - cause: java.lang.NumberFormatException: For
> input string: "
>
> com.sun.messaging.jms.JMSException: [C4003]: Error occurred on
> connection creation [10.20.13.131:7222]. - cause:
> java.lang.NumberFormatException: For input string: "
> at
> com.sun.messaging.jmq.jmsclient.ExceptionHandler.throwConnectionExcepti
> on(ExceptionHandler.java:280)
> at
> com.sun.messaging.jmq.jmsclient.ExceptionHandler.handleConnectException
> (ExceptionHandler.java:226)
> at
> com.sun.messaging.jmq.jmsclient.PortMapperClient.readBrokerPorts(PortMa
> pperClient.java:262)
> at
> com.sun.messaging.jmq.jmsclient.PortMapperClient.init(PortMapperClient.
> java:156)
> at
> com.sun.messaging.jmq.jmsclient.PortMapperClient.(PortMapperClien
> t.java:98)
> at
> com.sun.messaging.jmq.jmsclient.protocol.tcp.TCPConnectionHandler. >(TCPConnectionHandler.java:168)
> at
> com.sun.messaging.jmq.jmsclient.protocol.tcp.TCPStreamHandler.openConne
> ction(TCPStreamHandler.java:141)
> at
> com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnection(Co
> nnectionInitiator.java:785)
> at
> com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnectionNew
> (ConnectionInitiator.java:260)
> at
> com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnection(Co
> nnectionInitiator.java:214)
> at
> com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnection(Co
> nnectionInitiator.java:164)
> at
> com.sun.messaging.jmq.jmsclient.ProtocolHandler.init(ProtocolHandler.ja
> va:843)
> at
> com.sun.messaging.jmq.jmsclient.ProtocolHandler.(ProtocolHandler.
> java:1562)
> at
> com.sun.messaging.jmq.jmsclient.ConnectionImpl.openConnection(Connectio
> nImpl.java:2427)
> at
> com.sun.messaging.jmq.jmsclient.ConnectionImpl.init(ConnectionImpl.java
> :1108)
> at
> com.sun.messaging.jmq.jmsclient.ConnectionImpl.(ConnectionImpl.ja
> va:459)
> at
> com.sun.messaging.jmq.jmsclient.UnifiedConnectionImpl.(UnifiedCon
> nectionImpl.java:66)
> at
> com.sun.messaging.jmq.jmsclient.XAConnectionImpl.(XAConnectionImp
> l.java:64)
> at
> com.sun.messaging.XAConnectionFactory.createXAConnection(XAConnectionFa
> ctory.java:97)
> at
> com.sun.messaging.jms.ra.ManagedConnection.(ManagedConnection.jav
> a:196)
> at
> com.sun.messaging.jms.ra.ManagedConnectionFactory.createManagedConnecti
> on(ManagedConnectionFactory.java:226)
> at
> com.sun.enterprise.resource.allocator.NoTxConnectorAllocator.createReso
> urce(NoTxConnectorAllocator.java:128)
> at
> com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(Co
> nnectionPool.java:907)
> at
> com.sun.enterprise.resource.pool.ConnectionPool.createResource(Connecti
> onPool.java:1189)
> at
> com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure.addR
> esource(RWLockDataStructure.java:98)
> at
> com.sun.enterprise.resource.pool.ConnectionPool.addResource(ConnectionP
> ool.java:282)
> at
> com.sun.enterprise.resource.pool.ConnectionPool.createResourceAndAddToP
> ool(ConnectionPool.java:1512)
> at
> com.sun.enterprise.resource.pool.ConnectionPool.createResources(Connect
> ionPool.java:944)
> at
> com.sun.enterprise.resource.pool.ConnectionPool.initPool(ConnectionPool
> .java:230)
> at
> com.sun.enterprise.resource.pool.ConnectionPool.internalGetResource(Con
> nectionPool.java:511)
> at
> com.sun.enterprise.resource.pool.ConnectionPool.getResource(ConnectionP
> ool.java:381)
> at
> com.sun.enterprise.resource.pool.PoolManagerImpl.getResourceFromPool(Po
> olManagerImpl.java:245)
> at
> com.sun.enterprise.resource.pool.PoolManagerImpl.getResource(PoolManage
> rImpl.java:170)
> at
> com.sun.enterprise.connectors.ConnectionManagerImpl.getResource(Connect
> ionManagerImpl.java:338)
> at
> com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnecti
> on(ConnectionManagerImpl.java:301)
> at
> com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(
> ConnectionManagerImpl.java:236)
> at
> com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(
> ConnectionManagerImpl.java:165)
> at
> com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(
> ConnectionManagerImpl.java:160)
> at
> com.sun.messaging.jms.ra.ConnectionFactoryAdapter._allocateConnection(C
> onnectionFactoryAdapter.java:181)
> at
> com.sun.messaging.jms.ra.ConnectionFactoryAdapter.createConnection(Conn
> ectionFactoryAdapter.java:168)
> at
> com.sun.messaging.jms.ra.ConnectionFactoryAdapter.createConnection(Conn
> ectionFactoryAdapter.java:150)
> at info.junius.GFMessageSender.main(GFMessageSender.java:22)
> Caused by: java.lang.NumberFormatException: For input string: "
> at
> java.lang.NumberFormatException.forInputString(NumberFormatException.ja
> va:65)
> at java.lang.Integer.parseInt(Integer.java:481)
> at java.lang.Integer.parseInt(Integer.java:527)
> at
> com.sun.messaging.jmq.io.PortMapperTable.read(PortMapperTable.java:277)
> at
> com.sun.messaging.jmq.jmsclient.PortMapperClient.readBrokerPorts(PortMa
> pperClient.java:243)
> ... 39 more
> Dec 20, 2012 9:42:57 AM
> com.sun.enterprise.resource.allocator.NoTxConnectorAllocator
> createResource
> WARNING: RAR5038:Unexpected exception while creating resource for pool
> jms/iiNetTibcoConnectionFactory. Exception :
> javax.resource.spi.ResourceAdapterInternalException: MQJMSRA_MC4001:
> constructor:Aborting:JMSException on createConnection=[C4003]: Error
> occurred on connection creation [10.20.13.131:7222]. - cause:
> java.lang.NumberFormatException: For input string: "
> at
> com.sun.messaging.jmq.jmsclient.ExceptionHandler.throwConnectionExcepti
> on(ExceptionHandler.java:280)
> at
> com.sun.messaging.jmq.jmsclient.ExceptionHandler.handleConnectException
> (ExceptionHandler.java:226)
> at
> com.sun.messaging.jmq.jmsclient.PortMapperClient.readBrokerPorts(PortMa
> pperClient.java:262)
> at
> com.sun.messaging.jmq.jmsclient.PortMapperClient.init(PortMapperClient.
> java:156)
> at
> com.sun.messaging.jmq.jmsclient.PortMapperClient.(PortMapperClien
> t.java:98)
> at
> com.sun.messaging.jmq.jmsclient.protocol.tcp.TCPConnectionHandler. >(TCPConnectionHandler.java:168)
> at
> com.sun.messaging.jmq.jmsclient.protocol.tcp.TCPStreamHandler.openConne
> ction(TCPStreamHandler.java:141)
> at
> com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnection(Co
> nnectionInitiator.java:785)
> at
> com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnectionNew
> (ConnectionInitiator.java:260)
> at
> com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnection(Co
> nnectionInitiator.java:214)
> at
> com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnection(Co
> nnectionInitiator.java:164)
> at
> com.sun.messaging.jmq.jmsclient.ProtocolHandler.init(ProtocolHandler.ja
> va:843)
> at
> com.sun.messaging.jmq.jmsclient.ProtocolHandler.(ProtocolHandler.
> java:1562)
> at
> com.sun.messaging.jmq.jmsclient.ConnectionImpl.openConnection(Connectio
> nImpl.java:2427)
> at
> com.sun.messaging.jmq.jmsclient.ConnectionImpl.init(ConnectionImpl.java
> :1108)
> at
> com.sun.messaging.jmq.jmsclient.ConnectionImpl.(ConnectionImpl.ja
> va:459)
> at
> com.sun.messaging.jmq.jmsclient.UnifiedConnectionImpl.(UnifiedCon
> nectionImpl.java:66)
> at
> com.sun.messaging.jmq.jmsclient.XAConnectionImpl.(XAConnectionImp
> l.java:64)
> at
> com.sun.messaging.XAConnectionFactory.createXAConnection(XAConnectionFa
> ctory.java:97)
> at
> com.sun.messaging.jms.ra.ManagedConnection.(ManagedConnection.jav
> a:196)
> ... 22 more
> Caused by: java.lang.NumberFormatException: For input string: "
> at
> java.lang.NumberFormatException.forInputString(NumberFormatException.ja
> va:65)
> at java.lang.Integer.parseInt(Integer.java:481)
> at java.lang.Integer.parseInt(Integer.java:527)
> at
> com.sun.messaging.jmq.io.PortMapperTable.read(PortMapperTable.java:277)
> at
> com.sun.messaging.jmq.jmsclient.PortMapperClient.readBrokerPorts(PortMa
> pperClient.java:243)
> ... 39 more
>
>
>
>
>