开发者

JSF 1.2 Tomcat redeployment error

开发者 https://www.devze.com 2023-02-14 01:59 出处:网络
I\'m using JSF 1.2 with Spring on Tomcat 6.0.18. I am able to successfully deploy my application on Tomcat, but when undeploying following error occurs:

I'm using JSF 1.2 with Spring on Tomcat 6.0.18. I am able to successfully deploy my application on Tomcat, but when undeploying following error occurs:


INFO  [org.apache.catalina.startup.HostConfig] Undeploying context [/myapp]
ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/myapp]] Error configuring application listener of class com.sun.faces.config.ConfigureListener
java.lang.NoClassDefFoundError: javax/faces/FacesException
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1847)
    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:890)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1354)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.newInstance0(Class.java:326)
    at java.lang.Class.newInstance(Class.java:308)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3787)
    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.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
    at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1217)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
    at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: javax.faces.FacesException
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
    ... 29 more

I am using Mojarra implementation of JSF, version 1.2_15. Here is my web.xml file:

<web-app>
        <display-name>my App</display-name>

        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>
                /WEB-INF/applicationContext.xml
            </param-value>
        </context-param>
        <context-param>
            <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
            <param-value>server</param-value>
        </context-param>
        <context-param>
            <param-name>javax.faces.CONFIG_FILES</param-name>
            <param-value>/WEB-INF/faces-config.xml</param-value>
        </context-param>


        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
</web-app>

If someone had similar problem, I would really appreciate a help regarding this issue. Thanx!

[Edit] After downgrading from JSF 1.2_15 to JSF 1.2_03-b09, deployment/undeployment seem to work fine, but I've still getting warning messages (i.e. I was getting the same messages also with 1.2_15, just before error messages). Here is the extract from log:

Undeployment:

INFO  [org.apache.catalina.startup.HostConfig] Undeploying context [/myapp]
INFO  [org.apache.catalina.startup.HostConfig] Undeploying context [/myapp]
WARN  [org.apache.catalina.startup.HostConfig] Error while removing context [/myapp]
java.lang.NullPointerException
    at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:915)
    at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1046)
    at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1214)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
    at java.lang.Thread.run(Thread.java:619)
2011-03-01 10:05:16,906 WARN  [org.apache.catalina.startup.HostConfig] Error during context [/myapp] destroy
java.lang.NullPointerException
    at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1052)
    at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1214)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
    at java.lang.Thread.run(Thread.java:619)

And just after that, when I'm executing deployment, here is the log:

INFO  [org.apache.catalina.startup.HostConfig] Deploying web application archive myapp.war
INFO  [org.apache.catalina.loader.WebappClassLoader] Illegal access: this web application instance has been stopped already.  Could not load java.lang.Object.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1273)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
    at com.sun.faces.application.ConverterPropertyEditorFactory$DisposableClassLoader.loadClass(ConverterPropertyEditorFactory.java:446)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.newInstance0(Class.java:326)
    at java.lang.Class.newInstance(Class.java:308)
    at java.beans.PropertyEditorManager.findEditor(PropertyEditorManager.java:79)
    at com.sun.faces.application.ApplicationImpl.addPropertyEditorIfNecessary(ApplicationImpl.java:697)
    at com.sun.faces.application.ApplicationImpl.addConverter(ApplicationImpl.java:668)
    at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:804)
    at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:544)
    at com开发者_开发问答.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:438)
    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.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:830)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:515)
    at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1231)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
    at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1471)
    at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:645)
    at org.apache.catalina.manager.ManagerServlet.doPut(ManagerServlet.java:432)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:640)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)

I've google a bit, and it seems it's errors are caused due to Tomcat version. Unfortunately, I'm not able to switch to newer version. Could someone advise me if it's possible to solve this errors Tomcat 6.0.18, that I'm using.


This is a sign of classpath pollution.

Ensure that you do not have duplicated JSF libraries anywhere else in the classpath, such as in JRE/lib and JRE/lib/ext folders (where JRE is the installation folder of your Java SE Runtime Environment), or in Tomcat/lib folder (where Tomcat is the installation folder of your Tomcat).

0

精彩评论

暂无评论...
验证码 换一张
取 消