Right now I’m getting this exception from a simple JMS client I wrote to just test to see if I can connect to the JBoss JMS. Here is the snippet of my code below:
Properties props = new Properties();
props.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
props.setProperty("java.naming.provider.url", url_);
Context context = new InitialContext(props);
System.out.println("performing lookup...");
Object tmp = context.lookup("/ConnectionFactory");
System.out.println("lookup completed, making topic");
TopicConnectionFactory tcf = (TopicConnectionFactory) tmp;
conn = tcf.createTopicConnection();
topic = (Topic) context.lookup(name_);
session = conn.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
conn.start();
TopicSubscriber recv = session.createSubscriber(topic);
recv.setMessageListener(this);
I have the following jars:
jms.jar (I got this from outside the JBoss distro)
jbossall-client.jar
log4j.jar
jboss-logging.jar
javax.jms.jar (I got this from outside the JBoss distro)
jnpserver.jar
jboss-common-core.jar
I get the following exception:
javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: org.hornetq.jms.referenceable.SerializableObjectRefAddr (no security manager: RMI class loader disabled)]
This is being run locally, also it seems it’s connecting to the JBoss server just that it’s throwing this exception.
To anybody interested I was able to solve this by adding a few more jar files to my classpath. Also the problem was that I didn’t have a security manager in place.
hornetq-jms.jar
hornetq-logging.jar
hornetq-bootstrap.jar
hornetq-core.jar
hornetq-jboss-as-integration.jar
jboss-as-hornetq-int.jar
netty.jar
This jar files can be found with the JBoss distribution.