1 Reply Latest reply on Jun 4, 2005 9:42 AM by Scott Stark

    java.io.NotSerializableException

    Cristiano Limiti Newbie

      Hi,
      i'm trying to complete an application portingo from WebLogic 7.0 to JBoss 4.0.1sp1. I found a problem when i try to bind an object into the JNDI tree.

      When i start the application i obtain the following error:

      javax.naming.CommunicationException [Root exception is java.io.NotSerializableException: provatrap.LogProva]
      at org.jnp.interfaces.NamingContext.bind(NamingContext.java:511)
      at org.jnp.interfaces.NamingContext.bind(NamingContext.java:469)
      at javax.naming.InitialContext.bind(InitialContext.java:355)
      at provatrap.main.jndiJBossBind(main.java:231)
      at provatrap.main.subMain(main.java:59)
      at provatrap.main.(main.java:34)
      at provatrap.main.main(main.java:909)
      Caused by: java.io.NotSerializableException: provatrap.LogProva
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
      at java.rmi.MarshalledObject.(MarshalledObject.java:92)
      at org.jnp.interfaces.MarshalledValuePair.(MarshalledValuePair.java:44)
      at org.jnp.interfaces.NamingContext.bind(NamingContext.java:494)
      ... 6 more

      This is the cristallo cut code:

      main.java:

      public void subMain() {

      jndiJBossBind ();

      }

      public void jndiJBossBind () {
      InitialContext iniContext;
      Hashtable env = new Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      env.put(Context.PROVIDER_URL, "jnp://localhost:1099");

      try {
      iniContext = new InitialContext(env);

      LogProva rce = null;
      try {
      rce = new LogProva();
      } catch (Exception ex1) {
      }

      iniContext.bind("pippo", rce);
      }
      catch (NamingException ex) {
      System.out.println("Eccezione: " + ex.getMessage());
      ex.printStackTrace();
      }
      }

      LogProva.java:

      package provatrap;

      import java.rmi.*;

      public class LogProva implements Remote{
      public LogProva() throws RemoteException{
      }

      public void trace (String dato) throws RemoteException{
      System.out.println(dato);
      }

      public void error (String dato) throws RemoteException{
      System.out.println(dato);
      }
      }

      Thanks

      Cristiano