0 Replies Latest reply on Nov 6, 2007 11:45 PM by Anoop Kumar

    Cannot Serialise using XMLEncoder

    Anoop Kumar Newbie

      Hi

      I tried to serialize an object using XMLEncoder. I am using jboss/ejb platform for my application development. I am a fresher in this area.

      But when i tried to serialize the object i am getting the following error messages in the jboss console.

      java.lang.IllegalAccessException: Class java.beans.statement cannot access a member of class org.jdom.Element with modifier "protected".

      The class which I tried to serialize extends another super class. Initially, the default constructor of this super class was "protected". I changed it to public. But the same error is displayed. I also made all protected variables in the super class and the main class made public. But no use.

      Also, I am trying to serialise an existing object of my class to serialize. If I use a new object of this class, this problem is not seen. ie

      public void serialize(Test test) {
      encoder.serialize(test);
      }

      problem exists.

      If i use

      public void serialize(Test test) {
      encoder.serialize(new Test());
      }

      no problem is seen.

      Can anybody tell the cause of this problem ? If I use XStream, the serialization problem does not exist. But due to some reasons I have to use XMLEncoder

      Thanks
      Anoop