users@glassfish.java.net

Glassfish, JPA and MarshalException

From: <glassfish_at_javadesktop.org>
Date: Wed, 13 Aug 2008 08:34:52 PDT

I have a problem with an enterprise application deployment. I am using:
 - server: Sun Java System Application Server 9.1_02 (build b04-fcs), i.e., Glassfish, on jdk1.6.0_07
 - client: jdk1.6.0_06

I reduced the problem to the following. I have a client application which invokes a single method of a stateless bean: it should return a ConversionOutcome object, which is also an @Entity. Now the bean only instantiates a new ConversionOutcome object and returns it. The problem occurs only if I inject the dependency of the PersistenceContext, even if the ConversionOutcome object is not persisted.
I suppose that the problem could hide itself in the class SerializableImage, despite I have reduced it to an almost empty class, because if I set it as transient in its referencing class, the error changes. Moreover, it seems that the error occurs on the client side, while the request is being packed, because I saw, by adding some logging, that nothing occurs on the server side.
Again, if I remove the PersistenceContext injection, all goes regular.

Here are the relevant sources and the stack trace.

Thanks in advance for any help.

[code]
@Stateless
public class OcrConverterBean implements OcrConverterRemote {
    
  @PersistenceContext private EntityManager em; //the error disappears when I comment this line

  @Override
  public ConversionOutcome convert(Document document) throws ConversionException {
    ConversionOutcome conversionOutcome = new ConversionOutcome();
    return conversionOutcome;
  }

}
[/code]

[code]
@Entity
public class Document implements Serializable {

  private static final long serialVersionUID = 100L;

  @Id @GeneratedValue private long id;
  @OneToMany(cascade=CascadeType.ALL) private List<Page> pages;

  [...]
}
[/code]

[code]
@Entity
public class Page implements Serializable {

  private static final long serialVersionUID = 100L;

  @Id @GeneratedValue private long id;
  @ManyToOne private Document document;
  @Lob @Column(columnDefinition="MEDIUMBLOB") private SerializableImage image = new SerializableImage();

  [...]
}
[/code]

[code]
public class SerializableImage implements Serializable {
  
  private static final long serialVersionUID = 104L;
          
  //private transient BufferedImage bufferedImage = null;
  //private byte[] imageContent = null;
  //private float resolution = 300F;
        
  public SerializableImage() {
  }
        
  public SerializableImage(BufferedImage bufferedImage) {
    setBufferedImage(bufferedImage);
  }

  public BufferedImage getBufferedImage() {
    //if (bufferedImage==null) {
    // bufferedImage = SerializationUtils.deserializeBufferedImage(imageContent);
    //}
    //return bufferedImage;
    return new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
  }

  public void setBufferedImage(BufferedImage bufferedImage) {
    //imageContent = SerializationUtils.serializeBufferedImage(bufferedImage);
    //this.bufferedImage = bufferedImage;
  }

  public float getResolution() {
    return 300F; //resolution;
  }

  public void setResolution(float resolution) {
    //this.resolution = resolution;
  }

}
[/code]

Stack-trace:
[pre]
WARNING 13/08 16:52:25 ClientStarter Cannot elaborate file '039.tif': nested exception is: java.rmi.MarshalException: CORBA MARSHAL 1398079699 Maybe; nested exception is:
        org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 211 completed: Maybe
javax.ejb.EJBException: nested exception is: java.rmi.MarshalException: CORBA MARSHAL 1398079699 Maybe; nested exception is:
        org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 211 completed: Maybe
java.rmi.MarshalException: CORBA MARSHAL 1398079699 Maybe; nested exception is:
        org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 211 completed: Maybe
        at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:279)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:205)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
        at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:225)
        at it.units.sdc.ejb.__OcrConverterRemote_Remote_DynamicStub.convert(it/units/sdc/ejb/__OcrConverterRemote_Remote_DynamicStub.java)
        at it.units.sdc.ejb._OcrConverterRemote_Wrapper.convert(it/units/sdc/ejb/_OcrConverterRemote_Wrapper.java)
        at it.units.sdc.client.ClientStarter.run(ClientStarter.java:91)
        at it.units.sdc.client.ClientStarter.main(ClientStarter.java:62)
Caused by: org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 211 completed: Maybe
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.valuehandlerReadException(ORBUtilSystemException.java:8428)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:973)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1052)
        at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:475)
        at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl$14.read(DynamicMethodMarshallerImpl.java:368)
        at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl.readResult(DynamicMethodMarshallerImpl.java:466)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:195)
        ... 6 more
Caused by: java.io.StreamCorruptedException:
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields(IIOPInputStream.java:2352)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectUsingFVD(IIOPInputStream.java:1548)
        at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:420)
        at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:362)
        at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:328)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:966)
        ... 11 more
Caused by: org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:9684)
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:9699)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1042)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:896)
        at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:466)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectField(IIOPInputStream.java:1879)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields(IIOPInputStream.java:2297)
        ... 16 more
javax.ejb.EJBException: nested exception is: java.rmi.MarshalException: CORBA MARSHAL 1398079699 Maybe; nested exception is:
        org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 211 completed: Maybe
        at it.units.sdc.ejb._OcrConverterRemote_Wrapper.convert(it/units/sdc/ejb/_OcrConverterRemote_Wrapper.java)
        at it.units.sdc.client.ClientStarter.run(ClientStarter.java:91)
        at it.units.sdc.client.ClientStarter.main(ClientStarter.java:62)
[/pre]
[Message sent by forum member 'ermed' (ermed)]

http://forums.java.net/jive/thread.jspa?messageID=293068