Java. Lang. illegalstateexception: No webapplicationcontext found: No contextloaderlistener registered

Source: Internet
Author: User

Sometimes this problem occurs when the program is running. Here, it is caused by the path problem,

 

Let's see what I changed.

Protected object getobj (string beanname) {<br/> string appxmlpath = "config/spring/applicationcontext. XML "; <br/> applicationcontext = new classpathxmlapplicationcontext (<br/> appxmlpath); <br/> // webapplicationcontext WAC = webapplicationcontextutils <br/> //. getrequiredwebapplicationcontext (getservletcontext (); <br/> // return WAC. getbean (beanname); <br/> return applicationcontext. getbean (beanname); <br/>}

Here, because I used the original method to obtain the path. XML also configures the path listening, but sometimes it cannot be obtained, which may cause such problems,

I hope you can pay more attention to it.

Severe: servlet. Service () for servlet assoecservlet threw exception
Java. Lang. illegalstateexception: No webapplicationcontext found: No contextloaderlistener registered?
At org. springframework. Web. Context. Support. webapplicationcontextutils. getrequiredwebapplicationcontext (webapplicationcontextutils. Java: 70)
At util. assoecservlet. getobj (assoecservlet. Java: 74)
At util. assoecservlet. outeccode (assoecservlet. Java: 51)
At util. assoecservlet. doget (assoecservlet. Java: 32)
At javax. servlet. http. httpservlet. Service (httpservlet. Java: 617)
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. struts2.dispatcher. filterdispatcher. dofilter (filterdispatcher. Java: 413)
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: 102)
At org. Apache. Catalina. Core. standardenginevalve. Invoke (standardenginevalve. Java: 109)
At org. Apache. Catalina. connector. coyoteadapter. Service (coyoteadapter. Java: 298)
At org. Apache. Coyote. http11.http11processor. Process (http11processor. Java: 852)
At org. Apache. Coyote. http11.http11protocol $ http11connectionhandler. Process (http11protocol. Java: 588)
At org.apache.tomcat.util.net. jioendpoint $ worker. Run (jioendpoint. Java: 489)
At java. Lang. thread. Run (thread. Java: 619)

 

 

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.