3 Replies Latest reply on Dec 7, 2005 11:22 PM by xu bin

    ejb3 session bean and JNDI problem.

    xu bin Newbie

      I write a EJB3 session bean, it run in a JBOSS4.0.3SP1 server.
      and i write a client to test the EJB3 session bean, the client is run in another

      here is my client

      public class JNDITest {

      public JNDITest() {
      // TODO Auto-generated constructor stub

      * @param args
      public static void main(String[] args) {
      Properties env = new Properties();
      env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      env.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interface");
      env.setProperty(Context.PROVIDER_URL, "jnp://xbw:1099");
      try {
      Context ctx = new InitialContext(env);
      com.xubin.jnditest.ejb3.JNDITest testbean = (com.xubin.jnditest.ejb3.JNDITest)ctx.lookup(com.xubin.jnditest.ejb3.JNDITest.class.getName());

      } catch (NamingException e) {
      // TODO Auto-generated catch block



      and here is my ejb3

      package com.xubin.jnditest.ejb3;

      import javax.ejb.Stateless;
      import com.xubin.jnditest.ejb3.JNDITest;

      public @Stateless class JNDITestBean implements JNDITest {

      public String getInfo() {
      return "Just a test";


      when I run my client, it's all right, "Just a test" is printed on console.
      But, in server side, an error is raise:
      15:32:09,515 ERROR [ServerThread] failed
      java.net.SocketException: Connection reset
      at java.net.SocketInputStream.read(Unknown Source)
      at java.io.BufferedInputStream.fill(Unknown Source)
      at java.io.BufferedInputStream.read(Unknown Source)
      at java.io.ObjectInputStream$PeekInputStream.peek(Unknown Source)
      at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(Unknown Source)
      at java.io.ObjectInputStream$BlockDataInputStream.refill(Unknown Source)
      at java.io.ObjectInputStream$BlockDataInputStream.read(Unknown Source)
      at java.io.ObjectInputStream$BlockDataInputStream.readByte(Unknown Source)
      at java.io.ObjectInputStream.readByte(Unknown Source)
      at org.jboss.remoting.transport.socket.ServerSocketWrapper.checkConnection(ServerSocketWrapper.java:54)
      at org.jboss.remoting.transport.socket.ServerThread.acknowledge(ServerThread.java:217)
      at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:298)
      at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:169)

      Can anyone tell me why? Please give me a hand!