开发者

Junit with Embedded Glassfish fails - JMS Resource Adapter should be EMBEDDED

开发者 https://www.devze.com 2022-12-24 01:32 出处:网络
I\'m trying to test a session bean (NetBeans 6.8, Glassfish V3). Unfortunately, the embedded glassfish is unable to start properly, as it tries to connect to a remote JMS Provider (at localhost:7676):

I'm trying to test a session bean (NetBeans 6.8, Glassfish V3). Unfortunately, the embedded glassfish is unable to start properly, as it tries to connect to a remote JMS Provider (at 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

The error is in itself correct, as no (other) JMS provider is running. I was expecting the embedded glassfish to sta开发者_如何学JAVArt the JMS provider in EMBEDDED mode.

My test uses javax.ejb.embeddable.EJBContainer :

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

When I start glassfish normally, it's fine:

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

How can I get my junit tests to use an embedded glassfish with an EMBEDDED JMS Provider?


Ok, I downloaded an official glassfish build (v3.0.1) from here, and now it's starting the JMS Provider EMBEDDED as expected.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号