users@glassfish.java.net

Embedded GlassFish ORB

From: <Torsten.Scharf_at_t-systems.com>
Date: Mon, 27 Aug 2012 14:24:03 +0200

Hello,


I am trying to use EmbeddedGlassfish for unit tests, when running the testcase I am getting an error when stating glassfish. It looks like that glassfish don't start the ORB? I don't have found a proper solution for me in the net, can you help me?

GlassFish Version: GlassFish Server Open Source Edition 3.1.2.2 (build 5)
Using Local EJBs, CDI and WebServices

...
INFO: SEC1002: Security Manager is OFF.
27.08.2012 14:00:31 com.sun.enterprise.security.SecurityLifecycle onInitialization
INFO: SEC1010: Entering Security Startup Service
27.08.2012 14:00:31 com.sun.enterprise.security.PolicyLoader loadPolicy
INFO: SEC1143: Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper.
27.08.2012 14:00:31 com.sun.enterprise.security.auth.realm.Realm doInstantiate
INFO: SEC1115: Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
27.08.2012 14:00:31 com.sun.enterprise.security.auth.realm.Realm doInstantiate
INFO: SEC1115: Realm [file] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
27.08.2012 14:00:31 com.sun.enterprise.security.auth.realm.Realm doInstantiate
INFO: SEC1115: Realm [certificate] of classtype [com.sun.enterprise.security.auth.realm.certificate.CertificateRealm] successfully created.
27.08.2012 14:00:31 com.sun.enterprise.security.SecurityLifecycle onInitialization
INFO: SEC1011: Security Service(s) Started Successfully
27.08.2012 14:00:31 org.glassfish.webservices.metroglue.MetroContainer postConstruct
INFO: WS10010: Web service endpoint deployment events listener registered successfully.org.omg.CORBA.COMM_FAILURE: FEIN: IOP00410001: Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: localhost; port: 3700 vmcid: OMG minor code: 1 completed: No
...
Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused: connect
        at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:339)
        at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:242)
        ... 56 more
Caused by: java.net.ConnectException: Connection refused: connect
        at sun.nio.ch.Net.connect(Native Method)
        at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:500)
        at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:110)
        at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:324)
        ... 57 more
...


Unit-Test:
...
// System.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
// System.setProperty("org.omg.CORBA.ORBInitialHost", "0.0.0.0");

final Map<String, Object> properties = new HashMap<String, Object>();
final String domain = PropertyProvider.INSTANCE.getString("domain.dir") + "/" + PropertyProvider.INSTANCE.getString("domain.name");
properties.put(EJBContainer.MODULES, new File("../eshop/dist/eshop.ear"));
properties.put("org.glassfish.ejb.embedded.glassfish.installation.root", PropertyProvider.INSTANCE.getString("glassfish.home"));
properties.put("org.glassfish.ejb.embedded.glassfish.instance.root", domain);
properties.put("org.glassfish.ejb.embedded.glassfish.configuration.file", domain + "/config/domain.xml");

BaseAccessTest.ejbContainer = EJBContainer.createEJBContainer(properties);
Assert.assertNotNull(BaseAccessTest.ejbContainer);
...



domain.xml:
...
      <iiop-service>
        <orb use-thread-pool-ids="thread-pool-1"></orb>
        <iiop-listener port="3700" id="orb-listener-1" address="0.0.0.0" lazy-init="false"></iiop-listener>
      </iiop-service>
...
or
...
      <iiop-service>
        <orb use-thread-pool-ids="thread-pool-1"></orb>
        <iiop-listener port="3700" id="orb-listener-1" address="0.0.0.0" lazy-init="true"></iiop-listener>
      </iiop-service>
...



Greetings,
Torsten Scharf