-
May 29th, 2008, 02:45 AM
#1
JSF Problem with WebModule
Hi all
I'm trying to build my first JSF-WebApplication with SpringDM and SpringSource.
I managed to get all JSF bundles and my web application starts up.
I get the following error when I try to start the JSF Servlet:
org.apache.myfaces.webapp.StartupServletContextLis tener.unknown E Error initializing ServletContext
javax.faces.FacesException: java.lang.ClassNotFoundException: org.apache.myfaces.config.impl.digester.elements.F acesConfig
at org.apache.myfaces.config.FacesConfigurator.config ure(FacesConfigurator.java:144)
at org.apache.myfaces.webapp.StartupServletContextLis tener.initFaces(StartupServletContextListener.java :68)
at org.apache.myfaces.webapp.StartupServletContextLis tener.contextInitialized(StartupServletContextList ener.java:51)
at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4350)
at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:525)
at com.springsource.platform.servlet.tomcat.TomcatSer vletContainer.addContext(TomcatServletContainer.ja va:658)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.osgi.service.importer.internal .aop.ServiceInvoker.doInvoke(ServiceInvoker.java:5 9)
at org.springframework.osgi.service.importer.internal .aop.ServiceInvoker.invoke(ServiceInvoker.java:67)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
at org.springframework.aop.support.DelegatingIntroduc tionInterceptor.doProceed(DelegatingIntroductionIn terceptor.java:131)
So, SpringSource starts my app with Tomcat, Tomcat starts the MyFaces web listener, the web listeners read the JSF config using digester, but digester cannot find the myfaces-classes.
It's clear why digester does not find the myfaces-classes, because it has no import-package or dependency to myfaces.
But how do we solve the problem? How can MyFaces be used in that situation?
Regards Michael
-
May 29th, 2008, 03:03 AM
#2
JSF Problem with WebModule
Michael,
Is this in a WAR file or are you using a PAR-based application?
Rob
-
May 29th, 2008, 04:00 AM
#3
JSF Problem with WebModule
Its in a jar-File which is a web-module.
Here is my manifest:
Manifest-Version: 1.0
Import-Library: org.springframework.spring;version="[2.5.4,3.0.0)"
Bundle-ManifestVersion: 2
Bundle-Name: b06Skel Web Layer
Bundle-SymbolicName: com.basis06.skelRevamped.webLayer
Bundle-Vendor: basis06 AG
Import-Package: com.basis06.skelRevamped.serviceLayer,javax.faces. webapp,org.apache.myfaces.lifecycle; version="1.1.5",javax.faces.lifecycle,javax.faces. event,javax.faces,javax.faces.context
Import-Bundle: com.springsource.org.richfaces;version="3.1.4.GA"
Bundle-Version: 1.0.0.BUILD-20080509155958
Platform-ModuleType: Web
Web-ContextPath: webLayer
Web-ContextParams: javax.faces.DEFAULT_SUFFIX;param-value:=".xhtml",foo;param-value:="bar"
Web-Servlets: FacesServlet;servlet-class:="javax.faces.webapp.FacesServlet"; load-on-startup:="1";url-patterns:="/faces/*"
Web-SessionTimeout: 30
Web-WelcomeFiles: index.jsp
-
May 29th, 2008, 04:33 AM
#4
JSF Problem with WebModule
This is quite strange. Line 144 of FacesConfigurator is this:
142: } catch (SAXException e)
143: {
144: throw new FacesException(e);
145: }
So getting a ClassNotFoundException is a bit weird. Where are your myfaces and digester bundles coming from? Have you tried the MyFaces bundles from the Bundle Repository (http://www.springsource.com/repository)?
The problem looks to be that MyFaces configures Digester to use the context class loader rather than its own class loader - this is not a great idea in an OSGi environment.
I reported the error to the MyFaces team: https://issues.apache.org/jira/browse/MYFACES-1878
I also created a Platform issue to track this: https://issuetracker.springsource.com/browse/PLATFORM-57
As an interim solution you could try patching your MyFaces instance with my suggested fix.
Sorry I can't be of more help on this.
Rob
-
May 29th, 2008, 05:32 AM
#5
JSF Problem with WebModule
Thanks for your answer. I found another workaround in the meantime: I imported all the classes the digester needs. So my Manifest now looks like:
Manifest-Version: 1.0
Import-Library: org.springframework.spring;version="[2.5.4,3.0.0)"
Bundle-ManifestVersion: 2
Bundle-Name: b06Skel Web Layer
Bundle-SymbolicName: com.basis06.skelRevamped.webLayer
Bundle-Vendor: basis06 AG
Import-Package: com.basis06.skelRevamped.serviceLayer,javax.faces. render,javax.faces,javax.faces.event,javax.faces.c omponent,javax.faces.lifecycle,javax.faces.context ,javax.faces.application,javax.faces.el,org.apache .myfaces.taglib.core,org.apache.myfaces.taglib.htm l,org.apache.myfaces.context,org.apache.myfaces.li fecycle,org.apache.myfaces.renderkit,javax.faces.w ebapp,org.apache.myfaces.webapp,org.apache.myfaces .config.impl.digester.elements,org.apache.myfaces. application
Bundle-Version: 1.0.0.BUILD-20080509155958
Platform-ModuleType: Web
Web-ContextPath: webLayer
Import-Bundle: com.springsource.org.apache.commons.collections;ve rsion="3.2.0",com.springsource.org.apache.commons. digester;version="1.8.0"
Web-ContextParams: javax.faces.STATE_SAVING_METHOD;param-value:="server",org.ajax4jsf.SKIN;param-value:="blueSky"
Web-Servlets: FacesServlet;servlet-class:="javax.faces.webapp.FacesServlet"; load-on-startup:="1";url-patterns:="/faces/*"
Web-SessionTimeout: 30
Web-WelcomeFiles: index.jsp
Web-FilterMappings: resourceFilter;url-patterns:="/faces/*"
and now jsf works. (although my Import-Package line is not quite ugly).
-
May 29th, 2008, 06:25 AM
#6
JSF Problem with WebModule
That's a good workaround. You could simplify if you wanted by switching to Import-bundle for the faces and myfaces bundles - this should still work and will be a little less fragile if the myfaces internals change.
Rob
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules