Skip to Main Content

Java and JavaScript in the Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Peer disconnecting immediately after EJB lookup - timing issue?

73312Nov 1 2001
I'm getting a timing problem with the Oracle EJB server, version
8.1.6.

I've deployed an EJB successfully, so I want to write the client-
side Java code to use it. The code calls the lookup() method on
the InitialContext, and gets back an EJBHome object like this:

Object ejb = new Object();
Hashtable env = new Hashtable();
env.put(Context.URL_PKG_PREFIXES, "oracle.aurora.jndi");
env.put(Context.SECURITY_PRINCIPAL, "username");
env.put(Context.SECURITY_CREDENTIALS, "password");
env.put(Context.SECURITY_AUTHENTICATION,
ServiceCtx.NON_SSL_LOGIN);
Context ic = new InitialContext(env);
ejb = (EJBHome)ic.lookup(serviceURL + objectName); // service
URL is the URL of the server, and objectName is the name of the
EJBRemote.


This works fine. The problem is that if I try to call create()
on the EJB home interface IMMEDIATELY after this block of code
finishes, it peer disconnects. If I wait for a second or two,
there's no problem.

// Bad code?! Have to wait 1-2 seconds before calling this
code, otherwise, we peer disconnect.
MyObjectEJBRemote myEJBremote = ejb.create();

The peer disconnect looks like the following:
org.omg.CORBA.COMM_FAILURE: java.io.IOException: Peer
disconnected socket minor code: 0 completed: No
at com.visigenic.vbroker.orb.TcpConnection.read
(TcpConnection.java, Compiled Code)
at
com.visigenic.vbroker.orb.GiopConnectionImpl.receive_message
(GiopConnectionImpl.java, Compiled Code)
at
com.visigenic.vbroker.orb.GiopConnectionImpl.receive_reply
(GiopConnectionImpl.java, Compiled Code)
at com.visigenic.vbroker.orb.GiopStubDelegate.invoke
(GiopStubDelegate.java, Compiled Code)
at com.visigenic.vbroker.orb.GiopStubDelegate.invoke
(GiopStubDelegate.java, Compiled Code)
at com.inprise.vbroker.CORBA.portable.ObjectImpl._invoke
(ObjectImpl.java, Compiled Code)
at MyObjectEJBRemote.myEJBmethod
(_st_MyObjectEJBRemote.java:1103)
at MyClient.callEJBMethod(MyClient.java, Compiled Code)
at javax.swing.AbstractButton.fireActionPerformed
(Unknown Source)
at
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed
(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed
(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown
Source)
at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown
Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent
(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent
(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown
Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForComponent
(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForComponent
(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown
Source)
at java.awt.EventDispatchThread.run(Unknown Source)


Do I have to put a delay in my code in between calling the lookup
() and calling the create()? Is there something simple that I'm
missing? All I know is that if I wait for a just a moment
before I call create(), then the code works fine.

- rjms

NOTE: Please note that my email address is now:
robschiller1@yahoo.com. Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 29 2001
Added on Nov 1 2001
0 comments
81 views