i在将maven依赖性添加到现有工作项目时遇到异常:
[2016-06-28T17:19:09.280+0200] [Payara Micro 4.1] [SEVERE] [AS-WEB-CORE-00037] [javax.enterprise.web.core] [tid: _ThreadID=17 _ThreadName=http-listener(7)] [timeMillis: 1467127149280] [levelValue: 1000] [[An exception or error occurred in the container during the request processing
java.lang.ClassCastException: cannot assign instance of java.lang.String to field org.primefaces.model.LazyDataModel.data of type java.util.List in instance of org.primefaces.showcase.view.data.datatable.LazyCarDataModel
at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStreamClass.java:2083)
at java.io.ObjectStreamClass.setObjFieldValues(ObjectStreamClass.java:1261)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1995)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1913)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1796)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1989)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1913)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1796)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
at java.util.HashMap.readObject(HashMap.java:1155)
at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1891)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1796)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
at java.util.HashMap.readObject(HashMap.java:1155)
at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1891)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1796)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1989)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1913)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1796)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
at org.apache.catalina.session.StandardSession.readRemainingObject(StandardSession.java:2079)
at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1987)
at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1891)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1796)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
at org.apache.catalina.session.StandardSession.deserialize(StandardSession.java:1274)
at org.apache.catalina.session.StoreBase.readSession(StoreBase.java:296)
at org.glassfish.web.ha.session.management.ReplicationStore.getSession(ReplicationStore.java:567)
at org.glassfish.web.ha.session.management.ReplicationStore.getSession(ReplicationStore.java:519)
at org.glassfish.web.ha.session.management.ReplicationStore.loadFromBackingStore(ReplicationStore.java:433)
at org.glassfish.web.ha.session.management.ReplicationStore.load(ReplicationStore.java:416)
at org.apache.catalina.session.PersistentManagerBase.doSwapIn(PersistentManagerBase.java:1215)
at org.apache.catalina.session.PersistentManagerBase.swapIn(PersistentManagerBase.java:1175)
at org.glassfish.web.ha.session.management.ReplicationManagerBase.findSession(ReplicationManagerBase.java:161)
at org.apache.catalina.connector.Request.isRequestedSessionIdValid(Request.java:2996)
at org.apache.catalina.connector.Request.parseSessionCookiesId(Request.java:4113)
at org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:672)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:354)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:283)
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:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
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:526)
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:591)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
at java.lang.Thread.run(Thread.java:724)
]]
我可以使用PrimeFaces 6.0展示重现异常,因此看来原因不在我的代码中。
这是用PrimeFaces展示的如何复制的方法:
下载PrimeFaces 6.0从Github出发。
向
pom.xml
添加一个Onmifaces依赖关系:<dependency> <groupId>org.omnifaces</groupId> <artifactId>omnifaces</artifactId> <version>2.3</version> </dependency>
从http://blog.payara.fish.fish/creating-uber-jar-jar-with-payara-micro添加Payara Micro Uber Jar创建的Maven代码
使用
mvn package
构建,然后从java -jar showcase-6.0.jar
开始现在,在Local主机上启动展示柜,然后打开数据表懒负载示例,您应该获得异常。
当删除综合依赖性时,不会发生exeption。并且它不是在Payara应用程序服务器上发生的,而是在Payara Micro。
上发生。所以我不确定错误是否在omnifaces,payara micro,primefaces或任何地方。
此行为是由<distributable>
标志引起的,该标志已添加到Omnifaces 2.1中,以支持在集群上运行。
这反过来又发现了PrimeFaces 6.0中的一些错误,PrimeFaces Showcase应用程序和Payara Micro。
- PrimeFaces 6.0新的
PhaseInfo
类实现Serializable
,但具有PhaseId
属性,该属性根本不是Serializable
。 - 在PrimeFaces展示中,有几个
Serializable
查看范围的bean,具有不可隔离的服务属性,例如CarService
中的CC_11在LazyView
中备份Bean在懒惰数据表演示页面后面的bean。 - Payara Micro似乎不考虑战争自己的
web.xml
是否具有<distributable>
标志集。如果未设置此标志,则容器不应将战争视为可分配的。
当您完全删除Ommnifaces时,PrimeFaces 6.0和PrimeFaces展示柜的序列化问题是可重现的,但是在PrimeFaces Showcase的web.xml
中设置<distributable>
标志。这些问题中的每一个都需要单独报告。我至少报告了PhaseInfo
问题为第1570期,并在您的Payara Micro问题上发表了评论。
在稍微相关的说明上,我还注意到PrimeFaces Showcase的web.xml
已将Mojarra特定的com.sun.faces.serializeServerState
设置为pom.xml
0。我尚未调查回到true
时的效果,但是false
的这种设置是不推荐的,因为它可能隐藏了与查看构建和状态管理有关的其他错误。