Results 1 to 2 of 2

Thread: Librarys in pom.xml or in /lib

  1. #1
    Join Date
    Jul 2011
    Posts
    8

    Default 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. #2
    Join Date
    Dec 2008
    Location
    New York City
    Posts
    134

    Default

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •