Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem with ejb and corba comm in j2ee sdk server  RSS feed

 
Pallab Sen
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are trying to access the service of a c++ server running on a diff host from an EJB deployed on the Sun RI(J2EE SDK) over CORBA. The EJB loads the object which really hosts this logic from a JAR .

That means the EJB and the object acts as a client to the C++ server. We have tried the same from a simple servlet also.

When we write a simple Java client to access the services of the server through CORBA , it works fine.
But, when we put the same code in the bean or servlet and deploy from the App Serv (J2EE SDK), where the following call (_non_existent) fails and generates an exception.

// Resolve the Root Naming Context
org.omg.CORBA.Object root_nam_obj = orb.string_to_object(ior);
NamingContext rootContext = NamingContextHelper.narrow(root_nam_obj);

try {
if (rootContext._non_existent() )
}
catch (Exception e) { return " _non_existent failed for rootContext"; }
----------
Prior to this line, we are initializing the ORB like the following where "10.125.97.218" is the current host and 3700 is the port where orb-listener is running (taken from the file <install-dir>/domains/domain1/config/domain.xml

String [] args = { "" };
Properties props = new Properties();
props.put("org.omg.CORBA.ORBInitialPort", "3700");
props.put("org.omg.CORBA.ORBInitialHost", "10.125.97.218");

org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, props);
---------------
In domain.xml , there are 3 entries for iiop-listeners. Those were default and we didn't change them.

<iiop-service client-authentication-required="false">
<orb max-connections="1024" message-fragment-size="1024" use-thread-pool-ids="thread-pool-1"/>
<iiop-listener address="0.0.0.0" enabled="true" id="orb-listener-1" port="3700" security-enabled="false"/>
<iiop-listener address="0.0.0.0" enabled="true" id="SSL" port="3820" security-enabled="false">
</iiop-listener>
<iiop-listener address="0.0.0.0" enabled="true" id="SSL_MUTUALAUTH" port="3920" security-enabled="false">
</iiop-listener>
</iiop-service>
--------

What we have observed in the server.log is , when the client is run , it is trying to create an IIOP listener again and fails.

[#|2005-12-14T16:42:03.422+0530|SEVERE|sun-appserver-pe8.1_02|javax.enterprise.resource.corba._DEFAULT_.rpc.transport|_ThreadID=11;|"IOP00410216: (COMM_FAILURE) Unable to create IIOP listener on the specified host/port: all interfaces/3700"
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 216 completed: No
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.createListenerFailed(ORBUtilSystemException.java:2661)
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.createListenerFailed(ORBUtilSystemException.java:2681)
at com.sun.corba.ee.impl.transport.SocketOrChannelAcceptorImpl.initialize(SocketOrChannelAcceptorImpl.java:167)
at com.sun.corba.ee.impl.transport.CorbaTransportManagerImpl.getAcceptors(CorbaTransportManagerImpl.java:207)
at com.sun.corba.ee.impl.transport.CorbaTransportManagerImpl.addToIORTemplate(CorbaTransportManagerImpl.java:224)
at com.sun.corba.ee.spi.oa.ObjectAdapterBase.initializeTemplate(ObjectAdapterBase.java:104)
at com.sun.corba.ee.impl.oa.toa.TOAImpl.<init>(TOAImpl.java:78)
at com.sun.corba.ee.impl.oa.toa.TOAFactory.getTOA(TOAFactory.java:65)
at com.sun.corba.ee.impl.orb.ORBImpl.connect(ORBImpl.java:1536)
at com.sun.corba.ee.spi.presentation.rmi.StubAdapter.connect(StubAdapter.java:164)
at com.sun.corba.ee.impl.orbutil.ORBUtility.connectAndGetIOR(ORBUtility.java:825)
at com.sun.corba.ee.impl.orb.ORBImpl.getFVDCodeBaseIOR(ORBImpl.java:901)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.addServiceContexts(CorbaClientRequestDispatcherImpl.java:737)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:227)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:127)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.non_existent(CorbaClientDelegateImpl.java:264)
at org.omg.CORBA.portable.ObjectImpl._non_existent(ObjectImpl.java:137)
at Test_Bean_N.createGen(Test_Bean_N.java:39)
-------------

I think, we are doing something wrong with configurations. Can you please help.
-- Pallab
 
Pallab Sen
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have finally found the solution. The solution was to get hold of the ORB of the app server. Hence the following 2 lines did the trick.

org.omg.CORBA.ORB orb = null;
try {

javax.naming.Context jndiRootCtx = new InitialContext();
orb = (ORB)jndiRootCtx.lookup("java:comp/ORB");
}

---------
rgds,
Pallab
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!