在primefaces中使用addCallbackParam引发错误 [英] cast error with addCallbackParam in primefaces

查看:439
本文介绍了在primefaces中使用addCallbackParam引发错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的系统中使用requestContext演示示例 http://www.primefaces.org/showcase-labs/ui/requestContext.jsf

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

我遇到以下错误

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:]

运行Java命令时发生错误

the error occur when the java command running

RequestContext context = RequestContext.getCurrentInstance();

在jboss接缝2.3.0下使用primefaces-3.4.1.最终版本与Jboss AS 7.1一起

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

阿米尔

推荐答案

您在Web应用程序的运行时类路径中具有多个不同版本的PrimeFaces JAR文件.例如,一个PrimeFaces 3.3和另一个PrimeFaces 3.4.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.

清理webapp的运行时类路径,以便仅保留最新版本,并且此问题应消失.该Webapp运行时类路径默认覆盖的路径是该Webapp自己的/WEB-INF/lib文件夹,服务器和/或JRE自己的/lib/lib/ext文件夹.

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.

更新:另一个实际上更罕见的原因是,您有多个 same 版本的PrimeFaces JAR文件,它们是由不同的类加载器加载的.这两个类上的getClass()都将永远不会与==检查匹配.您需要删除两者之一.

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.

这篇关于在primefaces中使用addCallbackParam引发错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆