【问题标题】:Junit with Embedded Glassfish fails - JMS Resource Adapter should be EMBEDDED带有嵌入式 Glassfish 的 Junit 失败 - 应嵌入 JMS 资源适配器
【发布时间】:2010-05-13 06:55:32
【问题描述】:

我正在尝试测试会话 bean(NetBeans 6.8,Glassfish V3)。不幸的是,嵌入式 glassfish 无法正常启动,因为它试图连接到远程 JMS 提供程序(在 localhost:7676):

$ ant test
...
[junit] Mar 23, 2010 12:13:51 PM com.sun.messaging.jms.ra.ResourceAdapter start
[junit] INFO: MQJMSRA_RA1101: SJSMQ JMS Resource Adapter starting: REMOTE
[junit] Mar 23, 2010 12:13:51 PM com.sun.messaging.jmq.jmsclient.ExceptionHandler throwConnectionException
[junit] WARNING: [C4003]: Error occurred on connection creation [localhost:7676]. - cause: java.net.ConnectException: Connection refused

错误本身是正确的,因为没有(其他)JMS 提供程序正在运行。我期待嵌入式 glassfish 以 EMBEDDED 模式启动 JMS 提供程序。

我的测试使用 javax.ejb.embeddable.EJBContainer :

@BeforeClass
public static void initContainer() throws Exception {
    ec = EJBContainer.createEJBContainer();
    ctx = ec.getContext();
}

当我正常启动 glassfish 时,就没事了:

$ bin/asadmin get server.jms-service.type
server.jms-service.type=EMBEDDED

如何让我的 junit 测试将嵌入式 glassfish 与嵌入式 JMS 提供程序一起使用?

【问题讨论】:

    标签: junit glassfish jms glassfish-3


    【解决方案1】:

    好的,我从here 下载了一个正式的 glassfish 版本 (v3.0.1),现在它按预期启动了 JMS Provider EMBEDDED。

    【讨论】:

      猜你喜欢
      • 2012-07-02
      • 2012-07-02
      • 2011-10-30
      • 2011-10-08
      • 1970-01-01
      • 2018-04-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多