Failed to initialize MyFaces in OSGi evironment

View: New views
1 Messages — Rating Filter:   Alert me  

Failed to initialize MyFaces in OSGi evironment

by fisch3r :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there,

I use MyFaces (1.2.2) and Tomahawk (1.1.9) with Tomcat (6.0.18) in an OSGi environment (equinox). The tomcat runs as a bundle and works so far for jsps and servlets, even for SUNs RI. I store the myfaces and tomahawk jars in the WEB-INF/lib and added them to the classpath in the manifest. Everything else I import from the running bundles (JSTL 1.2, JSP 2.1, Servlet 2.5). The startup of MyFaces fails with the following message:

ERROR org.apache.myfaces.webapp.AbstractFacesInitializer  - An error occured while initializing MyFaces: null
java.lang.NullPointerException
        at org.apache.myfaces.webapp.Jsp21FacesInitializer.initContainerIntegration(Jsp21FacesInitializer.java:60)
        at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:83)
        at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:58)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
        at org.springframework.osgi.web.deployer.tomcat.TomcatWarDeployer.startCatalinaContext(TomcatWarDeployer.java:144)
        at org.springframework.osgi.web.deployer.tomcat.TomcatWarDeployer.startDeployment(TomcatWarDeployer.java:133)
        at org.springframework.osgi.web.deployer.support.AbstractWarDeployer.deploy(AbstractWarDeployer.java:93)
        at org.springframework.osgi.web.extender.internal.activator.WarLoaderListener$DeploymentManager$DeployTask.doRun(WarLoaderListener.java:257)
        at org.springframework.osgi.web.extender.internal.activator.WarLoaderListener$DeploymentManager$BaseTask.run(WarLoaderListener.java:222)
        at org.springframework.scheduling.timer.DelegatingTimerTask.run(DelegatingTimerTask.java:66)
        at java.util.TimerThread.mainLoop(Unknown Source)
        at java.util.TimerThread.run(Unknown Source)

I think the JspFactory or the JspApplicationContext is null.

My web.xml looks like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
        version="2.4">

        <display-name>Simple Osgi WebApp Bundle</display-name>
        <description>Simple OSGi War</description>
       
        <welcome-file-list>
                <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>
       
        <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>org.apache.myfaces.webapp.MyFacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
  </servlet-mapping>

        <listener>
                <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
        </listener>
       
        <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
       
        <listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
  </listener>

        <context-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>/META-INF/spring/context.xml</param-value>
        </context-param>

</web-app>

I also tried to use several versions of MyFaces (1.20, 1.25). Any ideas?