I develope a simple EJB it work fine with sun application server now I deploy it on jboss but I get a JNDI name not bound error. I also add all these file to classpath when I want to compile my client: jnp-client.jar,jnpserver.jar,jboss-client.jar,jboss-common.jar plus my ejb.jar file that created from following ant script:
| <project name="EJBJBOSS" default="ejbjar"> | <property file="build.properties"/> | <echo message="classes = ${build.classes.dir}"/> | | <target name="init" > | <mkdir dir="classes"/> | </target> | | <target name="compile" depends="init"> | <javac destdir="${build.classes.dir}" | srcdir="${build.src.dir}"> | <classpath> | <pathelement location="${compile.classpath}"/> | </classpath> | <include name="**/*.java"/> | </javac> | </target> | | | <target name="ejbjar" depends="compile"> | <jar destfile="${dist.dir}/${ejbjar.name}" | basedir="${build.classes.dir}" | includes="${metainf}/*.xml"> | <exclude name="HelloClient.class"/> | </jar> | <echo message="ejb jar destination = ${dist.dir}"/> | </target> | </project> | META-INF folder contain following jboss.xml and ejb-jar.xml: | <?xml version="1.0"?> | <ejb-jar | xmlns="http://java.sun.com/xml/ns/j2ee" | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee | http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd" | version="2.1"> | <enterprise-beans> | <session> | <ejb-name>HelloBean</ejb-name> | <home>tutorial.interfaces.HelloHome</home> | <remote>tutorial.interfaces.Hello</remote> | <ejb-class>tutorial.ejb.HelloBean</ejb-class> | <session-type>Stateless</session-type> | </session> | </enterprise-beans> | </ejb-jar> | | | <?xml version="1.0"?> | <jboss> | <enterprise-beans> | <session> | <ejb-name>HelloBean</ejb-name><!--Matches ejb-jar.xml --> | <jndi-name>jboss/HelloBean</jndi-name><!--Matches client code--> | </session> | </enterprise-beans> | </jboss> | and here is my client code: | import javax.naming.*; | import javax.rmi.*; | import tutorial.interfaces.HelloHome; | import tutorial.interfaces.Hello; | | | public class HelloClient { | | public void go() { | try | { | Properties prop = new Properties(); | prop.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory"); | prop.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces"); | prop.put("java.naming.provider.url","localhost"); | Context ic = new InitialContext(prop); | System.out.println("from client: EJB client Start"); | | Object ref = ic.lookup("jboss/HelloBean"); | System.out.println("JNDI name solved"); | | tutorial.interfaces.HelloHome home=(HelloHome)PortableRemoteObject.narrow(ref,HelloHome.class); | System.out.println("from client: home already finded"); | tutorial.interfaces.Hello sayHello = home.create(); | System.out.println(sayHello.helloing()); | | System.out.println("from client: EJB client End"); | } | catch(Exception ex) | { | ex.printStackTrace(); | } | } | public static void main(String[] args){ | new HelloClient().go(); | } | } I saw JBOSS service=JNDIView from jmx-console but I don't find my JNDI name here is my error: from client: EJB client Start javax.naming.NameNotFoundException: jboss 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(DelegatingMethodAccessorImpl.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:460) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701) at java.lang.Thread.run(Thread.java:534) at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source) at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source) at sun.rmi.server.UnicastRef.invoke(Unknown Source) 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(Unknown Source) at tutorial.client.HelloClient.go(HelloClient.java:22) at tutorial.client.HelloClient.main(HelloClient.java:38) so please help me it make me tired View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3906071#3906071 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3906071 ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user