Hai,
I have a problem in running the client after successful deployment in the
JBoss application server. The client and the server runs on the same
machine.The problem goes as follows:
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
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() );
}
}
}
ejb-jar.xml
---------------
<?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>
<description>Your first EJB application </description>
<display-name>Hello World Application</display-name>
<enterprise-beans>
<session>
<ejb-name>HelloWorld</ejb-name>
<home>HelloEJB.HelloWorldHome</home>
<remote>HelloEJB.HelloWorld</remote>
<ejb-class>HelloEJB.HelloWorldBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
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>
I am desperate. It would be nice if you could fix it for me. thank you.
Regards,
Anitha
SJ - 13 Jul 2004 03:25 GMT
Anitha,
I have an idea.... I think your <ejb-name> tab needs to be the same in your
ejb-jar and your jboss.xml. Right now you have "HelloWorld" in ejb-jar and
"HellowWordBean" in jboss.xml.
-Scott
> Hai,
>
[quoted text clipped - 142 lines]
> Regards,
> Anitha
sebastien mathy - 14 Jul 2004 09:58 GMT
Hi,
I don't know if it's the raison of your problem, but I think the value of
<ejb-name> in jboss.xml should be the same than <ejb-name> in ejb-jar.xml.
Regards.
> Hai,
>
[quoted text clipped - 21 lines]
> ".;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
[quoted text clipped - 117 lines]
> Regards,
> Anitha