users@glassfish.java.net

Custom Realm and JNDI Lookup

From: <glassfish_at_javadesktop.org>
Date: Fri, 13 Mar 2009 11:05:27 PDT

Hi,

I've got a question about a custom Relam in glassfish-v2ur2.
I've created a class which extends com.sun.appserv.security.AppservRealm.
In the init()-method I want to get a Datasource via a InitialContext::lookup("jdbc/Postgresql").
Here's a source-code-snippet:
[code]
    @Override
    public void init(Properties properties) throws BadRealmException, NoSuchRealmException {
        if (properties.containsKey(JAAS_CONTEXT)) {
            setProperty(JAAS_CONTEXT, properties.getProperty(JAAS_CONTEXT));
        }
        if (properties.containsKey(DATASOURCE)) {
            String jndiDatasource = properties.getProperty(DATASOURCE);
            DataSource datasource = null;
            try {
                datasource = (DataSource) (new InitialContext(props)).lookup(jndiDatasource);
            } catch (NamingException ex) {
[/code]

But that doesn't work. I get the following exception on Startup:

[code]
[#|2009-03-13T18:47:54.531+0100|SEVERE|sun-appserver9.1|javax.enterprise.resource.corba.ee.S1AS-ORB.rpc.transport|_ThreadID=10;_ThreadName=main;all interfaces;3820;_RequestID=73fb3ed6-6aab-4dc0-ab8d-f22cff9b60bd;|"IOP00410216: (COMM_FAILURE) Unable to create IIOP listener on the specified host/port: all interfaces/3820"
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 216 completed: No
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.createListenerFailed(ORBUtilSystemException.java:3094)
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.createListenerFailed(ORBUtilSystemException.java:3114)
        at com.sun.corba.ee.impl.transport.SocketOrChannelAcceptorImpl.initialize(SocketOrChannelAcceptorImpl.java:181)
        at com.sun.corba.ee.impl.transport.CorbaTransportManagerImpl.getAcceptors(CorbaTransportManagerImpl.java:236)
        at com.sun.corba.ee.impl.transport.CorbaTransportManagerImpl.addToIORTemplate(CorbaTransportManagerImpl.java:253)
        at com.sun.corba.ee.spi.oa.ObjectAdapterBase.initializeTemplate(ObjectAdapterBase.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)
        at com.sun.corba.ee.spi.presentation.rmi.StubAdapter.connect(StubAdapter.java: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)
        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:209)
        at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:160)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at org.j4fry.woomo.auth.WoomoJdbcRealm.init(WoomoJdbcRealm.java:61)
        at com.sun.enterprise.security.auth.realm.Realm.doInstantiate(Realm.java:233)
        at com.sun.enterprise.security.auth.realm.Realm.instantiate(Realm.java:165)
        at com.sun.enterprise.security.RealmConfig.createRealms(RealmConfig.java:93)
        at com.sun.enterprise.security.RealmConfig.createRealms(RealmConfig.java:163)
        at com.sun.enterprise.security.SecurityLifecycle.onInitialization(SecurityLifecycle.java:113)
        at com.sun.enterprise.server.ApplicationServer.onInitialization(ApplicationServer.java:262)
        at com.sun.enterprise.server.ondemand.OnDemandServer.onInitialization(OnDemandServer.java:101)
        at com.sun.enterprise.server.PEMain.run(PEMain.java:401)
        at com.sun.enterprise.server.PEMain.main(PEMain.java:338)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.enterprise.server.PELaunch.main(PELaunch.java:412)
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(IIOPSSLSocketFactory.java:380)
        at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createServerSocket(IIOPSSLSocketFactory.java:289)
        at com.sun.corba.ee.impl.transport.SocketOrChannelAcceptorImpl.initialize(SocketOrChannelAcceptorImpl.java:174)
        ... 31 more
[#|2009-03-13T18:47:54.541+0100|WARNING|sun-appserver9.1|javax.enterprise.resource.corba.ee._INITIALIZING_.rpc.presentation|_ThreadID=10;_ThreadName=main;_RequestID=73fb3ed6-6aab-4dc0-ab8d-f22cff9b60bd;|"IOP02310202: (OBJ_ADAPTER) Error in connecting servant to ORB"
org.omg.CORBA.OBJ_ADAPTER: vmcid: SUN minor code: 202 completed: No
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.orbConnectError(ORBUtilSystemException.java:10175)
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.orbConnectError(ORBUtilSystemException.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.java: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)
        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:209)
        at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:160)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at org.j4fry.woomo.auth.WoomoJdbcRealm.init(WoomoJdbcRealm.java:61)
        at com.sun.enterprise.security.auth.realm.Realm.doInstantiate(Realm.java:233)
        at com.sun.enterprise.security.auth.realm.Realm.instantiate(Realm.java:165)
        at com.sun.enterprise.security.RealmConfig.createRealms(RealmConfig.java:93)
        at com.sun.enterprise.security.RealmConfig.createRealms(RealmConfig.java:163)
        at com.sun.enterprise.security.SecurityLifecycle.onInitialization(SecurityLifecycle.java:113)
        at com.sun.enterprise.server.ApplicationServer.onInitialization(ApplicationServer.java:262)
        at com.sun.enterprise.server.ondemand.OnDemandServer.onInitialization(OnDemandServer.java:101)
        at com.sun.enterprise.server.PEMain.run(PEMain.java:401)
        at com.sun.enterprise.server.PEMain.main(PEMain.java:338)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.enterprise.server.PELaunch.main(PELaunch.java:412)
Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 216 completed: No
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.createListenerFailed(ORBUtilSystemException.java:3094)
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.createListenerFailed(ORBUtilSystemException.java:3114)
        at com.sun.corba.ee.impl.transport.SocketOrChannelAcceptorImpl.initialize(SocketOrChannelAcceptorImpl.java:181)
        at com.sun.corba.ee.impl.transport.CorbaTransportManagerImpl.getAcceptors(CorbaTransportManagerImpl.java:236)
        at com.sun.corba.ee.impl.transport.CorbaTransportManagerImpl.addToIORTemplate(CorbaTransportManagerImpl.java:253)
        at com.sun.corba.ee.spi.oa.ObjectAdapterBase.initializeTemplate(ObjectAdapterBase.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)
        ... 25 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(IIOPSSLSocketFactory.java:380)
        at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createServerSocket(IIOPSSLSocketFactory.java:289)
[/code]

Any ideas?

Thank's, greetz Alex
[Message sent by forum member 'alexanderbell' (alexanderbell)]

http://forums.java.net/jive/thread.jspa?messageID=336899