سؤال

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

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top