EJB应用程序中的CORBA异常

时间:2014-05-13 09:58:41

标签: netbeans glassfish ejb marshalling corba

我遇到了EJB / Glassfish的问题。我正在开发一个客户端 - 服务器应用程序,其中客户端创建一个实体对象,并且必须将其发送到服务器应用程序,该应用程序必须将该实体持久保存在其数据库中。我选择使用会话bean与服务器通信。 我已经实现了一些简单的情况,其中会话bean中的方法将字符串或int作为输入,它工作正常。当我尝试将实体对象作为输入时出现问题。

我报告我的实体类:

@Entity
public class Example implements Serializable {
private static final long serialVersionUID = 1L;
@Id
String nome;

public void setNome(String nome) {
    this.nome = nome;
}

public String getNome() {
    return nome;
}

这是我的会话bean:

 @Stateless
 public class GestoreLibreriaRemoto implements GestoreLibreriaRemotoRemote {

 @Override
 public String getProva(Example prova) {
    return prova.getNome();
 }

这是我的客户端应用程序:

public class GestoreLibreriaLocale {

public static void assegnaCategoriaACopia(CopiaUtente copia, Categoria categoria) throws 

public void prova() {
   GestoreLibreriaRemotoRemote gestore = lookupGestoreLibreriaRemotoRemote();
   Example example = new Example();
   prova.setNome("hodor");
   System.out.println(gestore.getProva(example));
}

private  GestoreLibreriaRemotoRemote lookupGestoreLibreriaRemotoRemote() {
    try {
        Context c = new InitialContext();
        return (GestoreLibreriaRemotoRemote) c.lookup("java:global/ServerMDB/ServerMDB-ejb/GestoreLibreriaRemoto");
    } catch (NamingException ne) {
        Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
        throw new RuntimeException(ne);
    }
}

在我的主要课程中,我只是调用GestoreLibreriaLocale.prova(),我收到以下错误:

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.glassfish.appclient.client.acc.AppClientContainer.launch(AppClientContainer.java:446)
at org.glassfish.appclient.client.AppClientFacade.main(AppClientFacade.java:166)
    Caused by: javax.ejb.EJBException: java.rmi.MarshalException: CORBA MARSHAL 1330446346     Maybe; nested exception is: 
org.omg.CORBA.MARSHAL: ----------BEGIN server-side stack trace----------
    org.omg.CORBA.MARSHAL: AVVERTENZA: 00810010: Error from readValue on ValueHandler in     CDRInputStream  vmcid: OMG  minor code: 10 completed: Maybe
at com.sun.proxy.$Proxy139.valuehandlerReadError(Unknown Source)
    at    com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:912)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1005)
at com.sun.corba.ee.impl.encoding.CDRInputObject.read_value(CDRInputObject.java:518)
at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl$14.read(DynamicMethodMarshallerImpl.java:383)
at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl.readArguments(DynamicMethodMarshallerImpl.java:450)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:171)
at com.sun.corba.ee.impl.protocol.ServerRequestDispatcherImpl.dispatchToServant(ServerRequestDispatcherImpl.java:528)
at com.sun.corba.ee.impl.protocol.ServerRequestDispatcherImpl.dispatch(ServerRequestDispatcherImpl.java:199)
at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleRequestRequest(MessageMediatorImpl.java:1549)
at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleRequest(MessageMediatorImpl.java:1425)
at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleInput(MessageMediatorImpl.java:930)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:213)
at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleRequest(MessageMediatorImpl.java:694)
at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.dispatch(MessageMediatorImpl.java:496)
at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.doWork(MessageMediatorImpl.java:2222)
at com.sun.corba.ee.impl.threadpool.ThreadPoolImpl$WorkerThread.performWork(ThreadPoolImpl.java:497)
at com.sun.corba.ee.impl.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:540)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.sun.corba.ee.impl.io.IIOPInputStream
at com.sun.corba.ee.impl.io.ValueHandlerImpl.createInputStream(ValueHandlerImpl.java:820)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:263)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:903)
... 16 more

错误日志继续,我不报告整个日志,但如果你需要它,我可以发布它。 请帮助我,我正在努力解决这个问题。 谢谢你的关注, 弗朗西斯

1 个答案:

答案 0 :(得分:4)

这似乎是当前Java版本中的一个错误(例如1.7.0_551.8.0_05),请看一下这个问题:GLASSFISH-21047

要使其正常运行,请安装较旧或较新的Java版本(例如1.7.0_0511.8.0_020)。

另见: