Announcement Announcement Module
Collapse
No announcement yet.
ClassNotFoundException: org.springframework.web.servlet.HandlerAdapter Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ClassNotFoundException: org.springframework.web.servlet.HandlerAdapter

    I downloaded the testdrive for M2 and it runs fine as is. I then took an existing BlazeDS application (which works) and am trying to convert it to use the new namespace. I'm using Spring 2.5.5. I simply copied the org.springframework.flex-1.0.0.M2.jar to my WEB-INF/lib and edited my xml files. I noticed that in the testdrive sample code under WEB-INF/lib there are many org.springframework.*-3.0.0*.jar files, and under my WEB-INF/lib there is simply spring.jar. It seems like it cannot find this HandlerAdapter class but the documentation states clearly that this should work under Spring 2.5.5. Any ideas?


    Code:
    Apr 8, 2009 2:19:48 AM org.springframework.web.context.ContextLoader initWebApplicationContext
    SEVERE: Context initialization failed
    org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.flex.messaging.servlet.MessageBrokerHandlerAdapter] for bean with name '_messageBrokerHandlerAdapter' defined in null: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/springframework/web/servlet/HandlerAdapter
            at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1141)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:524)
            at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1174)
            at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:754)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:422)
            at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
            at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
            at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
            at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
            at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
            at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
            at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
            at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
            at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
            at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
            at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
            at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
            at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
            at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
            at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
            at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
            at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
            at org.apache.catalina.core.StandardService.start(StandardService.java:516)
            at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
            at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
            at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    Caused by: java.lang.NoClassDefFoundError: org/springframework/web/servlet/HandlerAdapter
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
            at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1847)
            at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:890)
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1354)
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
            at org.springframework.util.ClassUtils.forName(ClassUtils.java:242)
            at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:383)
            at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1135)
            ... 33 more
    Caused by: java.lang.ClassNotFoundException: org.springframework.web.servlet.HandlerAdapter
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
            ... 43 more

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
        <display-name>Test Server</display-name>
    
    	<filter>
    		<filter-name>springSecurityFilterChain</filter-name>
    		<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    	</filter>
    
    	<filter-mapping>
    		<filter-name>springSecurityFilterChain</filter-name>
    		<url-pattern>/*</url-pattern>
    	</filter-mapping>
    
    	<listener>
    		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    	</listener>
    
    	<servlet>
            <servlet-name>MessageBrokerServlet</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    	    <init-param>
    		  <param-name>contextConfigLocation</param-name>
    		  <param-value>/WEB-INF/applicationContext.xml</param-value>
         	</init-param>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
    
        <servlet-mapping>
            <servlet-name>MessageBrokerServlet</servlet-name>
            <url-pattern>/messagebroker/*</url-pattern>
        </servlet-mapping>
    
        <welcome-file-list>
            <welcome-file>index.html</welcome-file>
        </welcome-file-list>
    
     </web-app>


    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	   xmlns:flex="http://www.springframework.org/schema/flex"
    	   xmlns:security="http://www.springframework.org/schema/security"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="
    		http://www.springframework.org/schema/beans
    		http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    		http://www.springframework.org/schema/flex
    		http://www.springframework.org/schema/flex/spring-flex-1.0.xsd
    		http://www.springframework.org/schema/security
    		http://www.springframework.org/schema/security/spring-security-2.0.4.xsd">
    
    	<flex:message-broker>
    		<flex:secured />
    	</flex:message-broker>
    
    	<bean id="imageService" class="com.test.ImageService"
    		init-method="init">
    	</bean>
    
    	<flex:remote-service ref="imageService"  />
    
    </beans>

  • #2
    you need spring-webmvc.jar + its dependencies

    If you have downloaded spring, you need to review the readme.txt on dist + modules.

    Comment


    • #3
      Thanks. That fixed it!

      Comment

      Working...
      X