Try do set also the ORBInitialPort as a system property:
p.setProperty("org.omg.CORBA.ORBInitialPort", "34513");
System.setProperty("org.omg.CORBA.ORBInitialPort", "34513");
To.
On Thu, 6 Oct 2011 00:15:09 -0500 (CDT)
forums_at_java.net wrote:
>I have encountered following problem: if ORB is not running on default port I
>can't access JMS (Java Message Service) destination resources from a
>standalone client. Am I doing something wrong or there is a bug in GlassFish?
>Here are the details.
>
>Sample code:
>
><code>
>
>Properties p = new Properties();
>p.setProperty("java.naming.factory.initial",
>"com.sun.enterprise.naming.impl.SerialInitContextFactory");
>p.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
>p.setProperty("java.naming.factory.state",
>"com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
>p.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
>p.setProperty("org.omg.CORBA.ORBInitialPort", "34513"); //any configured port
>different from 3700
>InitialContext ic = new InitialContext(p);
>ConnectionFactory cf = ic.lookup("jms/TopicTestFactory"); //always works fine
>(JMS connection factory)
>Topic lookup = ic.lookup("jms/TopicTest"); //throws Exception if ORB is not
>on port 3700, works fine if ORB is configured on localhost and port 3700 (JMS
>topic)
>
></code>
>
>Here is the exception:
>
>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.GeneratedConstructorAccessor33.newInstance(Unknown
>Source)
> at
>sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
> 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 $Proxy24.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:130)
> 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:411)
> at
>com.sun.enterprise.resource.naming.AdministeredObjectFactory.getObjectInstance(AdministeredObjectFactory.java:98)
> at
>javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
> at
>com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:556)
> at
>com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:514)
> at
>com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
> at javax.naming.InitialContext.lookup(InitialContext.java:411)
> at libraryclient.LibraryClient.main(LibraryClient.java:34)
>Caused by: java.lang.RuntimeException: java.net.ConnectException:
>Połączenie odrzucone
> at
>org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:339)
> at
>com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:242)
> ... 20 more
>Caused by: java.net.ConnectException: Połączenie odrzucone
> at sun.nio.ch.Net.connect0(Native Method)
> at sun.nio.ch.Net.connect(Net.java:364)
> at sun.nio.ch.Net.connect(Net.java:356)
> at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:623)
> at
>com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:110)
> at
>org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:324)
> ... 21 more
>Exception in thread "main" javax.naming.CommunicationException: Communication
>exception for SerialContext[myEnv={org.omg.CORBA.ORBInitialPort=34513,
>java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory,
>java.naming.factory.url.pkgs=com.sun.enterprise.naming,
>java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl}
>[Root exception is
>com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Failed to
>look up ConnectorDescriptor from JNDI]
> at
>com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:542)
> at
>com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
> at javax.naming.InitialContext.lookup(InitialContext.java:411)
> at libraryclient.LibraryClient.main(LibraryClient.java:34)
>Caused by: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException:
>Failed to look up ConnectorDescriptor from JNDI
> at
>com.sun.enterprise.resource.naming.AdministeredObjectFactory.getObjectInstance(AdministeredObjectFactory.java:104)
> at
>javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
> at
>com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:556)
> at
>com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:514)
> ... 3 more
>
>
>
>
>--
>
>[Message sent by forum member 'bastian_knight']
>
>View Post: http://forums.java.net/node/850482
>
>
----
Dipl.-Ing. Torsten Liermann Tel: +49 151/11565077
Theodolindenplatz 2 Fax: +49 89/95449198
81545 München http://liermann-it.de