Announcement Announcement Module
Collapse
No announcement yet.
Error starting Tomcat Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error starting Tomcat

    Hello,

    we want to start a webapplication with spring-mvc and having a spring-batch application at once.
    Tomcat fails to start, it seems to be version conflict error.

    Code:
    rz 30, 2012 4:06:28 PM org.apache.catalina.startup.Catalina start
    Information: Server startup in 32 ms
    Mrz 30, 2012 4:06:38 PM org.apache.catalina.startup.HostConfig deployDescriptor
    Information: Deploying configuration descriptor \bla\tomcat\Unnamed_spike-springbatch\conf\Catalina\localhost\ROOT.xml
    16:06:38,541  INFO pool-2-thread-1 DispatcherServlet:301 - FrameworkServlet 'Spring MVC Dispatcher Servlet': initialization started
    
    
    Mrz 30, 2012 4:06:38 PM org.apache.catalina.core.ApplicationContext log
    java.lang.NoSuchMethodError: org.springframework.web.context.ConfigurableWebApplicationContext.setId(Ljava/lang/String;)V
    	at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:430)
    	at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458)
    The pom.xml contains the following dependencies:
    Code:
    <!--  Spring -->
            <dependency>
                <groupId>org.springframework.batch</groupId>
                <artifactId>spring-batch-core</artifactId>
                <version>${spring.batch.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.batch</groupId>
                <artifactId>spring-batch-integration</artifactId>
                <version>1.2.1.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.batch</groupId>
                <artifactId>spring-batch-infrastructure</artifactId>
                <version>${spring.batch.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-webmvc</artifactId>
                <version>${spring.framework.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-jdbc</artifactId>
                <version>${spring.framework.version}</version>
            </dependency>
            <!--<dependency>-->
                <!--<groupId>org.springframework.batch</groupId>-->
                <!--<artifactId>spring-batch-admin-resources</artifactId>-->
                <!--<version>1.2.1.RELEASE</version>-->
            <!--</dependency>-->
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>5.1.18</version>
            </dependency>
    
            <!-- Servlet -->
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>servlet-api</artifactId>
                <version>2.5</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.servlet.jsp</groupId>
                <artifactId>jsp-api</artifactId>
                <version>2.1</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>jstl</artifactId>
                <version>1.2</version>
            </dependency>
    
    
        <properties>
            <spring.batch.version>2.1.7.RELEASE</spring.batch.version>
            <spring.framework.version>3.0.5.RELEASE</spring.framework.version>
            <spring.integration.version>2.0.3.RELEASE</spring.integration.version>
        </properties>
    how can the problem be solved?

    cheers, kieran

  • #2
    It sure looks like a version problem. I use this , and it works perfectly fine

    Code:
    <properties>
    		<java-version>1.6</java-version>
    		<org.springframework-version>3.0.5.RELEASE</org.springframework-version>
    		<spring.batch.version>2.1.8.RELEASE</spring.batch.version>
    		<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
    		<org.aspectj-version>1.6.9</org.aspectj-version>
    		<org.slf4j-version>1.5.10</org.slf4j-version>
    	</properties>

    Comment


    • #3
      I suggest check your dependency tree there is probably a mix of spring versions available..

      Comment


      • #4
        Check the spring jars in your web applications lib file and also check the tomcats lib file to see if the jars are overridden as Marten rightly pointed.

        If all is well, do check if your system's classpath have any reference to spring jars

        As sambaran pointed, using all the versions at one place as properties will sort out all the dependency issues in spring.

        With new versions of spring 3.1.x, most of the spring jars now have a common version, which is right way forward according to me to avoid confusions in versions.

        Comment


        • #5
          Hello,

          @sambaran: With the same versions you use, I still get the error. And yes, it has to do with the old spring-dependencies the spring batch uses.

          What helped, was to exclude spring-core in the spring-batch dependencies:
          Code:
            <dependencies>
                  <!--  Spring-->
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-core</artifactId>
                      <version>${spring.framework.version}</version>
                  </dependency>
                   <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-webmvc</artifactId>
                      <version>${spring.framework.version}</version>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-jdbc</artifactId>
                      <version>${spring.framework.version}</version>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework.integration</groupId>
                      <artifactId>spring-integration-core</artifactId>
                      <version>${spring.integration.version}</version>
                  </dependency>
          
                  <!--  Spring Batch-->
                  <dependency>
                      <groupId>org.springframework.batch</groupId>
                      <artifactId>spring-batch-core</artifactId>
                      <version>${spring.batch.version}</version>
                      <exclusions>
                          <exclusion>
                              <groupId>org.springframework</groupId>
                              <artifactId>spring-core</artifactId>
                          </exclusion>
                      </exclusions>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework.batch</groupId>
                      <artifactId>spring-batch-integration</artifactId>
                      <version>1.2.1.RELEASE</version>
                      <exclusions>
                          <exclusion>
                              <groupId>org.springframework</groupId>
                              <artifactId>spring-core</artifactId>
                          </exclusion>
                      </exclusions>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework.batch</groupId>
                      <artifactId>spring-batch-infrastructure</artifactId>
                      <version>${spring.batch.version}</version>
                      <exclusions>
                          <exclusion>
                              <groupId>org.springframework</groupId>
                              <artifactId>spring-core</artifactId>
                          </exclusion>
                      </exclusions>
                  </dependency>
          
                  <!-- Runtime -->
                  <dependency>
                      <groupId>mysql</groupId>
                      <artifactId>mysql-connector-java</artifactId>
                      <version>5.1.18</version>
                      <scope>runtime</scope>
                  </dependency>
                  <dependency>
                      <groupId>commons-dbcp</groupId>
                      <artifactId>commons-dbcp</artifactId>
                      <version>1.4</version>
                      <scope>runtime</scope>
                  </dependency>
          
                  <!-- Servlet -->
                  <dependency>
                      <groupId>javax.servlet</groupId>
                      <artifactId>servlet-api</artifactId>
                      <version>2.5</version>
                      <scope>provided</scope>
                  </dependency>
                  <dependency>
                      <groupId>javax.servlet.jsp</groupId>
                      <artifactId>jsp-api</artifactId>
                      <version>2.1</version>
                      <scope>provided</scope>
                  </dependency>
                  <dependency>
                      <groupId>javax.servlet</groupId>
                      <artifactId>jstl</artifactId>
                      <version>1.2</version>
                  </dependency>
              </dependencies>
          With the same versions sambaran posted....

          Thanks for help.
          Kieran

          Comment

          Working...
          X