jQuery in Action, 3rd edition
The moose likes EJB and other Java EE Technologies and the fly likes Error getting EJB reference Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Error getting EJB reference " Watch "Error getting EJB reference " New topic

Error getting EJB reference

Khaled Mahmoud
Ranch Hand

Joined: Jul 15, 2006
Posts: 361
Hi all,
I am using "Sun Application Server 9.0" with Netbeans 5.5 IDE.
I have developed a simple EJB called AccesDriveCBean.

Here are the class names and interfaces for this bean.

I have successfully deployed this bean into the "Sun Application Server 9.0"
and logs of server shows that the JNDI name of the deployed bean is as following :

**RemoteBusinessJndiName: org.khaledinho.learning.sun.java.certifications.scbcd.AccessDriveCRemote; remoteBusIntf: org.khaledinho.learning.sun.java.certifications.scbcd.AccessDriveCRemote

JNDI name is : org.khaledinho.learning.sun.java.certifications.scbcd.AccessDriveCRemote

When i tried to get a reference to this enterprise from a remote client i got the following exception :

Here is the code for the Java Client Application

Plesase help

SCJP, SCJD,SCWCD,SCDJWS,SCEA 5 MCP-C#, MCP-ASP.NET - http://www.khaledinho.com/
Life is the biggest school
Shailesh Kini
Ranch Hand

Joined: Oct 17, 2001
Posts: 153

Have you referred to this link?

Shailesh Kini.
Khaled Mahmoud
Ranch Hand

Joined: Jul 15, 2006
Posts: 361

I have followed the instructions contained in the link above. Now i am getting the following exception :

com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
WARNING: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: localhost; port: 3700"
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2348)
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2369)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:212)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:225)
at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:104)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:159)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:156)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:296)
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.SerialContext.narrowProvider(SerialContext.java:110)
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:164)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:309)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at Main.main(Main.java:36)
Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused: connect
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:356)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:195)
... 12 more
Caused by: java.net.ConnectException: Connection refused: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:464)
at java.nio.channels.SocketChannel.open(SocketChannel.java:146)
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:340)
... 13 more

I still don't know what was wrong in my first approach in getting a reference to the remote EJB. Mosts posts and topics I read on the net point to my way in obtaining a reference to a remote EJB.

Any ideas regarding any of the shown exceptions.
[ August 31, 2007: Message edited by: Khaled Mahmoud ]
Khaled Mahmoud
Ranch Hand

Joined: Jul 15, 2006
Posts: 361

The second way worked successfully. I restarted my PC and when I tried to a get a reference to stateless session bean the operation was successful.
Looks like there was a problem in the "Sun Application Server" on the port 3700.
I agree. Here's the link: http://aspose.com/file-tools
subject: Error getting EJB reference
jQuery in Action, 3rd edition