ACEGI-SPRING ERROR: PLS HELP (No adapter for handler)
843811Jan 16 2007 — edited Jan 16 2007I am very new to spring and acegi. Im getting the following error while trying to access my application after deploying. Im using Spring 2.0.1, acegi-security-1.0.0-RC2, eclipse 3.1 and the jetty server.
The error is as follows
HTTP ERROR: 500
No adapter for handler [springweb.controller.IndexController@1716fa0]: Does your handler implement a supported interface like Controller?
RequestURI=/index.htm
Caused by:
javax.servlet.ServletException: No adapter for handler [springweb.controller.IndexController@1716fa0]: Does your handler implement a supported interface like Controller?
at org.springframework.web.servlet.DispatcherServlet.getHandlerAdapter(DispatcherServlet.java:856)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:683)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:625)
at org.springframework.web.servlet.FrameworkServlet.serviceWrapper(FrameworkServlet.java:386)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:346)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:459)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1054)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:292)
at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:79)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:143)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:246)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:220)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:173)
at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1045)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:358)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:231)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:629)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:453)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:123)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:141)
at org.mortbay.jetty.Server.handle(Server.java:303)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:452)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:721)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:509)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:349)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:320)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)
Powered by Jetty://
Here is the code for the dispatcher-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- Controller definitions -->
<bean id="simpleControllerHandlerAdapter" class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"/>
<bean id="indexController"
class="springweb.controller.IndexController">
<property name="greeting">
<value>Welcome to the Demo App!!</value>
</property>
</bean>
<bean id="logoutController"
class="springweb.controller.LogoutController" />
<bean id="initParamSubmitController"
class="springweb.controller.InitParamSubmitController" />
<bean id="paramSubmitController"
class="springweb.controller.ParamSubmitController">
<property name="sessionForm">
<value>false</value>
</property>
<property name="commandName">
<value>simplePersonForm</value>
</property>
<property name="commandClass">
<value>springweb.form.SimplePersonForm</value>
</property>
<property name="validator">
<bean
class="springweb.form.validator.SimplePersonFormValidator" />
</property>
<property name="formView">
<value>initparamsubmit</value>
</property>
<property name="successView">
<value>/secure/app/paramsubmit.htm</value>
</property>
</bean>
<bean id="initAdminController"
class="springweb.controller.InitAdminController" />
<!-- URL Mapping definition -->
<bean id="simpleUrlMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/index.htm">indexController</prop>
<prop key="/logout.htm">logoutController</prop>
<prop key="/secure/app/initparamsubmit.htm">
initParamSubmitController
</prop>
<prop key="/secure/app/paramsubmit.htm">
paramSubmitController
</prop>
<prop key="/secure/admin/initadmin.htm">
initAdminController
</prop>
</props>
</property>
</bean>
<!-- View Resolver definition -->
<bean id="xmlViewResolver"
class="org.springframework.web.servlet.view.XmlViewResolver">
<property name="location">
<value>/WEB-INF/springweb-views.xml</value>
</property>
</bean>
<!-- ****** START ACEGI Security Configuration *******-->
<!-- ======================== FILTER CHAIN ======================= -->
<!-- if you wish to use channel security, add "channelProcessingFilter," in front
of "httpSessionContextIntegrationFilter" in the list below -->
<bean id="filterChainProxy"
class="org.acegisecurity.util.FilterChainProxy">
<property name="filterInvocationDefinitionSource">
<value>
CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
PATTERN_TYPE_APACHE_ANT
/**=httpSessionContextIntegrationFilter,formAuthenticationProcessingFilter,exceptionTranslationFilter,filterSecurityInterceptor
</value>
</property>
</bean>
<!-- Start Security filter config -->
<bean id="exceptionTranslationFilter"
class="org.acegisecurity.ui.ExceptionTranslationFilter">
<property name="authenticationEntryPoint">
<ref bean="formLoginAuthenticationEntryPoint" />
</property>
</bean>
<!-- Define filter to handle BASIC authentication -->
<bean id="basicProcessingFilter"
class="org.acegisecurity.ui.basicauth.BasicProcessingFilter">
<property name="authenticationManager">
<ref bean="authenticationManager" />
</property>
<property name="authenticationEntryPoint">
<ref bean="authenticationEntryPoint" />
</property>
</bean>
<!-- Define realm for BASIC login-->
<bean id="authenticationEntryPoint"
class="org.acegisecurity.ui.basicauth.BasicProcessingFilterEntryPoint">
<property name="realmName">
<value>Spring Web Realm</value>
</property>
</bean>
<!-- Define filter to handle FORM authentication -->
<bean id="formAuthenticationProcessingFilter"
class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilter">
<property name="filterProcessesUrl">
<value>/j_acegi_security_check</value>
</property>
<property name="authenticationFailureUrl">
<value>/loginFailed.html</value>
</property>
<property name="defaultTargetUrl">
<value>/</value>
</property>
<property name="authenticationManager">
<ref bean="authenticationManager" />
</property>
</bean>
<!-- Define realm for FORM login-->
<bean id="formLoginAuthenticationEntryPoint"
class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint">
<property name="loginFormUrl">
<value>/login.jsp</value>
</property>
<property name="forceHttps">
<value>false</value>
</property>
</bean>
<bean id="httpSessionContextIntegrationFilter"
class="org.acegisecurity.context.HttpSessionContextIntegrationFilter">
</bean>
<!-- End Security filter config -->
<!-- Start Security interceptor config -->
<!-- Define authentication manager, decision manager and secure URL patterns -->
<bean id="filterSecurityInterceptor"
class="org.acegisecurity.intercept.web.FilterSecurityInterceptor">
<property name="authenticationManager">
<ref bean="authenticationManager" />
</property>
<property name="accessDecisionManager">
<ref bean="accessDecisionManager" />
</property>
<property name="objectDefinitionSource">
<value>
CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
PATTERN_TYPE_APACHE_ANT
/secure/admin/*=ROLE_ADMIN
/secure/app/*=ROLE_USER
</value>
</property>
</bean>
<!-- End Security interceptor config -->
<!-- Start authentication config -->
<bean id="authenticationManager"
class="org.acegisecurity.providers.ProviderManager">
<property name="providers">
<list>
<ref bean="daoAuthenticationProvider" />
</list>
</property>
</bean>
<bean id="daoAuthenticationProvider"
class="org.acegisecurity.providers.dao.DaoAuthenticationProvider">
<property name="userDetailsService">
<ref bean="userDetailsService" />
</property>
</bean>
<!-- Authentication using In-memory Dao -->
<bean id="userDetailsService"
class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl">
<property name="userMap">
<value>
jklaassen=4moreyears,ROLE_ADMIN
bouerj=ineedsleep,ROLE_USER
</value>
</property>
</bean>
<!-- Authentication using JDBC Dao -->
<!-- <bean id="userDetailsService"
class="org.acegisecurity.userdetails.jdbc.JdbcDaoImpl">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
</bean>
-->
<!-- End authentication config -->
<!-- Start authorization config -->
<bean id="accessDecisionManager"
class="org.acegisecurity.vote.UnanimousBased">
<property name="decisionVoters">
<list>
<ref bean="roleVoter" />
</list>
</property>
</bean>
<bean id="roleVoter" class="org.acegisecurity.vote.RoleVoter">
<property name="rolePrefix">
<value>ROLE_</value>
</property>
</bean>
<!-- End authorization config -->
<!-- ****** END ACEGI Security Configuration *******-->
<!-- DataSource definition -->
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://localhost:3306/springweb_auth_db</value>
</property>
<property name="username">
<value>j2ee</value>
</property>
<property name="password">
<value>password</value>
</property>
</bean>
</beans>
and this is my IndexController java file where the error was allegedly found
package springweb.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.mortbay.jetty.Handler;
import org.springframework.web.servlet.HandlerAdapter;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;
import org.springframework.web.servlet.mvc.Controller;
public class IndexController extends AbstractController {
private String greeting;
public void setGreeting(String greeting)
{
this.greeting = greeting;
}
protected ModelAndView handleRequestInternal(HttpServletRequest arg0, HttpServletResponse arg1) throws Exception {
return new ModelAndView("index", "message", greeting); }
}
PLS HELP!!!