Junit with Embedded Glassfish fails - JMS Resource Adapter should be EMBEDDED
Posted
by Hank
on Stack Overflow
See other posts from Stack Overflow
or by Hank
Published on 2010-03-23T11:26:01Z
Indexed on
2010/03/23
11:43 UTC
Read the original article
Hit count: 879
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 start 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?
© Stack Overflow or respective owner