EJB3.1 NotSerializableException

时间:2013-05-19 18:14:30

标签: ejb serializable

我收到此错误,我不知道如何修复:

  

java.io.NotSerializableException:   com.procc.dao。 EJB31_Generated_ AlertFacade _Intf _ Bean _ at   java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)     在   java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)     在   java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)     在   java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)     在   java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)     在   java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)     在java.util.HashMap.writeObject(HashMap.java:1100)at   sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)     在   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:601)at   java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:975)     在   java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)     在   java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)     在   java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)     在   java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)     在   java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)     在   java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)     在   java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)     在   java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1362)     在   java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1170)     在   java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)     在java.util.HashMap.writeObject(HashMap.java:1100)at   sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)     在   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:601)at   java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:975)     在   java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)     在   java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)     在   java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)     在   java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)     在   com.sun.faces.renderkit.ClientSideStateHelper.doWriteState(ClientSideStateHelper.java:325)     在   com.sun.faces.renderkit.ClientSideStateHelper.writeState(ClientSideStateHelper.java:173)     在   com.sun.faces.renderkit.ResponseStateManagerImpl.writeState(ResponseStateManagerImpl.java:122)     在   com.sun.faces.application.StateManagerImpl.writeState(StateManagerImpl.java:166)     在   com.sun.faces.application.view.WriteBehindStateWriter.flushToWriter(WriteBehindStateWriter.java:225)     在   com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:419)     在   com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)     在   com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)     在com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)at   com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)     在javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)at   org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)     在   org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)     在   org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)     在   org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)     在   org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)     在   org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)     在   org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)     在   org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)     在   com.sun.enterprise.v3.services.impl.ContainerMapper $ AdapterCallable.call(ContainerMapper.java:317)     在   com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)     在   com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)     在   com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)     在   com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)     在   com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)     在   com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)     在   com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)     在   com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)     在   com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)     在   com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)     在   com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)     在com.sun.grizzly.ContextTask.run(ContextTask.java:71)at   com.sun.grizzly.util.AbstractThreadPool $ Worker.doWork(AbstractThreadPool.java:532)     在   com.sun.grizzly.util.AbstractThreadPool $ Worker.run(AbstractThreadPool.java:513)     在java.lang.Thread.run(Thread.java:722)

这是AlertFacade:

  

@Stateless公共类AlertFacade扩展AbstractFacade {       @PersistenceContext(unitName =" flams_pu")       私有EntityManager em;

@Override
protected EntityManager getEntityManager() {
    return em;
}

public AlertFacade() {
    super(Alert.class);
} }

我在JSF Managed bean中使用。

是EJB应该是Serializable吗?我不明白。 请帮忙

1 个答案:

答案 0 :(得分:1)

我会尝试添加到类签名implements Serializable。由于它是一个标记接口,因此您不必实现任何方法。