Netbeans で Java Web プロジェクトを作成し、エンティティ Bean を作成し、後でプロジェクトを展開してデータベースを生成しました。この作業は成功しました。
次に、作成したデータベースにアクセスするためのセッション Bean を生成しました。セッション Bean をテストするためのメイン クラスを作成しました。セッション Bean インターフェイスを介して呼び出すメソッド「find」をテストしたところ、いくつかのクラスが例外をスローすることに気付きました。シリアル化できなかったかのように例外が発生します。
持ってきてほしい エンティティのリストはリクエストです。
Web アプリケーションで、私のセッション Bean を持つ同じプロジェクトにエンティティ Bean があります...
Glass Fish 3.1.2
Netbeans 7.1.2
EclipseLink 2.0 で作業しました
エンティティの永続性は次のとおりです。
@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;................
主なクラスは次のとおりです。
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());
}
}
GetBean はユーティリティ クラスです。
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;
}
}
ピアシスタンス ユニット:
<?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>
例外は次のとおりです。
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)....................