JSF 2.2 Maven Project in Eclipse with Prime Faces

Many links on the internet explain how to create a JSF 2.2 maven project using eclipse. Many of them also show the pom.xml maven file, for example:

https://www.youtube.com/watch?v=h0G7axXQO9E

http://www.mkyong.com/jsf2/primefaces/primefaces-hello-world-example/

http://qussay.com/2013/09/14/create-jsf-2-22015-maven-project-with-primefaces-3-5-using-eclipse/

http://javing.blogspot.co.at/2013/01/how-to-create-new-jsf-21-project-and.html

 

I am using JBoss 7.1.1, Ecipse Mars.1 (4.5.1) with an embeded Maven (3.3.3/1.6.2  20150902-0001).

I  followed the examples from the links above, and I always came across one and the same exception upon deploying my application:

09:34:40,391 WARN  [org.jboss.weld.deployer] (MSC service thread 1-5) JBAS016006: Could not load portable extension class com.sun.faces.application.view.ViewScopeExtension: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_79]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [rt.jar:1.7.0_79]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_79]
at java.lang.reflect.Constructor.newInstance(Constructor.java:526) [rt.jar:1.7.0_79]
at org.jboss.as.weld.deployment.processors.WeldPortableExtensionProcessor.loadExtension(WeldPortableExtensionProcessor.java:117) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.weld.deployment.processors.WeldPortableExtensionProcessor.loadAttachments(WeldPortableExtensionProcessor.java:100) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.weld.deployment.processors.WeldPortableExtensionProcessor.deploy(WeldPortableExtensionProcessor.java:86) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_79]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_79]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_79]
Caused by: java.lang.NoSuchMethodError: com.sun.faces.util.Util.isCdiOneOneOrGreater()Z
at com.sun.faces.application.view.ViewScopeExtension.<init>(ViewScopeExtension.java:77) [jsf-impl-2.2.12.jar:2.2.12]
… 13 more

The explanation of this exception is a class loader problem caused by the JSF implementation dependency introduced in the pom.xml:

<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.12</version>
</dependency>

JBoss 7.1.1. already comes shipped with a jsf implementation (to be found under modules/com/sun/jsf-impl/main), so deploying an application with an included jsf implementation jar confuses the JBoss class loader and it throws the exception given above.

 

 

 

Advertisements

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s