ari-ban / glassfish-genericjmsra

0 stars 0 forks source link

imqAddressList doesn't get parsed properly when passed to resource adapter config #50

Closed arinban closed 11 years ago

arinban commented 13 years ago

Steps to reproduce the problem

1. Set the imqAddressList to mq://localhost:7777,mq://localhost:7778 2. Pass the imqAddressList property to the ConnectionFactoryProperties when creating resource adapter config. 3. Deploy genericra.rar in glassfishv3.1 4. Deploy mdb. 5. MDB deployment fails with the following error:

[#|2011-04-08T13:46:22.906-0700|SEVERE|glassfish3.1|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=79;_ThreadName=Thread-1;|Exception while loading the app|#]

[#|2011-04-08T13:46:22.929-0700|SEVERE|glassfish3.1|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=79;_ThreadName=Thread-1;|Exception while loading the app : EJB Container initialization error java.lang.Exception at com.sun.enterprise.connectors.inbound.ConnectorMessageBeanClient.setup(ConnectorMessageBeanClient.java:233) at com.sun.ejb.containers.MessageBeanContainer.(MessageBeanContainer.java:204) at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:121) at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:234) at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:290) at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:101) at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:186) at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:249) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240) at org.glassfish.deployment.admin.InstanceDeployCommand.execute(InstanceDeployCommand.java:186) at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1067) at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1247) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235) at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:465) at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:222) at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168) at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:234) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) at com.sun.grizzly.ContextTask.run(ContextTask.java:71) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) at java.lang.Thread.run(Thread.java:662) Caused by: javax.resource.ResourceException: [C4038]: java.net.MalformedURLException: Stream handler unavailable due to: For input string: "7777\" at com.sun.genericra.util.ExceptionUtils.newResourceException(ExceptionUtils.java:73) at com.sun.genericra.inbound.sync.SyncJmsResourcePool.initialize(SyncJmsResourcePool.java:169) at com.sun.genericra.inbound.sync.SyncConsumer.initialize(SyncConsumer.java:70) at com.sun.genericra.inbound.sync.SyncConsumer.start(SyncConsumer.java:75) at com.sun.genericra.GenericJMSRA.endpointActivation(GenericJMSRA.java:216) at com.sun.enterprise.connectors.inbound.ConnectorMessageBeanClient.setup(ConnectorMessageBeanClient.java:225) ... 35 more Caused by: com.sun.messaging.jms.JMSException: [C4038]: java.net.MalformedURLException: Stream handler unavailable due to: For input string: "7777\" at com.sun.messaging.jmq.jmsclient.ExceptionHandler.getJMSException(ExceptionHandler.java:386) at com.sun.messaging.jmq.jmsclient.ExceptionHandler.handleException(ExceptionHandler.java:337) at com.sun.messaging.jmq.jmsclient.ConnectionImpl.init(ConnectionImpl.java:1107) at com.sun.messaging.jmq.jmsclient.ConnectionImpl.(ConnectionImpl.java:442) at com.sun.messaging.jmq.jmsclient.UnifiedConnectionImpl.(UnifiedConnectionImpl.java:66) at com.sun.messaging.jmq.jmsclient.QueueConnectionImpl.(QueueConnectionImpl.java:65) at com.sun.messaging.jmq.jmsclient.XAQueueConnectionImpl.(XAQueueConnectionImpl.java:65) at com.sun.messaging.XAConnectionFactory.createXAQueueConnection(XAConnectionFactory.java:138) at com.sun.messaging.XAConnectionFactory.createXAQueueConnection(XAConnectionFactory.java:115) at com.sun.genericra.inbound.AbstractJmsResourcePool.createXAConnection(AbstractJmsResourcePool.java:105) at com.sun.genericra.inbound.sync.SyncJmsResourcePool.initialize(SyncJmsResourcePool.java:131) ... 39 more Caused by: java.net.MalformedURLException: Stream handler unavailable due to: For input string: "7777\" at java.net.URL.(URL.java:601) at java.net.URL.(URL.java:464) at java.net.URL.(URL.java:413) at com.sun.messaging.jmq.io.MQAddress.parseHostPort(MQAddress.java:205) at com.sun.messaging.jmq.io.MQAddress.parseAndValidate(MQAddress.java:143) at com.sun.messaging.jmq.io.MQAddress.initialize(MQAddress.java:89) at com.sun.messaging.jmq.jmsclient.MQAddress.createMQAddress(MQAddress.java:96) at com.sun.messaging.jmq.jmsclient.MQAddressList.createMQAddress(MQAddressList.java:65) at com.sun.messaging.jmq.jmsclient.MQAddressList.createMQAddressList(MQAddressList.java:74) at com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createAddressList(ConnectionInitiator.java:519) at com.sun.messaging.jmq.jmsclient.ConnectionInitiator.init(ConnectionInitiator.java:158) at com.sun.messaging.jmq.jmsclient.ConnectionInitiator.(ConnectionInitiator.java:109) at com.sun.messaging.jmq.jmsclient.ConnectionImpl.init(ConnectionImpl.java:1055) ... 47 more

| #] |

-Sarada

Affected Versions

[2.1a]

arinban commented 6 years ago
arinban commented 13 years ago

@glassfishrobot Commented Reported by saradak

arinban commented 13 years ago

@glassfishrobot Commented nigeldeakin said: Simple test case which uses a copy of com.sun.genericra.util.ObjectBuilder.parseToProperties() (which invokes com.sun.genericra.util.CustomTokenizer) to demonstrate that happens when various string are parsed.

The basic issue is that the GenericJMSRA connection factory property ConnectionFactoryProperties is expected to be a comma-separated list of name=value pairs, each of which needs to be passed to the underlying MQ connection factory.

If the string supplied to this method is imqAddressList=mq://localhost:7777,mq://localhost:7778 then the tokenizer splits this into (1) name imqAddressList=mq://localhost:7777 and (2) mq://localhost:7778

which causes an error because (2) isn't a name-value pair.

If we try to escape the comma as Sarada did with a backslash, and pass in imqAddressList=mq://localhost:7777\,mq://localhost:7778 (in the test case we need to escape the \ with an additional \ since \ is an escape character in Java string constants) then the tokenizer ignores the comma and split it into a single name-value pair: imqAddressList=mq://localhost:7777\,mq://localhost:7778

which causes an error because mq://localhost:7777\,mq://localhost:7778 is not a valid setting for imqAddressList.

I think the solution is to change ObjectBuilder.parseToProperties() to remove escape characters after tokenization by changing

tokenList.nextToken() to tokenList.nextTokenWithoutEscapeAndQuoteChars

However this needs careful consideration to make sure that this doesn't break other use cases.

arinban commented 12 years ago

@glassfishrobot Commented ahe said: Changing tokenList.nextToken() to tokenList.nextTokenWithoutEscapeAndQuoteChars() did work for me with a tibco URL that contained a colon.

arinban commented 11 years ago

@glassfishrobot Commented simeng_oracle said: Fix at revision 231

arinban commented 13 years ago

@glassfishrobot Commented File: GRARokenizationtest.java Attached By: nigeldeakin

arinban commented 13 years ago

@glassfishrobot Commented Was assigned to simeng_oracle

arinban commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA GENERICJMSRA-50

arinban commented 11 years ago

@glassfishrobot Commented Marked as fixed on Thursday, January 17th 2013, 12:12:34 am