Cast Error after migration from Glassfish to TomEE

UI Components for JSF
Post Reply
Torsten-Hi
Posts: 2
Joined: 21 Aug 2014, 11:10

21 Aug 2014, 11:19

Hey,

I'm trying to migrate a simple application (using primefaces-4.0.jar & primefaces-extensions-1.2.1.jar) from Glassfish server to TomEE.
Now I'm getting a CAST Error like:

Code: Select all

org.primefaces.behavior.ajax.AjaxBehavior cannot be cast to org.primefaces.component.behavior.ajax.AjaxBehavior

viewId=/index.xhtml
location=C:\Users\t.blaus\Downloads\Apache TOMEE\apache-tomee-webprofile-1.6.0.2\webapps\WebTest\index.xhtml
phaseId=RENDER_RESPONSE(6)

Caused by:
java.lang.ClassCastException - org.primefaces.behavior.ajax.AjaxBehavior cannot be cast to org.primefaces.component.behavior.ajax.AjaxBehavior
 at org.primefaces.component.behavior.ajax.AjaxBehaviorHandler.createAjaxBehavior(AjaxBehaviorHandler.java:190)

Here the code:

Code: Select all

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>WebTest</title>
    </h:head>
    
    <h:body>
	
        <h:form id="pkForm">

            <p:ajaxStatus onstart="PF('statusDialog').show();" onsuccess="PF('statusDialog').hide();"/>  
            <p:dialog modal="false" widgetVar="statusDialog" showHeader="false"   
                      draggable="false" closable="false" resizable="false">  
                <p:graphicImage  library="images" name="ajax-loader.gif" />  
            </p:dialog>

            <p:panel header="Abteilungen (Projektkoordinator, Juli 2014):" style="width: 600px">
                <div style="border-style: solid; border-width: thin; padding: 2px; border-color: darkgrey">                
                    <p:dataTable id="abteilungenTable" value="#{testBean.abteilungen}"
                                 var="abteilungen" rowKey="#{abteilungen[0]}" 
                                 selectionMode="single" selection="#{testBean.currentAbteilung}" 
                                 scrollable="true" scrollHeight="200" 
                                 emptyMessage="Keine Abteilungs-Std. vorhanden.">

                        <p:ajax event="rowSelect" update=":pkForm:out"/>
                        <p:ajax event="rowUnselect" update=":pkForm:out"/>

                        <p:column headerText="*" footerText="&#160;" width="10%" style="text-align: center">
                            <h:outputText value="#{abteilungen[1]}"/>
                        </p:column>

                        <p:column headerText="AbtKZ" footerText="&#160;" width="15%">
                            <h:outputText value="#{abteilungen[2]}"/>
                        </p:column>

                        <p:column headerText="Bezeichnung" footerText="Std / Monat" width="55%">
                            <h:outputText value="#{abteilungen[3]}"/>
                        </p:column>

                        <p:column headerText="Std" footerText="#{testBean.getGesamtstunden(testBean.abteilungen, 4)}" width="20%" style="text-align: right">
                            <h:outputText value="#{abteilungen[4]}">
                                <f:convertNumber pattern="#0.0"/>
                            </h:outputText>
                        </p:column>
                    </p:dataTable>
                </div>
                <br/>
                <center>
                    <h:outputLabel for="out" value="AbtKZ: "/>
                    <h:outputText id="out" value="#{testBean.currentAbteilung[2]}"/>
                </center>
            </p:panel>

        </h:form>
    </h:body>
</html>
Under Glassfish it works fine and looks like this screenshotImage


Has anyone an idea to solve this issue?

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

21 Aug 2014, 14:51

looks like duplicate jar problem
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

21 Aug 2014, 16:50

tandraschko wrote:looks like duplicate jar problem
and,

are/were you using NetBeans to deploy the app to Glassfish, and now you are using another/newer version of NetBeans to deploy to TomEE?

were you using NetBeans 7.x to deploy to Glassfish, and now you are using NetBeans 8.x to deploy to TomEE?

did you add primefaces JAR to your WAR and tomee/lib?

do you have multiple versions of primefaces JAR in your WAR and/or tomee/lib?
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

Torsten-Hi
Posts: 2
Joined: 21 Aug 2014, 11:10

22 Aug 2014, 08:18

Yes, that was the reason.
WAR file includes primefaces version 5 and TomEE lib directory contains primefaces version 4.

Thanks a lot for your help, but sometimes you can't see a forest because of all trees before :-)

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

22 Aug 2014, 08:52

Well, you should not have to see the trees, nor the forest... When there unexcpected classacast errors in a framework, the first thing to always do is not look for trees or a forrest, but check for duplicate jars... Then you'll see the path instead of a dense unpeneterable wooden blockage ;-)

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 32 guests