cast error with addCallbackParam in primefaces

社会主义新天地 提交于 2019-12-25 05:25:38

问题


Using the requestContext demo example in my system http://www.primefaces.org/showcase-labs/ui/requestContext.jsf

I am getting the following error

Caused by: java.lang.ClassCastException: org.primefaces.context.DefaultRequestContext cannot be cast to org.primefaces.context.RequestContext
at org.primefaces.context.RequestContext.getCurrentInstance(RequestContext.java:38) [primefaces-3.4.1.jar:]

the error occur when the java command running

RequestContext context = RequestContext.getCurrentInstance();

Using primefaces-3.4.1 under jboss seam 2.3.0.Final with Jboss AS 7.1

Amir


回答1:


You've multiple different versioned PrimeFaces JAR files in your webapp's runtime classpath. For example, one PrimeFaces 3.3 and another PrimeFaces 3.4.1. They're conflicting with each other.

Cleanup the webapp's runtime classpath so that only the most recent version remains and this problem should disappear. Paths which are by default covered by the webapp's runtime classpath are the webapp's own /WEB-INF/lib folder, server's and/or JRE's own /lib and /lib/ext folders.


Update: another, actually more rare, cause is that you've multiple PrimeFaces JAR files of the same version which are loaded by different classloaders. The getClass() on the both classes would then never match the == check. You'd need to remove one of both.



来源:https://stackoverflow.com/questions/13050640/cast-error-with-addcallbackparam-in-primefaces

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!