I have a local JBOSSMQ running on my machine with one Queue and one Topic Configured
I have a remote JBOSSMQ running on another machine with identical Queues and Topic configured
I have a requirement where a
servlet running on either or the above
JBOSS servers should be able to post messages to JBOSSMQ on the remote server and be able to register as listeners to remote topics.
I have the following code in plave that creates an initial context
// providerUrl is usually passed at run time which
// will be of the form aaa.bbb.ccc.ddd
ort
String provider=null;
Properties prop = new Properties();
if(providerUrl!=null){
provider = providerUrl;
}
else{
//This points to the JBOSSMQ running on the local
// machine
provider=Constants.JMS_HOST + ":" + Constants.JMS_PORT;
}
if(LOG.isDebugEnabled()){
LOG.debug("[provider]"+provider);
}
prop.put(Context.PROVIDER_URL, provider);
prop.put("java.naming.rmi.security.manager", "yes");
prop.put(Context.INITIAL_CONTEXT_FACTORY, Constants.JMS_CONTEXT_FACTORY);
prop.put(Context.URL_PKG_PREFIXES, Constants.JMS_URL_PKG_PREFIXES);
/*
* Create a JNDI API InitialContext object if none exists
* yet.
*/
try {
jndiContext = new InitialContext(prop);
} catch (NamingException e) {
if (LOG.isErrorEnabled()) {
LOG.error(e.getMessage());
}
}
The code works fine for local JBOSS. But if the providerUrl is remote then I get the following exception10:41:30,323 ERROR [STDERR] java.rmi.ServerException: RemoteException occurred in server
thread; nes
ted exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: org.jnp.interfaces.FastNamingProperties (no security manag
er: RMI class loader disabled)
10:41:30,323 ERROR [STDERR] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:29
2)
10:41:30,323 ERROR [STDERR] at sun.rmi.transport.Transport$1.run(Transport.java:148)
10:41:30,323 ERROR [STDERR] at java.security.AccessController.doPrivileged(Native Method)
10:41:30,323 ERROR [STDERR] at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
10:41:30,323 ERROR [STDERR] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.ja
va:460)
10:41:30,323 ERROR [STDERR] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTrans
port.java:701)
10:41:30,323 ERROR [STDERR] at java.lang.Thread.run(Thread.java:536)
10:41:30,323 ERROR [STDERR] at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(St
reamRemoteCall.java:247)
10:41:30,323 ERROR [STDERR] at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.j
ava:223)
10:41:30,323 ERROR [STDERR] at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
10:41:30,323 ERROR [STDERR] at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
10:41:30,323 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:484)
10:41:30,323 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:463)
10:41:30,355 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:347)
I have jnp-client.jar in WEB-INF/lib which is the FastNamingProperties class
Interestingly , i can access remote JBOSSMQ from a stand alone application.
Some to do with security? Has anybody faced this problem?