0 Replies Latest reply on Feb 18, 2008 8:32 AM by Marcos Vinicius Dufloth

    java.io.InvalidClassException error

    Marcos Vinicius Dufloth Newbie

      Hi. I'm getting java.io.InvalidClassException in a class that is implementing Serializable and even creating serialUUID, the error remains. But if I deploy same project to Glassfish, all works fine. I'm using NetBeans and Hibernate as persistence. Below, the error log and my Expression and EqualsExpression class:

      public abstract class Expression implements java.io.Serializable {

      public abstract String phrase();

      public static Expression or(Expression left, Expression right) {
      return new OrExpression(left, right);
      }

      public static Expression and(Expression left, Expression right) {
      return new AndExpression(left, right);
      }

      public static Expression between(String property, Object initialValue, Object finalValue) {
      return new BetweenExpression(property, initialValue, finalValue);
      }

      public static Expression notBetween(String property, Object initialValue, Object finalValue) {
      return new NotBetweenExpression(property, initialValue, finalValue);
      }

      public static Expression eq(String property, Object value) {
      return new EqualsExpression(property, value);
      }

      public static Expression ne(String property, Object value) {
      return new NotEqualsExpression(property, value);
      }

      public static Expression ge(String property, Object value) {
      return new GreaterOrEqualThanExpression(property, value);
      }

      public static Expression gt(String property, Object value) {
      return new GreaterThanExpression(property, value);
      }

      public static Expression in(String property, List values) {
      return new InExpression(property, values);
      }

      public static Expression notIn(String property, List values) {
      return new NotInExpression(property, values);
      }

      public static Expression le(String property, Object value) {
      return new LessOrEqualThanExpression(property, value);
      }

      public static Expression lt(String property, Object value) {
      return new LessThanExpression(property, value);
      }

      public static Expression startingWith(String property, String value) {
      return new LikeExpression(property, value.concat("%"));
      }

      public static Expression containing(String property, String value) {
      return new LikeExpression(property, "%".concat(value).concat("%"));
      }

      public static Expression endingWith(String property, String value) {
      return new LikeExpression(property, "%".concat(value));
      }

      }

      public class EqualsExpression extends Expression {

      private String property;
      private Object value;

      public EqualsExpression(String property, Object value) {
      this.property = property;
      this.value = value;
      }

      public String phrase() {
      String v;
      if (value instanceof String)
      v = "'".concat(value.toString()).concat("'");
      else
      v = value.toString();
      String s = "(".concat(property).concat(" = ").concat(v).concat(")");
      return s;
      }

      }

      JBoss Error log:

      java.io.InvalidClassException: cyber.expression.EqualsExpression; cyber.expression.EqualsExpression; class invalid for deserialization
      java.lang.RuntimeException: java.io.InvalidClassException: cyber.expression.EqualsExpression; cyber.expression.EqualsExpression; class invalid for deserialization
      at org.jboss.aop.joinpoint.MethodInvocation.getArguments(MethodInvocation.java:272)
      at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:299)
      at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
      at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
      at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
      at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
      at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
      at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
      Caused by: java.io.InvalidClassException: cyber.expression.EqualsExpression; cyber.expression.EqualsExpression; class invalid for deserialization
      at java.io.ObjectStreamClass.checkDeserialize(ObjectStreamClass.java:713)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1733)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
      at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1667)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
      at java.rmi.MarshalledObject.get(MarshalledObject.java:142)
      at org.jboss.aop.joinpoint.MethodInvocation.getArguments(MethodInvocation.java:267)
      at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:299)
      at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
      at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
      at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
      at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
      at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
      at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
      at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
      at org.jboss.remoting.Client.invoke(Client.java:1634)
      at org.jboss.remoting.Client.invoke(Client.java:548)
      at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
      at $Proxy0.getCities(Unknown Source)
      at cyber.wms.ejb.CommonBeanTest.testGetCities(CommonBeanTest.java:90)
      at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
      at $Proxy0.getCities(Unknown Source)
      at cyber.wms.ejb.CommonBeanTest.testGetCities(CommonBeanTest.java:90)
      Caused by: java.io.InvalidClassException: cyber.expression.EqualsExpression; class invalid for deserialization
      at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:587)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
      at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1667)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
      at java.rmi.MarshalledObject.get(MarshalledObject.java:142)
      at org.jboss.aop.joinpoint.MethodInvocation.getArguments(MethodInvocation.java:267)
      at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:299)
      at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
      at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
      at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
      at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
      at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
      at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)