1

tomcat 6、spring 2.5.6、mavenを使用して簡単なWebアプリを作成します。

問題は、Tomcatを起動すると、次のエラーが発生することです。

SEVERE: StandardWrapper.Throwable
java.lang.NoClassDefFoundError: org/springframework/ui/ModelMap
...
Caused by: java.lang.ClassNotFoundException: org.springframework.ui.ModelMap

ModelMapクラスはとに存在しspring-2.5.6.jarますspring-context-2.5.6.jar。他にもいくつかのスプリングjarがあります。それらはすべてtomcatに正しくデプロイされています。アプリケーションWEB-INF(tomcatにデプロイされている)を確認すると、そこにすべてのjarが見つかりました。

メソッドを持つ@Controllerは1つだけ@RequestMapping("/home.htm") showForm(ModelMap model)です。私のapplicationContextは非常に単純です:

<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
              http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
              http://www.springframework.org/schema/aop 
              http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
              http://www.springframework.org/schema/context
              http://www.springframework.org/schema/context/spring-context-2.5.xsd
              http://www.directwebremoting.org/schema/spring-dwr
              http://www.directwebremoting.org/schema/spring-dwr-3.0.xsd"
    default-autowire="byName">

<context:component-scan base-package="org.myapp"/>
    <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/>
    <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/>

    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"></property>
        <property name="prefix" value="/WEB-INF/view/"></property>
        <property name="suffix" value=".jsp"></property>
    </bean>
</beans>
4

1 に答える 1

2

spring-2.5.6.jarすべてのSpringFrameworkを含むJARです。そのJARを使用する場合は、のような他のJARを使用しないでくださいspring-context-2.5.6.jar。これらの小さなJARは、必要なSpringのビットを選択する場合に使用できます。

JAR間のクラスの重複コピー間でクラスローダーが混乱している可能性があります。を除くすべてのSpringJARを取り出し、spring-2.5.6.jarそれが違いを生むかどうかを確認します。

于 2010-05-02T12:47:28.277 に答える