gpt4 book ai didi

java - 为什么我得到一个 EJB java.rmi.MarshalException : CORBA MARSHAL exception?

转载 作者:行者123 更新时间:2023-12-05 07:50:01 25 4
gpt4 key购买 nike

我正在尝试使用也有几个图像的 JSP 页面添加项目。我声明了变量以将图像检索为字符串,这样我就可以获得 URL 并将该 URL 存储在数据库中。

我将 EJB 和 JPA 用于数据库用途。

我的 servlet 代码

ItemDetails id;
ItemBeanRemote ib;
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

String id = request.getParameter("id");
String name = request.getParameter("name");
double price = Double.valueOf(request.getParameter("price"));
String imgurl = request.getParameter("imgurl");
String imgurl2 = request.getParameter("imgurl2");
String location = request.getParameter("loc");

id = new ItemDetails(id, name, price, imgurl, imgurl2, location);

ib.addItem(id);
response.sendRedirect("View.jsp");

}

@Override
public void init() {
try {
Context initial = new InitialContext();
ib = (ItemBeanRemote) initial.lookup("itembean");
} catch (Exception ex) {
System.err.println("Caught an exception:");
ex.printStackTrace();
}

//具有addItem 方法代码的ejb 类

@Override
public void addEvent(ItemDetails details) {
try {
tblItem utt = new tblItem(details.getItemID(),details.getItemName(),
details.getPrice(),details.getImgUrl(),details.getImgUrl2(),details.getLocation());
em.persist(utt);
} catch (Exception ex) {
throw new EJBException(ex);
}

//item details是一个class是一个有getters和setters的POJO

//tblItem 是使用实体管理器创建的 java 类,该管理器具有从 JPA 自动生成的代码。

还有异常(exception)

javax.ejb.EJBException: java.rmi.MarshalException: CORBA MARSHAL 1330446343 No; nested exception is: org.omg.CORBA.MARSHAL: ----------BEGIN server-side stack trace---------- org.omg.CORBA.MARSHAL: FINE: 00810007: Underflow in BufferManagerReadStream after last fragment in message vmcid: OMG minor code: 7 completed: No at com.sun.proxy.$Proxy154.endOfStream(Unknown Source) at com.sun.corba.ee.impl.encoding.BufferManagerReadStream.underflow(BufferManagerReadStream.java:122) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_1.grow(CDRInputStream_1_1.java:111) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_2.alignAndCheck(CDRInputStream_1_2.java:126) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_long(CDRInputStream_1_0.java:433) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readValueTag(CDRInputStream_1_0.java:1672) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:918) 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.SharedCDRClientRequestDispatcherImpl.marshalingComplete(SharedCDRClientRequestDispatcherImpl.java:119) at com.sun.corba.ee.impl.protocol.ClientDelegateImpl.invoke(ClientDelegateImpl.java:258) at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:198) at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:150) at com.sun.corba.ee.impl.presentation.rmi.codegen.CodegenStubBase.invoke(CodegenStubBase.java:226) at com.olympics2016.beans.__EventBeanRemote_Remote_DynamicStub.addEvent(com/olympics2016/beans/__EventBeanRemote_Remote_DynamicStub.java) at com.olympics2016.beans._EventBeanRemote_Wrapper.addEvent(com/olympics2016/beans/_EventBeanRemote_Wrapper.java) at com.olympics2016.servlets.AddEventServlet.doPost(AddEventServlet.java:42) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282) at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167) at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201) at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175) at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235) at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201) at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133) at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112) at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561) at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545) at java.lang.Thread.run(Thread.java:745)

----------END server-side stack trace---------- vmcid: OMG minor code: 7 completed: No

最佳答案

Marshal Exception 可能由于以下原因之一而发生:1) 当完成远程方法调用并且没有对 Java 对象进行编码(marshal)处理时,因此参数或返回值将不会到达远程方法或服务器。

2) 如果我们在 RMI 中使用的协议(protocol)在发送方和接收方的版本不同。

关于java - 为什么我得到一个 EJB java.rmi.MarshalException : CORBA MARSHAL exception?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36604894/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com