4 Replies Latest reply on Nov 19, 2009 5:13 AM by David Delbecq

    jndi, rebind, java.io.NotSerializableException

    David Delbecq Newbie


      trying to migrate an application from tomcat to JBoss, i am blocked with this error.

      jvm 1 | java.io.NotSerializableException: org.enhydra.shark.Shark
      jvm 1 | at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
      jvm 1 | at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
      jvm 1 | at java.rmi.MarshalledObject.<init>(MarshalledObject.java:101)
      jvm 1 | at org.jnp.interfaces.MarshalledValuePair.<init>(MarshalledValuePair.java:65)
      jvm 1 | at org.jnp.interfaces.NamingContext.createMarshalledValuePair(NamingContext.java:1425)
      jvm 1 | at org.jnp.interfaces.NamingContext.rebind(NamingContext.java:567)
      jvm 1 | at org.jnp.interfaces.NamingContext.rebind(NamingContext.java:540)
      jvm 1 | at javax.naming.InitialContext.rebind(InitialContext.java:408)
      jvm 1 | at be.rmi.intranet.chain.setup.SharkSetup.execute(SharkSetup.java:56)
      jvm 1 | at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:166)
      jvm 1 | at be.rmi.intranet.servlet.SetupServlet.init(SetupServlet.java:298)

      The application am trying to migrate uses jndi to store objets created at startup that the whole application needs. Unfortunately, none of those objet are serializable and there is no reason to make them serialisable, since they are meant to be local to the JVM. According to JBoss docs i found on subjet, local VM / environment ressources are to be stored in the java:comp/env .

      This is what we do
      Binding shark at java:comp/env/Shark

      However, despite locality of objet, jboss complains it's not serializable. We can easily move those object to somewhere else in jndi so JBoss does not try to serialize them. But since those are proprietary objects, it's impossible or very difficult to make them serializable. Where should we store non serializable items in jndi? Or how can i tell jndi not to try to serialize objet (we don't need them to be remotely accessible or available in a cluster)

      Side question, how to convert this context.xml entry to jboss?
      <Environment name="conf/shark/GraphPictures" value="/home/intrarmi/shark-runtime/repository/png" type="java.lang.String" override="false" />