![](/img/trans.png)
[英]What are the client libraries to be used with a JMS client connecting to HornetQ/JMS running in Jboss
[英]JMS client connecting to JBoss 6 AS exception
现在我从我编写的一个简单的JMS客户端获得此异常,只是测试我是否可以连接到JBoss JMS。 以下是我的代码片段:
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);
我有以下罐子:jms.jar(我从JBoss发行版外面得到这个)jbossall-client.jar log4j.jar jboss-logging.jar javax.jms.jar(我从JBoss发行版外面得到了这个)jnpserver.jar JBoss的常见-core.jar添加
我得到以下异常:
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)]
这是在本地运行,似乎它连接到JBoss服务器只是因为它抛出了这个异常。
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>
对任何感兴趣的人我都能通过在我的类路径中添加一些jar文件来解决这个问题。 问题还在于我没有安全管理器。
hornetq-jms.jar hornetq-logging.jar hornetq-bootstrap.jar hornetq-core.jar hornetq-jboss-as-integration.jar jboss-as-hornetq-int.jar netty.jar
这个jar文件可以在JBoss发行版中找到。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.