users@glassfish.java.net

GF 3.1.0 - Can gf-client use a custom java.naming.provider.url?

From: Andrew Hughes <ahhughes_at_gmail.com>
Date: Mon, 9 May 2011 16:04:04 +0930

Hi All,

I am trying to use *gf-client* in TestNG tests (with maven) with GlassFish
3.1.0. The "*java.naming.provider.url*" seems to be *hard coded* to
iiop://localhost:3700. I say hard coded, because....

properties.add("java.naming.provider.url","iiop://localhost:3137");
new InitialContext(properties);


Has no effect, it ALWAYS tries to connect to localhost 3700 (it's
definitely NOT a typo in my code either).

Others seem to have the same problem, without answer:

http://forums.oracle.com/forums/thread.jspa?threadID=2203656&tstart=1
http://www.java.net/forum/topic/glassfish/glassfish/cant-access-gf31-remote-ejbs-standalone-client?force=253


Exceptions confirm that it is trying 3700:

org.omg.CORBA.COMM_FAILURE: FINE: IOP00410001: Connection failure:
socketType: IIOP_CLEAR_TEXT; hostname: localhost; *port: 3700* vmcid: OMG
 minor code: 1 completed: No
        at sun.reflect.GeneratedConstructorAccessor30.newInstance(Unknown
Source)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at
com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:248)
        at
com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:95)
        at
com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.handleFullLogging(WrapperGenerator.java:387)
        at
com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.access$400(WrapperGenerator.java:107)
        at
com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator$2.invoke(WrapperGenerator.java:511)
        at
com.sun.corba.ee.spi.orbutil.proxy.CompositeInvocationHandlerImpl.invoke(CompositeInvocationHandlerImpl.java:99)
        at $Proxy26.connectFailure(Unknown Source)
        at
com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:257)
        at
com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:270)
        at
com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:129)
        at
com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:223)
        at
com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:228)
        at
com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:393)
        at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
        at
org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
        at
com.sun.enterprise.naming.impl.SerialContext$ProviderCacheKey.getNameService(SerialContext.java:1241)
        at
com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:411)
        at
com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:347)
        at
com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:504)
        at
com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)


Is this a bug? Is there something on the classpath I can override?

Thanks in advance
--AH


p.s. for anyone considering unit testing stand alone clients with JMS I
tried many different things, but this was the solution
http://stackoverflow.com/questions/5675024/with-which-maven-dependencies-can-i-create-a-standalone-jms-client-for-glassfish/5745837#5745837.
 Also I never got a working solution with glassfish 3.0 and was forced
to
upgrade :'(