-
Bug
-
Resolution: Can't Do
-
Major
-
None
-
JBossAS-4.2.1.GA
Our product (Websphere Message Broker) integrates with several JMS providers. We recently got a customer reporting excepetions on JBoss 4.2.1 which we tracked down to be during JNDI lookup of the JMS Destinations from JBoss. It turns out that if the threads classloader is a URLClassLoader and any of its URLs contain a space then the following exception is observed:
javax.naming.CommunicationException [Root exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.net.MalformedURLException: no protocol: files/jboss/jboss-4.2.1.GA/client/blah.jar]
com.ibm.mqst.broker.jmsService.BrokerJMSService::handleNamingException: Rethrowing for application level handling
javax.naming.CommunicationException [Root exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.net.MalformedURLException: no protocol: files/jboss/jboss-4.2.1.GA/client/blah.jar]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:724)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
at javax.naming.InitialContext.lookup(InitialContext.java:363)
at com.ibm.mqst.broker.jmsService.BrokerJMSService.<init>(BrokerJMSService.java:402)
at com.ibm.mqst.broker.jmsService.JBossConnector.main(JBossConnector.java:52)
Caused by: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.net.MalformedURLException: no protocol: files/jboss/jboss-4.2.1.GA/client/blah.jar
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:341)
at sun.rmi.transport.Transport$1.run(Transport.java:171)
at java.security.AccessController.doPrivileged(AccessController.java:284)
at sun.rmi.transport.Transport.serviceCall(Transport.java:167)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:547)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:802)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:661)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:896)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:735)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:263)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:239)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:141)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
... 4 more
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.net.MalformedURLException: no protocol: files/jboss/jboss-4.2.1.GA/client/blah.jar
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:298)
at sun.rmi.transport.Transport$1.run(Transport.java:171)
at java.security.AccessController.doPrivileged(AccessController.java:284)
at sun.rmi.transport.Transport.serviceCall(Transport.java:167)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:547)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:802)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:661)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:896)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:735)
Caused by: java.net.MalformedURLException: no protocol: files/jboss/jboss-4.2.1.GA/client/blah.jar
at java.lang.Throwable.<init>(Throwable.java:67)
at java.net.URL.<init>(URL.java:489)
at java.net.URL.<init>(URL.java:464)
at java.net.URL.<init>(URL.java:413)
at sun.rmi.server.LoaderHandler.pathToURLs(LoaderHandler.java:751)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:147)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:631)
at org.jboss.system.JBossRMIClassLoader.loadClass(JBossRMIClassLoader.java:91)
at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:258)
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:209)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1586)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1507)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1743)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1340)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:362)
at javax.naming.CompoundName.readObject(CompoundName.java:796)
at sun.reflect.GeneratedMethodAccessor70.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:599)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:985)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1860)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1764)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1340)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:362)
at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:318)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:295)
... 9 more
The customer was able to recreate outside the broker using the following code:
URL[] urls = new URL[4];
try
catch (MalformedURLException e1)
{ // TODO Auto-generated catch block System.println("Malformed URI for JRE"); e1.printStackTrace(); System.exit(-1); } URLClassLoader cl = new URLClassLoader(urls);
Thread.currentThread().setContextClassLoader(cl);
Hashtable environment = new Hashtable();
environment.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
environment.put(Context.PROVIDER_URL, "jnp://server_address:1099");
environment.put(Context.REFERRAL, "throw");
try
catch(Exception e)
{ //this is where we catch the NamingException e.printStackTrace(); }Escaping the spaces resolves problem ie/
urls[0] = file1.toURI().toURL();
We will be using this workaround in our product so impact can be considered small.