users@glassfish.java.net

JNDI lookup problem in custom security realm

From: <Thomas.Haubold_at_innovations.de>
Date: Tue, 7 Jul 2009 11:30:22 +0200

Hello !

 

I experienced a problem while implementing a custom security realm which
uses a JNDI lookup for getting a DataSource.

Glassfish Version is V2ur2.

 

I performed the DataSource lookup in two ways:

 

dataSource = (DataSource)
ConnectorRuntime.getRuntime().lookupNonTxResource(DS_NAME, false);

 

and

 

Context intialContext = new InitialContext();

dataSource = (com.sun.appserv.jdbc.DataSource)
intialContext.lookup(DS_NAME);

 

If I execute this code lazy just when the first connection is needed and
glassfish start-up is done both works perfectly.

But if I try to execute this code right in the init method of the realm
(which then runs nearly right in the beginning of the startup of
Glassfish),

both fails with the following Exceptions:

 

Caused by: javax.naming.CommunicationException: Can't find
SerialContextProvider [Root exception is java.lang.RuntimeException:
org.omg.CORBA.OBJ_ADAPTER: vmcid: SUN minor code: 202 completed: No]

at
com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:1
65)

at
com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)

at javax.naming.InitialContext.lookup(InitialContext.java:392)

at
com.sun.enterprise.connectors.ConnectorResourceAdminServiceImpl.lookup(C
onnectorResourceAdminServiceImpl.java:196)

at
com.sun.enterprise.connectors.ConnectorRuntime.lookupNonTxResource(Conne
ctorRuntime.java:1130)

at
com.bosch.tmp.auth.GlassfishJndiDbConnectionFactory.init(GlassfishJndiDb
ConnectionFactory.java:24)

at
com.bosch.tmp.auth.TmpLoginRealm.instantiateConnectionFactory(TmpLoginRe
alm.java:534)

... 15 more

Caused by: java.lang.RuntimeException: org.omg.CORBA.OBJ_ADAPTER: vmcid:
SUN minor code: 202 completed: No

at com.sun.enterprise.util.ORBManager.initORB(ORBManager.java:560)

at com.sun.enterprise.util.ORBManager.getORB(ORBManager.java:278)

at com.sun.enterprise.util.ORBManager.getORB(ORBManager.java:289)

at
com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.
java:205)

at
com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:1
60)

... 21 more

Caused by: org.omg.CORBA.OBJ_ADAPTER: vmcid: SUN minor code: 202
completed: No

at
com.sun.corba.ee.impl.logging.ORBUtilSystemException.orbConnectError(ORB
UtilSystemException.java:10175)

at
com.sun.corba.ee.impl.logging.ORBUtilSystemException.orbConnectError(ORB
UtilSystemException.java:10193)

at com.sun.corba.ee.impl.orb.ORBImpl.connect(ORBImpl.java:1666)

at
com.sun.corba.ee.spi.presentation.rmi.StubAdapter.connect(StubAdapter.ja
va:212)

at com.sun.corba.ee.impl.orb.ORBImpl.getIOR(ORBImpl.java:2115)

at com.sun.corba.ee.impl.orb.ORBImpl.getFVDCodeBaseIOR(ORBImpl.java:987)

at com.sun.enterprise.util.ORBManager.initORB(ORBManager.java:556)

... 25 more

Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 216
completed: No

at
com.sun.corba.ee.impl.logging.ORBUtilSystemException.createListenerFaile
d(ORBUtilSystemException.java:3094)

at
com.sun.corba.ee.impl.logging.ORBUtilSystemException.createListenerFaile
d(ORBUtilSystemException.java:3114)

at
com.sun.corba.ee.impl.transport.SocketOrChannelAcceptorImpl.initialize(S
ocketOrChannelAcceptorImpl.java:181)

at
com.sun.corba.ee.impl.transport.CorbaTransportManagerImpl.getAcceptors(C
orbaTransportManagerImpl.java:236)

at
com.sun.corba.ee.impl.transport.CorbaTransportManagerImpl.addToIORTempla
te(CorbaTransportManagerImpl.java:253)

at
com.sun.corba.ee.spi.oa.ObjectAdapterBase.initializeTemplate(ObjectAdapt
erBase.java:127)

at com.sun.corba.ee.impl.oa.toa.TOAImpl.<init>(TOAImpl.java:107)

at com.sun.corba.ee.impl.oa.toa.TOAFactory.getTOA(TOAFactory.java:98)

at com.sun.corba.ee.impl.orb.ORBImpl.connect(ORBImpl.java:1664)

... 29 more

Caused by: java.io.IOException: IOP5080: The server port '3,820' is not
specified in iiop listener for SSL.

at
com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSSLServerSocket(IIOPS
SLSocketFactory.java:380)

at
com.sun.enterprise.iiop.IIOPSSLSocketFactory.createServerSocket(IIOPSSLS
ocketFactory.java:289)

at
com.sun.corba.ee.impl.transport.SocketOrChannelAcceptorImpl.initialize(S
ocketOrChannelAcceptorImpl.java:174)

... 35 more

 

My assumption now is, that to the time the realm is initialized the JNDI
service simply is not initialized and not ready so this lookup must
fail.

 

Now i wonder if this is intended, can anybody confirm this?

Is it a bug, is it a known problem or have i simply done something
wrong?

 

Thanks in advance and kind regards,

 

Thomas