java - HandlerInterceptorAdaptarer Spring - Invalid content was found starting with element 'bean' -
i'm trying make handlerinterceptoradaptarer work.
my class extends handlerinterceptoradapter
package br.com.caelum.tarefas.interceptor; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import org.springframework.web.servlet.handler.handlerinterceptoradapter; public class autorizadorinterceptor extends handlerinterceptoradapter{ public boolean prehandle(httpservletrequest request,httpservletresponse response,object controller){ string uri = request.getrequesturi(); if(uri.endswith("loginform") || uri.endswith("efetualogin") || uri.contains("resources")){ return true; } if(request.getsession().getattribute("usuariologado") != null){ return true; } return false; } }
after went servlet-context.xml , added
<interceptors> <bean class="br.com.caelum.tarefas.interceptor.autorizadorinterceptor" /> </interceptors>
the full servlet-context.xml became:
<?xml version="1.0" encoding="utf-8"?> <beans:beans xmlns="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <!-- dispatcherservlet context: defines servlet's request-processing infrastructure --> <!-- enables spring mvc @controller programming model --> <annotation-driven /> <!-- handles http requests /resources/** efficiently serving static resources in ${webapproot}/resources directory --> <resources mapping="/resources/**" location="/resources/" /> <!-- resolves views selected rendering @controllers .jsp resources in /web-inf/views directory --> <beans:bean class="org.springframework.web.servlet.view.internalresourceviewresolver"> <beans:property name="prefix" value="/web-inf/views/" /> <beans:property name="suffix" value=".jsp" /> </beans:bean> <context:component-scan base-package="br.com.caelum" /> <interceptors> <bean class="br.com.caelum.tarefas.interceptor.autorizadorinterceptor" /> </interceptors> </beans:beans>
for reference web.xml is
<?xml version="1.0" encoding="utf-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <!-- definition of root spring container shared servlets , filters --> <context-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/spring/root-context.xml</param-value> </context-param> <!-- creates spring container shared servlets , filters --> <listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener> <!-- processes application requests --> <servlet> <servlet-name>appservlet</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <init-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/spring/appservlet/servlet-context.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>appservlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> </web-app>
eclipse showing me:
cvc-complex-type.2.4.a: invalid content found starting element 'bean'. 1 of '{"http://www.springframework.org/ schema/beans":bean, "http://www.springframework.org/schema/ beans":ref, "http://www.springframework.org/schema/ mvc":interceptor}' expected.
when try run application get:
type exception report message servlet.init() servlet appservlet threw exception description server encountered internal error prevented fulfilling request. exception javax.servlet.servletexception: servlet.init() servlet appservlet threw exception org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:503) org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:79) org.apache.catalina.valves.abstractaccesslogvalve.invoke(abstractaccesslogvalve.java:610) org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:526) org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1078) org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:655) org.apache.coyote.http11.http11nioprotocol$http11connectionhandler.process(http11nioprotocol.java:222) org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun(nioendpoint.java:1566) org.apache.tomcat.util.net.nioendpoint$socketprocessor.run(nioendpoint.java:1523) java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) java.lang.thread.run(thread.java:745) root cause org.springframework.beans.factory.xml.xmlbeandefinitionstoreexception: line 34 in xml document servletcontext resource [/web-inf/spring/appservlet/servlet-context.xml] invalid; nested exception org.xml.sax.saxparseexception; linenumber: 34; columnnumber: 76; cvc-complex-type.2.4.a: invalid content found starting element 'bean'. 1 of '{"http://www.springframework.org/schema/beans":bean, "http://www.springframework.org/schema/beans":ref, "http://www.springframework.org/schema/mvc":interceptor}' expected. org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:396) org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:334) org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:302) org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:174) org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:209) org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:180) org.springframework.web.context.support.xmlwebapplicationcontext.loadbeandefinitions(xmlwebapplicationcontext.java:125) org.springframework.web.context.support.xmlwebapplicationcontext.loadbeandefinitions(xmlwebapplicationcontext.java:94) org.springframework.context.support.abstractrefreshableapplicationcontext.refreshbeanfactory(abstractrefreshableapplicationcontext.java:131) org.springframework.context.support.abstractapplicationcontext.obtainfreshbeanfactory(abstractapplicationcontext.java:522) org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:436) org.springframework.web.servlet.frameworkservlet.configureandrefreshwebapplicationcontext(frameworkservlet.java:631) org.springframework.web.servlet.frameworkservlet.createwebapplicationcontext(frameworkservlet.java:588) org.springframework.web.servlet.frameworkservlet.createwebapplicationcontext(frameworkservlet.java:645) org.springframework.web.servlet.frameworkservlet.initwebapplicationcontext(frameworkservlet.java:508) org.springframework.web.servlet.frameworkservlet.initservletbean(frameworkservlet.java:449) org.springframework.web.servlet.httpservletbean.init(httpservletbean.java:133) javax.servlet.genericservlet.init(genericservlet.java:158) org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:503) org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:79) org.apache.catalina.valves.abstractaccesslogvalve.invoke(abstractaccesslogvalve.java:610) org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:526) org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1078) org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:655) org.apache.coyote.http11.http11nioprotocol$http11connectionhandler.process(http11nioprotocol.java:222) org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun(nioendpoint.java:1566) org.apache.tomcat.util.net.nioendpoint$socketprocessor.run(nioendpoint.java:1523) java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) java.lang.thread.run(thread.java:745) root cause org.xml.sax.saxparseexception; linenumber: 34; columnnumber: 76; cvc-complex-type.2.4.a: invalid content found starting element 'bean'. 1 of '{"http://www.springframework.org/schema/beans":bean, "http://www.springframework.org/schema/beans":ref, "http://www.springframework.org/schema/mvc":interceptor}' expected. com.sun.org.apache.xerces.internal.util.errorhandlerwrapper.createsaxparseexception(errorhandlerwrapper.java:203) com.sun.org.apache.xerces.internal.util.errorhandlerwrapper.error(errorhandlerwrapper.java:134) com.sun.org.apache.xerces.internal.impl.xmlerrorreporter.reporterror(xmlerrorreporter.java:437) com.sun.org.apache.xerces.internal.impl.xmlerrorreporter.reporterror(xmlerrorreporter.java:368) com.sun.org.apache.xerces.internal.impl.xmlerrorreporter.reporterror(xmlerrorreporter.java:325) com.sun.org.apache.xerces.internal.impl.xs.xmlschemavalidator$xsierrorreporter.reporterror(xmlschemavalidator.java:458) com.sun.org.apache.xerces.internal.impl.xs.xmlschemavalidator.reportschemaerror(xmlschemavalidator.java:3237) com.sun.org.apache.xerces.internal.impl.xs.xmlschemavalidator.handlestartelement(xmlschemavalidator.java:1796) com.sun.org.apache.xerces.internal.impl.xs.xmlschemavalidator.emptyelement(xmlschemavalidator.java:766) com.sun.org.apache.xerces.internal.impl.xmlnsdocumentscannerimpl.scanstartelement(xmlnsdocumentscannerimpl.java:356) com.sun.org.apache.xerces.internal.impl.xmldocumentfragmentscannerimpl$fragmentcontentdriver.next(xmldocumentfragmentscannerimpl.java:2786) com.sun.org.apache.xerces.internal.impl.xmldocumentscannerimpl.next(xmldocumentscannerimpl.java:606) com.sun.org.apache.xerces.internal.impl.xmlnsdocumentscannerimpl.next(xmlnsdocumentscannerimpl.java:117) com.sun.org.apache.xerces.internal.impl.xmldocumentfragmentscannerimpl.scandocument(xmldocumentfragmentscannerimpl.java:510) com.sun.org.apache.xerces.internal.parsers.xml11configuration.parse(xml11configuration.java:848) com.sun.org.apache.xerces.internal.parsers.xml11configuration.parse(xml11configuration.java:777) com.sun.org.apache.xerces.internal.parsers.xmlparser.parse(xmlparser.java:141) com.sun.org.apache.xerces.internal.parsers.domparser.parse(domparser.java:243) com.sun.org.apache.xerces.internal.jaxp.documentbuilderimpl.parse(documentbuilderimpl.java:348) org.springframework.beans.factory.xml.defaultdocumentloader.loaddocument(defaultdocumentloader.java:75) org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:388) org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:334) org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:302) org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:174) org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:209) org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:180) org.springframework.web.context.support.xmlwebapplicationcontext.loadbeandefinitions(xmlwebapplicationcontext.java:125) org.springframework.web.context.support.xmlwebapplicationcontext.loadbeandefinitions(xmlwebapplicationcontext.java:94) org.springframework.context.support.abstractrefreshableapplicationcontext.refreshbeanfactory(abstractrefreshableapplicationcontext.java:131) org.springframework.context.support.abstractapplicationcontext.obtainfreshbeanfactory(abstractapplicationcontext.java:522) org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:436) org.springframework.web.servlet.frameworkservlet.configureandrefreshwebapplicationcontext(frameworkservlet.java:631) org.springframework.web.servlet.frameworkservlet.createwebapplicationcontext(frameworkservlet.java:588) org.springframework.web.servlet.frameworkservlet.createwebapplicationcontext(frameworkservlet.java:645) org.springframework.web.servlet.frameworkservlet.initwebapplicationcontext(frameworkservlet.java:508) org.springframework.web.servlet.frameworkservlet.initservletbean(frameworkservlet.java:449) org.springframework.web.servlet.httpservletbean.init(httpservletbean.java:133) javax.servlet.genericservlet.init(genericservlet.java:158) org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:503) org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:79) org.apache.catalina.valves.abstractaccesslogvalve.invoke(abstractaccesslogvalve.java:610) org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:526) org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1078) org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:655) org.apache.coyote.http11.http11nioprotocol$http11connectionhandler.process(http11nioprotocol.java:222) org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun(nioendpoint.java:1566) org.apache.tomcat.util.net.nioendpoint$socketprocessor.run(nioendpoint.java:1523) java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) java.lang.thread.run(thread.java:745)
i checked other questions, find of missing xmlns:beans="http://www.springframework.org/schema/beans" , mine there...
@edit changed servlet-context.xml
<interceptors> <interceptor> <beans:bean class="br.com.caelum.tarefas.interceptor.autorizadorinterceptor" /> </interceptor> </interceptors>
error showing now:
http status 500 - servlet.init() servlet appservlet threw exception type exception report message servlet.init() servlet appservlet threw exception description server encountered internal error prevented fulfilling request. exception javax.servlet.servletexception: servlet.init() servlet appservlet threw exception org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:503) org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:79) org.apache.catalina.valves.abstractaccesslogvalve.invoke(abstractaccesslogvalve.java:610) org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:526) org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1078) org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:655) org.apache.coyote.http11.http11nioprotocol$http11connectionhandler.process(http11nioprotocol.java:222) org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun(nioendpoint.java:1566) org.apache.tomcat.util.net.nioendpoint$socketprocessor.run(nioendpoint.java:1523) java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) java.lang.thread.run(thread.java:745) root cause org.springframework.beans.factory.xml.xmlbeandefinitionstoreexception: line 35 in xml document servletcontext resource [/web-inf/spring/appservlet/servlet-context.xml] invalid; nested exception org.xml.sax.saxparseexception; linenumber: 35; columnnumber: 83; cvc-complex-type.2.4.a: invalid content found starting element 'beans:bean'. 1 of '{"http://www.springframework.org/schema/mvc":mapping}' expected. org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:396) org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:334) org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:302) org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:174) org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:209) org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:180) org.springframework.web.context.support.xmlwebapplicationcontext.loadbeandefinitions(xmlwebapplicationcontext.java:125) org.springframework.web.context.support.xmlwebapplicationcontext.loadbeandefinitions(xmlwebapplicationcontext.java:94) org.springframework.context.support.abstractrefreshableapplicationcontext.refreshbeanfactory(abstractrefreshableapplicationcontext.java:131) org.springframework.context.support.abstractapplicationcontext.obtainfreshbeanfactory(abstractapplicationcontext.java:522) org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:436) org.springframework.web.servlet.frameworkservlet.configureandrefreshwebapplicationcontext(frameworkservlet.java:631) org.springframework.web.servlet.frameworkservlet.createwebapplicationcontext(frameworkservlet.java:588) org.springframework.web.servlet.frameworkservlet.createwebapplicationcontext(frameworkservlet.java:645) org.springframework.web.servlet.frameworkservlet.initwebapplicationcontext(frameworkservlet.java:508) org.springframework.web.servlet.frameworkservlet.initservletbean(frameworkservlet.java:449) org.springframework.web.servlet.httpservletbean.init(httpservletbean.java:133) javax.servlet.genericservlet.init(genericservlet.java:158) org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:503) org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:79) org.apache.catalina.valves.abstractaccesslogvalve.invoke(abstractaccesslogvalve.java:610) org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:526) org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1078) org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:655) org.apache.coyote.http11.http11nioprotocol$http11connectionhandler.process(http11nioprotocol.java:222) org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun(nioendpoint.java:1566) org.apache.tomcat.util.net.nioendpoint$socketprocessor.run(nioendpoint.java:1523) java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) java.lang.thread.run(thread.java:745) root cause org.xml.sax.saxparseexception; linenumber: 35; columnnumber: 83; cvc-complex-type.2.4.a: invalid content found starting element 'beans:bean'. 1 of '{"http://www.springframework.org/schema/mvc":mapping}' expected. com.sun.org.apache.xerces.internal.util.errorhandlerwrapper.createsaxparseexception(errorhandlerwrapper.java:203) com.sun.org.apache.xerces.internal.util.errorhandlerwrapper.error(errorhandlerwrapper.java:134) com.sun.org.apache.xerces.internal.impl.xmlerrorreporter.reporterror(xmlerrorreporter.java:437) com.sun.org.apache.xerces.internal.impl.xmlerrorreporter.reporterror(xmlerrorreporter.java:368) com.sun.org.apache.xerces.internal.impl.xmlerrorreporter.reporterror(xmlerrorreporter.java:325) com.sun.org.apache.xerces.internal.impl.xs.xmlschemavalidator$xsierrorreporter.reporterror(xmlschemavalidator.java:458) com.sun.org.apache.xerces.internal.impl.xs.xmlschemavalidator.reportschemaerror(xmlschemavalidator.java:3237) com.sun.org.apache.xerces.internal.impl.xs.xmlschemavalidator.handlestartelement(xmlschemavalidator.java:1796) com.sun.org.apache.xerces.internal.impl.xs.xmlschemavalidator.emptyelement(xmlschemavalidator.java:766) com.sun.org.apache.xerces.internal.impl.xmlnsdocumentscannerimpl.scanstartelement(xmlnsdocumentscannerimpl.java:356) com.sun.org.apache.xerces.internal.impl.xmldocumentfragmentscannerimpl$fragmentcontentdriver.next(xmldocumentfragmentscannerimpl.java:2786) com.sun.org.apache.xerces.internal.impl.xmldocumentscannerimpl.next(xmldocumentscannerimpl.java:606) com.sun.org.apache.xerces.internal.impl.xmlnsdocumentscannerimpl.next(xmlnsdocumentscannerimpl.java:117) com.sun.org.apache.xerces.internal.impl.xmldocumentfragmentscannerimpl.scandocument(xmldocumentfragmentscannerimpl.java:510) com.sun.org.apache.xerces.internal.parsers.xml11configuration.parse(xml11configuration.java:848) com.sun.org.apache.xerces.internal.parsers.xml11configuration.parse(xml11configuration.java:777) com.sun.org.apache.xerces.internal.parsers.xmlparser.parse(xmlparser.java:141) com.sun.org.apache.xerces.internal.parsers.domparser.parse(domparser.java:243) com.sun.org.apache.xerces.internal.jaxp.documentbuilderimpl.parse(documentbuilderimpl.java:348) org.springframework.beans.factory.xml.defaultdocumentloader.loaddocument(defaultdocumentloader.java:75) org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:388) org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:334) org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:302) org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:174) org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:209) org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:180) org.springframework.web.context.support.xmlwebapplicationcontext.loadbeandefinitions(xmlwebapplicationcontext.java:125) org.springframework.web.context.support.xmlwebapplicationcontext.loadbeandefinitions(xmlwebapplicationcontext.java:94) org.springframework.context.support.abstractrefreshableapplicationcontext.refreshbeanfactory(abstractrefreshableapplicationcontext.java:131) org.springframework.context.support.abstractapplicationcontext.obtainfreshbeanfactory(abstractapplicationcontext.java:522) org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:436) org.springframework.web.servlet.frameworkservlet.configureandrefreshwebapplicationcontext(frameworkservlet.java:631) org.springframework.web.servlet.frameworkservlet.createwebapplicationcontext(frameworkservlet.java:588) org.springframework.web.servlet.frameworkservlet.createwebapplicationcontext(frameworkservlet.java:645) org.springframework.web.servlet.frameworkservlet.initwebapplicationcontext(frameworkservlet.java:508) org.springframework.web.servlet.frameworkservlet.initservletbean(frameworkservlet.java:449) org.springframework.web.servlet.httpservletbean.init(httpservletbean.java:133) javax.servlet.genericservlet.init(genericservlet.java:158) org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:503) org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:79) org.apache.catalina.valves.abstractaccesslogvalve.invoke(abstractaccesslogvalve.java:610) org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:526) org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1078) org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:655) org.apache.coyote.http11.http11nioprotocol$http11connectionhandler.process(http11nioprotocol.java:222) org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun(nioendpoint.java:1566) org.apache.tomcat.util.net.nioendpoint$socketprocessor.run(nioendpoint.java:1523) java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) java.lang.thread.run(thread.java:745) note full stack trace of root cause available in apache tomcat/8.0.9 logs. apache tomcat/8.0.9
made work chaing xml to:
<interceptors> <beans:bean class="br.com.caelum.tarefas.interceptor.autorizadorinterceptor"></beans:bean> </interceptors>
the full xml:
<?xml version="1.0" encoding="utf-8"?> <beans:beans xmlns="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <!-- dispatcherservlet context: defines servlet's request-processing infrastructure --> <!-- enables spring mvc @controller programming model --> <annotation-driven /> <!-- handles http requests /resources/** efficiently serving static resources in ${webapproot}/resources directory --> <resources mapping="/resources/**" location="/resources/" /> <!-- resolves views selected rendering @controllers .jsp resources in /web-inf/views directory --> <beans:bean class="org.springframework.web.servlet.view.internalresourceviewresolver"> <beans:property name="prefix" value="/web-inf/views/" /> <beans:property name="suffix" value=".jsp" /> </beans:bean> <context:component-scan base-package="br.com.caelum" /> <interceptors> <beans:bean class="br.com.caelum.tarefas.interceptor.autorizadorinterceptor"></beans:bean> </interceptors> </beans:beans>
Comments
Post a Comment