2

I created a java web project in netbeans, I created my entities beans and later deployed my project to generate my Database, this work was successful.

Then I generated my session beans to access the database created. I created a main class to test the session beans and when I tested the method "find" that I call through the session bean interface, I have noticed that some classes throws an exception, and I have noticed that the entities class with vars List throws the exception as if they could not be serialized.

I want to bring me List of entities is a request.

I have the entities bean in the same project that have a my session beans, in a web application...

I worked with Glass Fish 3.1.2
Netbeans 7.1.2
EclipseLink 2.0

The Entity Persistence is:

@Entity

public class UserApplication implements Serializable {

private static long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idUserApplication;
@Basic(optional=false)
@Column(nullable=false)
private String dcn;
@Basic(optional=false)
@Column(nullable=false)
private String password;
@Basic(optional=false)
@Column(nullable=false)
private String title ;
@Basic(optional=false)
@Column(nullable=false)
private String firstName;
@Basic(optional=false)
@Column(nullable=false)
private String lastName;
@Basic(optional=false)
@Column(nullable=false)
private String ci;
@Basic(optional=false)
@Column(nullable=false)
private String personalEmail;
@Basic(optional=false)
@Column(nullable=false)
private String workEmail;

@OneToMany
@JoinColumn(name = "userApplication_id", nullable = false)
private List<Account> accounts;
@OneToMany
@JoinColumn(name = "userApplication_id", nullable = true)
private List<CreditCard> creditCards = null;

@ManyToMany
@JoinTable(name="UserApplication_BeneficiaryThird", joinColumns=@JoinColumn
        (name="userApplication_id", nullable = false), inverseJoinColumns=
        @JoinColumn(name="beneficiaryThird_id", nullable = false))
private List<BeneficiaryThird> beneficiariesThird = null;

@OneToMany
@JoinColumn(name = "userApplication_id_beneficiary", nullable = true)
private List<BeneficiaryBankItself> beneficiariesBankItself = null;

@ManyToMany
@JoinTable(name="UserApplication_TransactionRule", joinColumns=@JoinColumn
        (name="userApplication_id", nullable = false), inverseJoinColumns=
        @JoinColumn(name="transactionRule_id", nullable = false))
private List<TransactionRule> transactionRules = null;

@OneToOne(mappedBy = "userApplication", optional = true, cascade = CascadeType.ALL)
private SessionCookie cookieId = null;................

The Main Class is:

public class Main {

public static void main(String[] args) {

    long id = 2;


    bank.setId(id);
    UserApplication userApplication = GetBean.getUserFacade().find(id);
    System.out.println("user: " + userApplication.getFirstName());


    }

}

The GetBean is utility class, is:

public class GetBean {



public static BankFacadeLocal getBankFacade() {

    BankFacadeLocal bankFacade = null;
    String jndiName = beans.BankFacadeLocal.class.getName();
    try {
         //bankFacade = (BankFacadeLocal) new InitialContext().lookup("java:global/IntegrationBanking/BankFacade!sessionBeans.BankFacadeLocal");
          bankFacade = (BankFacadeLocal) new InitialContext().lookup(jndiName);        
    } catch (NamingException ex) {
        Logger.getLogger(GetBean.class.getName()).log(Level.SEVERE, null, ex);
    }

    return bankFacade;
 }

 public static UserApplicationFacadeLocal getUserFacade() {

    UserApplicationFacadeLocal userFacade = null;
    String jndiName = UserApplicationFacadeLocal.class.getName();
    try {
         // userFacade = (UserApplicationFacadeLocal) new InitialContext().lookup("java:global/IntegrationBanking/UserApplicationFacade!beans.UserApplicationFacadeLocal");
         userFacade = (UserApplicationFacadeLocal) new InitialContext().lookup(jndiName);        
    } catch (NamingException ex) {
        Logger.getLogger(GetBean.class.getName()).log(Level.SEVERE, null, ex);
    }

    return userFacade;
} 

}

Peersistence Unit:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="BankingIntegrationPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>sqlServer</jta-data-source>
<properties>
  <property name="eclipselink.ddl-generation" value="create-tables"/>
</properties>
</persistence-unit>
</persistence>

The Exception is:

jul 26, 2012 2:55:38 PM com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator handleFullLogging
Advertencia: IOP00810011: Exception from readValue on ValueHandler in CDRInputStream
org.omg.CORBA.MARSHAL: Advertencia: IOP00810011: Exception from readValue on ValueHandler in CDRInputStream  vmcid: OMG  minor code: 11 completed: Maybe
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)............
Caused by: java.io.IOException: Mismatched serialization UIDs : Source (Rep. IDRMI:entities.UserApplication:5CDFA7C871B53786:F07C8D07E21B75FA) = F07C8D07E21B75FA whereas Target (Rep. ID RMI:entities.UserApplication:4357CF2703B83ACF:180694EF6A1B61BC) = 180694EF6A1B61BC
    at com.sun.corba.ee.impl.util.RepositoryId.useFullValueDescription(RepositoryId.java:679)
    at com.sun.corba.ee.impl.util.RepositoryId.useFullValueDescription(RepositoryId.java:639)
    at com.sun.corba.ee.impl.io.ValueHandlerImpl.useFullValueDescription(ValueHandlerImpl.java:360)
    at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:422)........
jul 26, 2012 2:55:38 PM com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator handleFullLogging
Advertencia: ORBIO00013: Stream corrupted
java.io.StreamCorruptedException: Advertencia: ORBIO00013: Stream corrupted
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)............
jul 26, 2012 2:55:38 PM com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator handleFullLogging
Advertencia: IOP00810011: Exception from readValue on ValueHandler in CDRInputStream
org.omg.CORBA.MARSHAL: Advertencia: IOP00810011: Exception from readValue on ValueHandler in CDRInputStream  vmcid: OMG  minor code: 11 completed: Maybe
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)............
Caused by: java.io.StreamCorruptedException: Advertencia: ORBIO00013: Stream corrupted
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)...........
Exception in thread "main" javax.ejb.EJBException: java.rmi.MarshalException: CORBA MARSHAL 1330446347 Maybe; nested exception is: 
    org.omg.CORBA.MARSHAL: Advertencia: IOP00810011: Exception from readValue on ValueHandler in CDRInputStream  vmcid: OMG  minor code: 11 completed: Maybe
    at beans._BeneficiaryBankItselfFacadeLocal_Wrapper.find(beans/_BeneficiaryBankItselfFacadeLocal_Wrapper.java)....................
Caused by: java.rmi.MarshalException: CORBA MARSHAL 1330446347 Maybe; nested exception is: 
    org.omg.CORBA.MARSHAL: Advertencia: IOP00810011: Exception from readValue on ValueHandler in CDRInputStream  vmcid: OMG  minor code: 11 completed: Maybe
    at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:267)...........
Caused by: org.omg.CORBA.MARSHAL: Advertencia: IOP00810011: Exception from readValue on ValueHandler in CDRInputStream  vmcid: OMG  minor code: 11 completed: Maybe
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)..................
Caused by: java.io.StreamCorruptedException: Advertencia: ORBIO00013: Stream corrupted
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)....................
gnat
  • 6,213
  • 108
  • 53
  • 73
Will86
  • 157
  • 1
  • 4
  • 13
  • I found in this link https://kr.forums.oracle.com/forums/thread.jspa?threadID=1571007 that explain more explicity the problem but don't have a solution yet – Will86 Jul 26 '12 at 21:15

1 Answers1

2

I may be off in my answer, but I experienced this issue and resolved it. For me, the issue was simply that my database was not connected! I tested this in Glassfish, confirmed the database connectivity issue and fixed it, and then this error went away.

As far as understanding why this is the cryptic error message we get, the following explanation may help:

  • First, entity beans (which are now superseded by using Java Persistence API) are a type of EJB and therefore are run in the EJB container.
  • Your main class exists outside the EJB container and must therefore "invoke" an EJB. It does this by using CORBA, the Common Object Request Broker Architecture
  • CORBA is built around the idea that you can remotely instantiate and manipulate objects. For example, you can create an EJB instance, set its member properties, run its methods, all from your main method which is outside the EJB container. CORBA is a general standard that in theory any "client" can use (e.g. a C++ program that makes a CORBA-compliant call could theoretically work here. But of course, most of us in the Java world are just using CORBA to get access to the EJB container.
  • The particular error you got is ORBIO00013: Stream corrupted, which I do not fully understand, but I take it to mean that your main program successfully connected to the EJB container, the EJB container threw an exception and then returned something that CORBA did not expect, and this corrupted the stream used to send the response.
  • The real issue is that CORBA didn't do a very good job handling the exception thrown in the EJB so the only way you can resolve this is to debug your program and find where in the EJB the exception is thrown, then look at the exception directly in the debugger.

Doing all of this ultimately helped me to understand that a simple database connection issue (!) was the problem.

Hope this helps, Josh

Josh Padnick
  • 3,157
  • 1
  • 25
  • 33