• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Using stand alone client appication

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Every one,

I am using stand alone java application as my client, the code is given below,

package lesson.stateless;
import javax.ejb.*;
@Remote
public interface HelloWorld {

public String getMessage();

}




package lesson.stateless;
import javax.ejb.Remote;
import javax.ejb.Stateless;
@Stateless(mappedName="ejb/HelloWorldJNDI")
@Remote(HelloWorld.class)
public class HelloWorldBean implements HelloWorld {
public String getMessage() {
return "Hello vasanthi's EJB World";
}
}



and the client is



package lesson.client;

import javax.naming.InitialContext;

import lesson.stateless.HelloWorld;

public class TestClient {

public static void main(String[] args) throws Exception {
InitialContext ctx = new InitialContext();
HelloWorld hello = (HelloWorld) ctx.lookup("ejb/HelloWorldJNDI");
System.out.println(hello.getMessage());
}
}


But the exception is


21-Sep-2009 14:10:43 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:2690)
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2711)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:261)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:274)
at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:130)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:192)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:181)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:325)
at org.omg.CORBA.portable.ObjectImpl._is_a(Unknown Source)
at org.omg.CosNaming.NamingContextHelper.narrow(Unknown Source)
at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:134)
at com.sun.enterprise.naming.SerialContext.getCachedProvider(SerialContext.java:259)
at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:204)
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:159)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:409)
at javax.naming.InitialContext.lookup(Unknown Source)
at lesson.client.TestClient.main(TestClient.java:11)
Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused: connect
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:244)
... 14 more
Caused by: java.net.ConnectException: Connection refused: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:105)
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:332)
... 15 more
Exception in thread "main" javax.naming.CommunicationException: Can't find SerialContextProvider [Root exception is org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No]
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:164)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:409)
at javax.naming.InitialContext.lookup(Unknown Source)
at lesson.client.TestClient.main(TestClient.java:11)
Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2690)
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2711)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:261)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:274)
at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:130)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:192)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:181)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:325)
at org.omg.CORBA.portable.ObjectImpl._is_a(Unknown Source)
at org.omg.CosNaming.NamingContextHelper.narrow(Unknown Source)
at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:134)
at com.sun.enterprise.naming.SerialContext.getCachedProvider(SerialContext.java:259)
at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:204)
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:159)
... 3 more
Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused: connect
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:244)
... 14 more
Caused by: java.net.ConnectException: Connection refused: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:105)
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:332)
... 15 more



Please help me why the error is coming......


Many Thanks
Vasanthi

 
Vasanthi hiremath
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anybody please give the response for my problem, I know it could be silly, but I am stuck & not able to continue

Regards
Vasanthi
 
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

If you want to access the beans outside of the container (via JNDI) you need to specify the JNDI name mapping, this depends on the application server, for glassfish you need to alter the sun-ejb-jar, placed in your META-INF dir.


in the previous code snippet the <ejb-name>MyBeanClass</ejb-name> is the name used for your stateless bean (@Stateless(name="MyBeanClass")), the jndi-name is the name used for JNDI look up.

Regards,
Mihai
 
Vasanthi hiremath
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

The deploy failed as it is not able to recognise the HelloWorldBean in xml tag <ejb-name> of sun-ejb-jar.xml. It says illegal argumnet exception. This bundle has no bean of name [HelloWorldBean].

Help needed urgent....
Regards
Vasanthi
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

can you post me your bean header ? and your sun-ejb.xml ? Please use the code to format your post.

Regards,
Mihai
 
Vasanthi hiremath
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My sun-ejb-jar.xml file is as below

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 EJB 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_0-0.dtd">
<sun-ejb-jar>

<enterprise-beans>
<ejb>
<ejb-name>HelloWorldBean</ejb-name>
<jndi-name>ejb/HelloWorldJNDI</jndi-name>
</ejb>
</enterprise-beans>


</sun-ejb-jar>


But I did not get about the Bean header,I have posted the code of interface, Bean & the client previously. Please let me know if this is sufficient.

Regards
Vasanthi
 
Vasanthi hiremath
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

My bean code is as follows

package lesson.stateless;
import javax.ejb.Stateless;
@Stateless(name="helloworldejb", mappedName="ejb/HelloWorldJNDI")
public class HelloWorldBean implements lesson.stateless.HelloWorld {
public String getMessage() {
return "Hello vasanthis Client EJB World";
}
}




And in my client code I am doing the look up as follows


InitialContext ctx = new InitialContext();
helloWorld = (HelloWorld) ctx.lookup("ejb/HelloWorldJNDI");

I am able to deploy the EJB but my client is still throwing the same exception as I posted in my 1st message

Please let me know why I am getting the error & I changed my sun-ejb-jar.xml file as follwos

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 EJB 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_0-0.dtd">
<sun-ejb-jar>

<enterprise-beans>
<ejb>
<ejb-name>helloworldejb</ejb-name>
<jndi-name>ejb/HelloWorldBeanJNDI</jndi-name>
</ejb>
</enterprise-beans>


</sun-ejb-jar>



Regards
Vasanthi
 
Vasanthi hiremath
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Please can anybody respond to my problem...

Regards
Vasanthi
 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

This link had a similar example but they used net beans
http://wiki.netbeans.org/CreatingEJB3UsingNetbeansAndGlassfish

Hope this helps!

Harish
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Vasanthi

Have you found solution for this problem?

If not, I think there is some problem in the port to which you are connecting.
From first line of your exception we can deduce this (look at the underlined part).

21-Sep-2009 14:10:43 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



I think by default JNDI runs on port # 1099 and in your case it is trying to connect to port # 3700.
Just see if this is the root of your problem.
 
Vasanthi hiremath
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Sorry for the delayed response, Harish I tried the way that given in that web page i was till getting the same error.
Karekar,as you told me it may be possible what ever you have mentioned. can you please tell me how to solve that problem....
Guys I have been tryin very long, I am not successfull in Stand alone client application , but i am successful in the web client application. Please llet me know whats oing on in my code....


Regards
Vasanthi
 
Chandrashekhar Kotekar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Vasanthi

First thing, my name is not Karekar. Its KOTEKAR. I know you are frustated because of your problem but then also you should take a final look of your text before posting.
Anyways, about your problem....

Can you please tell us what application server you are using? (JBoss, Glassfish, etc.)
Have you created jndi.properties file? If yes, where is it located? You need to place all files (class files, xml file, properties file) in proper folders.
Are you deploying EAR file or JAR file?

Try to run this tutorial. I was also facing the same problem as yours but this tutorial helped me. I am sure it will help you also. Below is the link for the tutorial.

http://javahowto.blogspot.com/2007/11/simple-ejb-3-on-jboss-application.html

Best of luck
 
When evil is afoot and you don't have any arms you gotta be hip and do the legwork, but always kick some ... tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic