aspose file tools*
The moose likes Spring and the fly likes ClassNotFoundException org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdaptor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "ClassNotFoundException org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdaptor" Watch "ClassNotFoundException org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdaptor" New topic
Author

ClassNotFoundException org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdaptor

Eshwara Chaluvaiah
Greenhorn

Joined: Jul 10, 2013
Posts: 16
i am learning spring mvc but when included the two classes in order to scan @RequestMapping annotation in class level and method level i am getting error..
these two classes are 1.org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdaptor 2. org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping
but if i remove org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdaptor class my application is working fine? but i am using both the classes in some other MVC application its working fine? so i am confused about org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdaptor class.. here is my xml file


<mvc:annotation-driven />
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" >
<property name="prefix" value="/" />
<property name="suffix" value=".jsp" />
</bean>
<context:component-scan base-package="controllers" />



</beans>

if the xml file look like above its working fine but if include AnnotationMethodHandlerAdaptor its showing error..
error looks like this..


org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': Invocation of init method failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdaptor] for bean with name 'org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdaptor#0' defined in ServletContext resource [/WEB-INF/spitter-servlet.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdaptor
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdaptor] for bean with name 'org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdaptor#0' defined in ServletContext resource [/WEB-INF/spitter-servlet.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdaptor
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1488)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:651)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:599)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:665)
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:518)
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:459)
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
javax.servlet.GenericServlet.init(GenericServlet.java:160)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
java.lang.Thread.run(Thread.java:662)
root cause
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30294
    
150

What version of spring-webmvc-x.y.z.jar do you have in your classpath?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Eshwara Chaluvaiah
Greenhorn

Joined: Jul 10, 2013
Posts: 16
i am using spring 3.2.2 release
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30294
    
150

Did you check for the spring-webmvc-3.2.2.jar specifically? Maybe you are using core spring and don't have all the jars?
Eshwara Chaluvaiah
Greenhorn

Joined: Jul 10, 2013
Posts: 16
sorry for late reply, i was bit busy.. ya i checked all, i have included same jars for some other project its working fine but its not working to this particular project.. i don't understand what the problem is?...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ClassNotFoundException org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdaptor