Announcement Announcement Module
Collapse
No announcement yet.
Librarys in pom.xml or in /lib Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Librarys in pom.xml or in /lib

    Hello.

    I want to use Spring with Maven in WebApp J2EE. I've this definition in the web.xml file.

    Code:
    	<servlet>
    		<servlet-name>AppSpring</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    		<init-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>/WEB-INF/configure/AppSpring-servlet.xml</param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
    	</servlet>
    	<servlet-mapping>
    		<servlet-name>AppSpring</servlet-name>
    		<url-pattern>/</url-pattern>
    	</servlet-mapping>
    And I included the dependencies in pom.xml.

    Code:
    		<!-- Spring framework -->
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring</artifactId>
    			<version>2.5.6</version>
    		</dependency>
    
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-web</artifactId>
    			<version>3.0.6.RELEASE</version>
    		</dependency>
    
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-core</artifactId>
    			<version>3.0.6.RELEASE</version>
    		</dependency>
    
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-webmvc</artifactId>
    			<version>3.0.6.RELEASE</version>
    		</dependency>
    
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-beans</artifactId>
    			<version>3.0.6.RELEASE</version>
    		</dependency>
    
    		<!-- Apache Tiles -->
    		<dependency>
    			<groupId>org.apache.tiles</groupId>
    			<artifactId>tiles-core</artifactId>
    			<version>2.2.2</version>
    		</dependency>
    But when I start the server Tomcat I recieve this error

    Code:
    java.lang.ClassNotFoundException: org.springframework.servlet.DispacherServlet
    If I copy org.springframework.web.servlet-3.0.0.M3.jar file in the /WEB-INF/lib directory, I don't recive the error for this class.

    Why this error? I need include this file in lib directory? I want to use Maven for managment dependecies. Thanks.

  • #2
    My initial thoughts are that something is either up with your classpath or you're doing something odd with web.xml. My reasons for thinking that are:
    - you're mixing and matching versions of spring
    - the exception has a different path to the dispatcher servlet then spring 3.0.6 does.

    Comment

    Working...
    X