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)