简体   繁体   中英

JMS client connecting to JBoss 6 AS exception

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.

This resolved exactly the same issue for me.


 <dependency>
        <groupId>jboss</groupId>
        <artifactId>jboss-aop-jdk50-client</artifactId>
        <version>4.2.2.GA</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.netty</groupId>
        <artifactId>netty</artifactId>
        <version>3.2.3.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hornetq</groupId>
        <artifactId>hornetq-jms-client</artifactId>
        <version>2.2.5.Final</version>
    </dependency> 
    <dependency>
        <groupId>org.hornetq</groupId>
        <artifactId>hornetq-core</artifactId>
        <version>2.2.5.Final</version>
    </dependency>

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM