将远程 JMS 客户端连接到 GlassFish 3
我正在尝试从独立的远程客户端连接到 GlassFish 3 的 JMS 服务。但是我收到 java.lang.ClassNotFoundException: com.sun.messaging.jms.ra.ResourceAdapter。关于如何解决这个问题有什么想法吗?
这是我到目前为止的设置:
本地模式下的 Glassfish 3 JMS 服务(我假设嵌入模式在这种情况下不起作用,因为它绕过网络堆栈)
JNDI 属性指定如下:
java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory java.naming.factory.url.pkgs=com.sun.enterprise.naming java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl
gf-client-module.jar(在 GLASSFISH_HOME/modules 中)已添加到独立应用程序的类路径中。还尝试添加模块目录中存在的其他 jar(例如 jms-core.jar),但仍然得到相同的 ClassNotFoundException。
任何帮助将不胜感激。
I am trying to connect to GlassFish 3's JMS service from a standalone remote client. However I am getting a java.lang.ClassNotFoundException: com.sun.messaging.jms.ra.ResourceAdapter. Any ideas on how to fix this?
Here's my setup so far:
Glassfish 3 JMS Service in LOCAL mode (I am assuming that EMBEDED mode will not work in this case because it bypasses the network stack)
JNDI properties are specified as follows:
java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory
java.naming.factory.url.pkgs=com.sun.enterprise.naming
java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImplgf-client-module.jar (in GLASSFISH_HOME/modules) added to the standalone application's classpath. Also tried adding other jars present in the modules directory (such as jms-core.jar), but still getting the same ClassNotFoundException.
Any help would be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
首选方法是使用 gf-client.jar 文件,而不是使用您可能需要的所有单独的 Glassfish jar 文件(例如 gf-client-module.jar、imqjmsra.jar 和 imqbroker.jar)。它可以在 $GLASSFISH_HOME/lib 中找到。
有关详细信息,请访问 http://glassfish.java.net/javaee5/ejb/ EJB_FAQ.html#StandaloneRemoteEJB。该文档涉及在独立客户端中使用 EJB,但使用 JMS 的解决方案是相同的。
Instead of using all of the individual Glassfish jar files that you might need (such as gf-client-module.jar, imqjmsra.jar, and imqbroker.jar), the preferred method is to use the gf-client.jar file. It can be found at $GLASSFISH_HOME/lib.
There is more information at http://glassfish.java.net/javaee5/ejb/EJB_FAQ.html#StandaloneRemoteEJB. That document pertains to using EJBs in standalone clients, but the solution is the same for using JMS.
好的。我找到了解决方案。请参阅此处 有关详细信息,但简短的答案是我需要将两个 jar 添加到类路径中:imqjmsra.jar 和 imqbroker.jar。这些可以在名为 imqjmsra.rar 的 rar 中找到,可以在 glassfish 的 mq 目录下找到。我必须从这个 rar 中提取两个罐子!
Ok. I found a solution. See here for details, but the short answer is that I needed to add two jars to the classpath: imqjmsra.jar and imqbroker.jar. These were available inside a rar called imqjmsra.rar which can be found under glassfish's mq directory. I had to extract the two jars from this rar!
这是 glassfish 3 的客户端 jar 的完整列表:
This is the complete list of client jars for glassfish 3 :
正如 Ivan A Krizsan 的 EJB 认证说明中提到的,根据 Glassfish 版本,这应该足够了:
As mentioned in the Ivan A Krizsan's notes for the EJB certification, and depending on the Glassfish version, this should be enough: