Ejb-Client Error--SocketTimeoutException: org.jnp.interfaces
krishnak007 Apr 1, 2004 8:55 AMHi,
I am trying to run the client-EJB application for JBoss 3.2.3---it gives me a runtime exception....
is there any possible solution to this...even I ran the same code day before ..it worked fine ..today wen I tried running the same it gave me the error---!!
====================
compile:
client:
[java] Getting Initial Context
[java] Caught an unexpected exception while getting home interfaces!
[java] javax.naming.CommunicationException: Receive timed out [Root excepti
on is java.net.SocketTimeoutException: Receive timed out]
[java] at org.jnp.interfaces.NamingContext.discoverServer(NamingContext
.java:1115)
[java] at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:
1192)
[java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:51
4)
[java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:50
7)
[java] at javax.naming.InitialContext.lookup(InitialContext.java:347)
[java] at HelloClient.get_home_interfaces(HelloClient.java:47)
[java] at HelloClient.(HelloClient.java:29)
[java] at HelloClient.main(HelloClient.java:85)
[java] Caused by: java.net.SocketTimeoutException: Receive timed out
[java] java.lang.NullPointerException
[java] at HelloClient.MyHello(HelloClient.java:61)
[java] at HelloClient.(HelloClient.java:30)
[java] at HelloClient.main(HelloClient.java:85)
[java] at java.net.PlainDatagramSocketImpl.receive(Native Method)
[java] at java.net.DatagramSocket.receive(DatagramSocket.java:711)
[java] at org.jnp.interfaces.NamingContext.discoverServer(NamingContext
.java:1093)
[java] ... 7 more
[java] ------Inside MyHello Function Desc.------------
[java] Caught an unexpected exception while making hello()!
BUILD SUCCESSFUL
Total time: 10 seconds
C:\MyProjects>
============================================================
============================================================
These are my "xml" file details and the "Client" file---
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC
"-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
"http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<enterprise-beans>
<ejb-name>HelloHome</ejb-name>
examples.HelloHome
examples.Hello
<local-home>examples.HelloLocalHome</local-home>
examples.HelloLocal
<ejb-class>examples.HelloBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</enterprise-beans>
</ejb-jar>
==============================================
<?xml version="1.0" encoding="UTF-8"?>
<enterprise-beans>
<ejb-name>HelloHome</ejb-name>
<jndi-name>HelloHome</jndi-name>
<local-jndi-name>HelloLocal</local-jndi-name>
</enterprise-beans>
=======================================================
import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.Properties;
import javax.rmi.PortableRemoteObject;
import java.util.Enumeration;
import examples.Hello;
import examples.HelloHome;
import examples.HelloLocal;
import examples.HelloLocalHome;
import examples.HelloBean;
//invokes methods on a simple stateless session bean
public class HelloClient{
/** JNDI Context Provider */
public static String CONTEXT_PROVIDER_URL = "localhost:1099";
/** JNDI Context class Factory Name */
public static String CONTEXT_FACTORY_NAME = "org.jnp.interfaces.NamingContextFactory";
public static String CONTEXT_FACTORY_PKGS = "org.jboss.naming:org.jnp.interfaces";
/** JNDI Properties */
private static Properties Properties = null ;
private HelloHome hello_home;
public HelloClient()
{
get_home_interfaces();
MyHello();
}
private void get_home_interfaces()
{
try {
Properties Properties = new Properties ( ) ;
Properties . put ( "Context.PROVIDER_URL" , CONTEXT_PROVIDER_URL ) ;
Properties . put ( "java.naming.provider.url" , CONTEXT_PROVIDER_URL ) ;
Properties . put ( "java.naming.factory.initial" , CONTEXT_FACTORY_NAME ) ;
Properties . put ( "java.naming.factory.url.pkgs" , CONTEXT_FACTORY_PKGS ) ;
InitialContext initial = new InitialContext(Properties);
pl("Getting Initial Context");
Object cont_ref = initial.lookup("HelloHome");
hello_home=(HelloHome)javax.rmi.PortableRemoteObject.narrow(cont_ref, HelloHome.class);
} catch (Exception ex) {
pl("Caught an unexpected exception while getting home interfaces!");
ex.printStackTrace(System.out);
}
}
private Hello MyHello()
{
try{
pl("------Inside MyHello Function Desc.------------");
Hello hello=hello_home.create();
pl("------Inside MyHello Function Desc.--step2--------------");
System.out.println(hello.hello());
pl("------Completed the EJB Cycle------------");
return hello;
}
catch (Exception ex) {
pl("Caught an unexpected exception while making hello()!");
ex.printStackTrace();
}
return null;
}
public void pl(String str){System.out.println(str);}
public static void main(String[] args) {
HelloClient te = new HelloClient();
}
}
===================================================================
Any help, suggestions are welcome..
Krishna k.
9819152725