For Programmers: Free Programming Magazines  


Home > Archive > Java Beans > July 2004 > JBoss EJB Error- javax.naming.NameNotFoundException









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author JBoss EJB Error- javax.naming.NameNotFoundException
anitha

2004-07-12, 3:57 am

Hai,

I have an error when I run my client on JBoss. Can any of you fix it for
me.

I have the following files in respective directories.

D:\EJBJBoss\HelloEJB\HelloWorld.class
D:\EJBJBoss\HelloEJB\HelloWorldHome.class
D:\EJBJBoss\HelloEJB\HelloWorldBean.class

D:\EJBJBoss\HelloEJB\META-INF\jboss.xml
D:\EJBJBoss\HelloEJB\META-INF\ejb-jar.xml

D:\EJBJBoss\HelloWorldClient.class

I have created a jar file "HelloWorld.jar" including the above files
except the client and it has

been successfully deployed. Now when I run it, I get the following error.

D:\EJBJBoss>java -classpath
".;C:\jboss-3.2.2_BAK\client\jnp-client.jar;C:\jboss
-3.2.2_BAK\client\jboss-client.jar;C:\jboss-3.2.2_BAK\client\jbossall-client.jar
;C:\jboss-3.2.2_BAK\server\default\deploy\HelloWorld.jar"
HelloWorldClient

javax.naming.NameNotFoundException: HelloEJB not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
at org.jnp.server.NamingServer.lookup(NamingServer.java:253)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
60)
at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
java:701)
at java.lang.Thread.run(Thread.java:536)
at
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
RemoteCall.java:247)
at
sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:528)
at
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at HelloWorldClient.main(HelloWorldClient.java:20)
Exception: HelloEJB not bound

Here is my client program

HelloWorldClient.java
---------------------
import HelloEJB.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.Hashtable;

public class HelloWorldClient
{

public static void main( String [] args )
{

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,

"org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL,"localhost:1099");
env.put("java.naming.factory.url.pkgs",
"org.jboss.naming:org.jnp.interfaces");

try
{
Context ctx = new InitialContext(env);
Object obj = ctx.lookup(" HelloEJB/HelloWorld ");
HelloWorldHome home =

(HelloWorldHome)javax.rmi.PortableRemoteObject.narrow(
obj,HelloWorldHome.class );
HelloWorld helloWorld = home.create();
System.out.println( helloWorld.hello());
helloWorld.remove();
}

catch ( Exception e )
{
e.printStackTrace();
System.out.println( "Exception: " + e.getMessage() );
}
}
}


jboss.xml
---------
<?xml version="1.0" encoding="UTF-8"?>
<jboss>
<enterprise-beans>
<session>
<ejb-name>HelloWorldBean</ejb-name>
<jndi-name>HelloEJB/HelloWorld</jndi-name>
</session>
</enterprise-beans>
</jboss>


Regards,
Anitha


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com