Announcement Announcement Module
Collapse
No announcement yet.
Issues using conext:component-scan with context:include/exclude filters? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Issues using conext:component-scan with context:include/exclude filters?

    This isn't directly a spring roo question but I ended up using spring roo as a starting point for some scaffolding to use within an existing spring 3.0.6 project.

    Spring roo had set up two component scans..

    one in root context:

    Code:
        <context:component-scan base-package="com.foo.bar">
            <context:exclude-filter expression="org.springframework.stereotype.Controller" type="annotation"/>
        </context:component-scan>
    and one in my servlet config:

    Code:
    <context:component-scan base-package="com.foo.bar" use-default-filters="false">
    	<context:include-filter expression="org.springframework.stereotype.Controller" type="annotation"/>
    </context:component-scan>
    However (under Tomcat6) when I use both of them, I get an error caught in one of the error jsps that doesn't seem to reveal much to me (nothing in the tomcat catalina log though.) Before I display the error, what DOES work however, is if I remove both of the sections above and just change to one component scan without any include/exclude filtering in my servlet config:

    <context:component-scan base-package="com.foo.bar"/> <---- WORKS

    Any idea what's going on that is causing this issue?

    Here is the error that is dumped:

    Code:
    com.foobar.iag.bei.dao.SurveyDaoImpl.findSurvey(SurveyDaoImpl.java:15) 
    com.foobar.iag.bei.service.SurveyServiceImpl.findSurvey(SurveyServiceImpl.java:16) 
    com.foobar.iag.bei.web.SurveyController.show(SurveyController.java:26) 
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    java.lang.reflect.Method.invoke(Method.java:597) 
    org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176) 
    org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436) 
    org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424) 
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790) 
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) 
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669) 
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:574) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:697) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:810) 
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) 
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) 
    org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) 
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) 
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) 
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) 
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) 
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) 
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) 
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) 
    org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) 
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) 
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) 
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) 
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) 
    org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175) 
    org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74) 
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) 
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) 
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) 
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) 
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) 
    org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) 
    org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) 
    org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) 
    java.lang.Thread.run(Thread.java:662)
Working...
X