将远程 JMS 客户端连接到 GlassFish 3

发布于 2024-10-27 19:43:38 字数 678 浏览 7 评论 0原文

我正在尝试从独立的远程客户端连接到 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.JNDIStateFactoryImpl

  • gf-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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

末蓝 2024-11-03 19:43:38

首选方法是使用 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.

十二 2024-11-03 19:43:38

好的。我找到了解决方案。请参阅此处 有关详细信息,但简短的答案是我需要将两个 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!

太阳男子 2024-11-03 19:43:38

这是 glassfish 3 的客户端 jar 的完整列表:

auto-depends.jar
deployment-common.jar
glassfish-corba-internal-api.jar    
internal-api.jar
management-api.jar
bean-validator.jar
dol.jar
glassfish-corba-newtimer.jar        
javax.ejb.jar
orb-connector.jar
common-util.jar
ejb-container.jar
glassfish-corba-omgapi.jar      
javax.jms.jar
orb-iiop.jar
config-api.jar
ejb.security.jar
glassfish-corba-orb.jar
javax.resource.jar
security.jar
config-types.jar
glassfish-api.jar
glassfish-corba-orbgeneric.jar      
javax.servlet.jar
ssl-impl.jar
config.jar
glassfish-corba-asm.jar
glassfish-naming.jar
javax.transaction.jar
transaction-internal-api.jar
connectors-internal-api.jar     
glassfish-corba-codegen.jar     
gmbal.jar
jta.jar
container-common.jar
glassfish-corba-csiv2-idl.jar       
hk2-core.jar
kernel.jar

This is the complete list of client jars for glassfish 3 :

auto-depends.jar
deployment-common.jar
glassfish-corba-internal-api.jar    
internal-api.jar
management-api.jar
bean-validator.jar
dol.jar
glassfish-corba-newtimer.jar        
javax.ejb.jar
orb-connector.jar
common-util.jar
ejb-container.jar
glassfish-corba-omgapi.jar      
javax.jms.jar
orb-iiop.jar
config-api.jar
ejb.security.jar
glassfish-corba-orb.jar
javax.resource.jar
security.jar
config-types.jar
glassfish-api.jar
glassfish-corba-orbgeneric.jar      
javax.servlet.jar
ssl-impl.jar
config.jar
glassfish-corba-asm.jar
glassfish-naming.jar
javax.transaction.jar
transaction-internal-api.jar
connectors-internal-api.jar     
glassfish-corba-codegen.jar     
gmbal.jar
jta.jar
container-common.jar
glassfish-corba-csiv2-idl.jar       
hk2-core.jar
kernel.jar
白色秋天 2024-11-03 19:43:38

正如 Ivan A Krizsan 的 EJB 认证说明中提到的,根据 Glassfish 版本,这应该足够了:

  • GlassFish 3(还有 GlassFish 4,我刚刚测试过):$GLASSFISH_HOME/lib/gf-client。 jar
  • GlassFish 2:$GLASSFISH_HOME/lib/appserv-rt.jar 和 $APS_HOME/lib/javaee.jar

As mentioned in the Ivan A Krizsan's notes for the EJB certification, and depending on the Glassfish version, this should be enough:

  • GlassFish 3 (and GlassFish 4 too, I've just tested it): $GLASSFISH_HOME/lib/gf-client.jar
  • GlassFish 2: $GLASSFISH_HOME/lib/appserv-rt.jar and $APS_HOME/lib/javaee.jar
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文