No Webapplicationcontext Found:no Contextloaderli

Source: Internet
Author: User

Keep a record of the whole process of solving the problem with your Tomcat deployment
First, when deploying a project on a tomcat deployment, the following error is reported:
Severity: Error Listenerstart
2014-7-24 14:25:44 org.apache.catalina.core.StandardContext Start
Severity: Context [/filemanager] startup failed due to previous errors
Check that the version of the problem, will be web-inf under the web.

<listener>        <listener-class>org.springframework.web.context.contextloaderlistener </ Listener-class>    </listener>

Switch

<listener>        <listener-class>org.springframework.web.context.contextloaderservlet</ Listener-class> </listener>

On it, as a result of the deployment process, the system reported the following error:
2014-7-24 14:15:24 org.apache.catalina.core.StandardWrapperValve invoke
Critical: Servlet.service () for servlet FileUpload threw exception
Java.lang.IllegalStateException:No Webapplicationcontext Found:no Contextloaderlistener registered?

At Java.lang.Thread.run (thread.java:619) at Org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.lookupSessionFactory ( opensessioninviewfilter.java:221) at Org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.lookupSessionFactory ( opensessioninviewfilter.java:207) at Org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal ( opensessioninviewfilter.java:146) at Org.springframework.web.filter.OncePerRequestFilter.doFilter ( onceperrequestfilter.java:76) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter ( applicationfilterchain.java:235) 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.core.StandardHostValve.invoke (standardhostvalve.java:127) at Org.apache.catalina.valves.ErrorReportValve.invoke (Errorreportvalve.java:103) at Org.apache.catalina.core.StandardEngineValve.invoke (standardenginevalve.java:109) at Org.apache.catalina.connector.CoyoteAdapter.service (coyoteadapter.java:293) at Org.apache.coyote.http11.Http11Processor.process (http11processor.java:861) at Org.apache.coyote.http11.http11protocol$http11connectionhandler.process (http11protocol.java:606) at Org.apache.tomcat.util.net.jioendpoint$worker.run (jioendpoint.java:489) at Java.lang.Thread.run (thread.java:619)

Find a lot of ways, and finally only will:

<listener-class>org.springframework.web.context.ContextLoaderServlet</listener-class>


Into:

<servlet><servlet-name>springcontextservlet </servlet-name><servlet-class> Org.springframework.web.context.contextloaderservlet</servlet-class><load-on-startup>1 </ Load-on-startup>

As a result, the following error was reported in the deployment project:
Severity: standardwrapper.throwable
Org.springframework.beans.factory.BeanCreationException:Error creating Bean with Name ' sessionfactory ' defined in ServletContext resource [/web-inf/applicationcontext.xml]: Initialization of Bean failed; Nested exception is Java.lang.noclassdeffounderror:org/apache/commons/collections/map/lrumap
Java.lang.noclassdeffounderror:org/apache/commons/collections/map/lrumap

At Java.lang.reflect.Method.invoke (method.java:597) at org.hibernate.util.simplemrucache.<init> ( simplemrucache.java:55) at org.hibernate.engine.query.queryplancache.<init> (QueryPlanCache.java:76) at Org.hibernate.impl.sessionfactoryimpl.<init> (sessionfactoryimpl.java:239) at Org.hibernate.cfg.Configuration.buildSessionFactory (configuration.java:1872) at Org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory (localsessionfactorybean.java:800) At Org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet (Localsessionfactorybean.java : 726) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods ( abstractautowirecapablebeanfactory.java:1059) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean ( abstractautowirecapablebeanfactory.java:363) at Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (abstractbeanfactory.java:226) at Org.springframework.beanS.factory.support.abstractbeanfactory.getbean (abstractbeanfactory.java:147) at Org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons ( defaultlistablebeanfactory.java:269) at Org.springframework.context.support.AbstractApplicationContext.refresh ( abstractapplicationcontext.java:320) at Org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh ( abstractrefreshablewebapplicationcontext.java:134) at Org.springframework.web.context.ContextLoader.createWebApplicationContext (contextloader.java:246) at Org.springframework.web.context.ContextLoader.initWebApplicationContext (contextloader.java:184) at Org.springframework.web.context.ContextLoaderServlet.init (contextloaderservlet.java:83) at Javax.servlet.GenericServlet.init (genericservlet.java:212) at Org.apache.catalina.core.StandardWrapper.loadServlet (standardwrapper.java:1206) at Org.apache.catalina.core.StandardWrapper.load (standardwrapper.java:1026) at Org.apache.catalina.core.StandaRdcontext.loadonstartup (standardcontext.java:4421) at Org.apache.catalina.core.StandardContext.start ( standardcontext.java:4734) at Org.apache.catalina.core.ContainerBase.addChildInternal (containerbase.java:799) at Org.apache.catalina.core.ContainerBase.addChild (containerbase.java:779) at Org.apache.catalina.core.StandardHost.addChild (standardhost.java:601) at Org.apache.catalina.startup.HostConfig.deployDirectory (hostconfig.java:1079) at Org.apache.catalina.startup.HostConfig.deployDirectories (hostconfig.java:1002) at Org.apache.catalina.startup.HostConfig.deployApps (hostconfig.java:506) at Org.apache.catalina.startup.HostConfig.start (hostconfig.java:1317) at Org.apache.catalina.startup.HostConfig.lifecycleEvent (hostconfig.java:324) at Org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent (lifecyclesupport.java:142) at Org.apache.catalina.core.ContainerBase.start (containerbase.java:1065) at Org.apache.catalina.core.StandardHost.start (standardhost.java:840) at Org.apache.catalina.core.ContaineRbase.start (containerbase.java:1057) at Org.apache.catalina.core.StandardEngine.start (standardengine.java:463) at Org.apache.catalina.core.StandardService.start (standardservice.java:525) at Org.apache.catalina.core.StandardServer.start (standardserver.java:754) at Org.apache.catalina.startup.Catalina.start (catalina.java:595) 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.catalina.startup.Bootstrap.start (Bootstrap.java : 289) at Org.apache.catalina.startup.Bootstrap.main (bootstrap.java:414)

caused By:java.lang.ClassNotFoundException:org.apache.commons.collections.map.LRUMap

At Java.lang.ClassLoader.loadClassInternal (classloader.java:320) at Org.apache.catalina.loader.WebappClassLoader.loadClass (webappclassloader.java:1526) at Java.lang.ClassLoader.loadClassInternal (classloader.java:320) ... More

Baidu on a good long time, the final confirmation is: In the Commons-collections-2.1.1.jar package found the Lrumap.class file but he did not in the map folder but directly placed under the collections. Later changed a bag Commons-collections-3.1.jar. Problem solving.
And then, I have a whim to web-inf/web.xml in the

<servlet-name>springcontextservlet </servlet-name><servlet-class> Org.springframework.web.context.contextloaderservlet</servlet-class><load-on-startup>1 </ Load-on-startup>


Changed back to the

<listener-class>org.springframework.web.context.ContextLoaderListene</listener-class>


The result is all right, everything is fine.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.