primefacesclassnotfoundexceptionapache-felixpax-web

Apache Felix + Pax Web + Primefaces: ClassNotFoundException FacesServlet


I am trying to deploy a simple primefaces (4.0) testapplicationon on the felix framework (4.2.1) with pax web (3.0.5). But I always get an ClassNotFoundException FacesServlet (and ConfigureListener). Although I have the right jar files in WEB-INF/lib and wrote them in Bundle-ClassPath too. So, please help me.

Manifest:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: testprime2
Bundle-SymbolicName: testprime2
Bundle-Version: 1.0.0.qualifier
Import-Package: javax.servlet, javax.servlet.http
Bundle-ClassPath: WEB_INF/classes, lib/jstl-1.2.jar, lib/primefaces-4.0.jar, lib/javax.faces.jar
Web-ContextPath: /testprime2
Webapp-Context: /testprime2

web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">

  <display-name>testprime2</display-name>

  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
  </servlet-mapping>

  <context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>

  <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  </listener>

</web-app>

Error Output:

6280 [pool-1-thread-1] ERROR org.ops4j.pax.web.extender.war.internal.RegisterWeb
AppVisitorWC - Registration exception. Skipping.
java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener not fou
nd by testprime2 [39]
        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDele
gation(BundleWiringImpl.java:1532)
        at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringIm
pl.java:75)
        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadCla
ss(BundleWiringImpl.java:1955)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1844)
        at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:937)
        at org.ops4j.pax.swissbox.core.BundleClassLoader.findClass(BundleClassLo
ader.java:176)
        at org.ops4j.pax.swissbox.core.BundleClassLoader.loadClass(BundleClassLo
ader.java:194)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at org.ops4j.pax.web.extender.war.internal.RegisterWebAppVisitorHS.loadC
lass(RegisterWebAppVisitorHS.java:244)
        at org.ops4j.pax.web.extender.war.internal.RegisterWebAppVisitorHS.newIn
stance(RegisterWebAppVisitorHS.java:215)
        at org.ops4j.pax.web.extender.war.internal.RegisterWebAppVisitorWC.visit
(RegisterWebAppVisitorWC.java:279)
        at org.ops4j.pax.web.extender.war.internal.model.WebApp.accept(WebApp.ja
va:644)
        at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$WebAppDepende
ncyListener.register(WebAppPublisher.java:237)
        at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$WebAppDepende
ncyListener.addingService(WebAppPublisher.java:182)
        at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$WebAppDepende
ncyListener.addingService(WebAppPublisher.java:135)
        at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(Service
Tracker.java:932)
        at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(Service
Tracker.java:864)
        at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.jav
a:256)
        at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.ja
va:183)
        at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:317)
        at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
        at org.ops4j.pax.web.extender.war.internal.WebAppPublisher.publish(WebAp
pPublisher.java:101)
        at org.ops4j.pax.web.extender.war.internal.WebObserver.deploy(WebObserve
r.java:213)
        at org.ops4j.pax.web.extender.war.internal.WebObserver$1.doStart(WebObse
rver.java:175)
        at org.ops4j.pax.web.extender.war.internal.extender.SimpleExtension.star
t(SimpleExtension.java:58)
        at org.ops4j.pax.web.extender.war.internal.extender.AbstractExtender$1.r
un(AbstractExtender.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
access$201(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
6304 [pool-1-thread-1] ERROR org.ops4j.pax.web.extender.war.internal.RegisterWeb
AppVisitorWC - Registration exception. Skipping.
java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet not found by t
estprime2 [39]
        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDele
gation(BundleWiringImpl.java:1532)
        at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringIm
pl.java:75)
        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadCla
ss(BundleWiringImpl.java:1955)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1844)
        at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:937)
        at org.ops4j.pax.swissbox.core.BundleClassLoader.findClass(BundleClassLo
ader.java:176)
        at org.ops4j.pax.swissbox.core.BundleClassLoader.loadClass(BundleClassLo
ader.java:194)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at org.ops4j.pax.web.extender.war.internal.RegisterWebAppVisitorHS.loadC
lass(RegisterWebAppVisitorHS.java:244)
        at org.ops4j.pax.web.extender.war.internal.RegisterWebAppVisitorWC.visit
(RegisterWebAppVisitorWC.java:224)
        at org.ops4j.pax.web.extender.war.internal.model.WebApp.accept(WebApp.ja
va:664)
        at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$WebAppDepende
ncyListener.register(WebAppPublisher.java:237)
        at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$WebAppDepende
ncyListener.addingService(WebAppPublisher.java:182)
        at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$WebAppDepende
ncyListener.addingService(WebAppPublisher.java:135)
        at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(Service
Tracker.java:932)
        at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(Service
Tracker.java:864)
        at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.jav
a:256)
        at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.ja
va:183)
        at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:317)
        at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
        at org.ops4j.pax.web.extender.war.internal.WebAppPublisher.publish(WebAp
pPublisher.java:101)
        at org.ops4j.pax.web.extender.war.internal.WebObserver.deploy(WebObserve
r.java:213)
        at org.ops4j.pax.web.extender.war.internal.WebObserver$1.doStart(WebObse
rver.java:175)
        at org.ops4j.pax.web.extender.war.internal.extender.SimpleExtension.star
t(SimpleExtension.java:58)
        at org.ops4j.pax.web.extender.war.internal.extender.AbstractExtender$1.r
un(AbstractExtender.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
access$201(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

Solution

  • I'm not sure that actually packaging those jsf bundles within the bundle is a good idea. Try to seperate those from the war, especially the lib/jstl-1.2.jar. As those packages needed should already be provided by Pax Web.