views:

13

answers:

1

Using Spring and Struts together gives no error message in the console, but only a:

HTTP Status 404 - Servlet action is not available

in the Browser.

The logs give no clue whatsoever.

A: 

When Struts' action servlet fails to startup for whatever reason, the resulting error can be as above.

In my case - struts using springs spring-struts integration - the necessary spring jars (esp. spring-struts) were missing from the class path of my web application.

The following maven dependencies worked:

    <properties>
    <spring.maven.artifact.version>
        3.0.3.RELEASE
    </spring.maven.artifact.version>

    <spring.security.maven.artifact.version>
        3.0.3.RELEASE
    </spring.security.maven.artifact.version>

</properties>
        <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${spring.maven.artifact.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-asm</artifactId>
        <version>${spring.maven.artifact.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-expression</artifactId>
        <version>${spring.maven.artifact.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${spring.maven.artifact.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-struts</artifactId>
        <version>${spring.maven.artifact.version}</version>
        <exclusions>
            <exclusion>
              <groupId>struts</groupId>
              <artifactId>struts</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-core</artifactId>
        <version>${spring.security.maven.artifact.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
        <version>${spring.maven.artifact.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>${spring.maven.artifact.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-taglibs</artifactId>
        <version>${spring.maven.artifact.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>com.springsource.org.apache.commons.codec</artifactId>
        <version>1.4.0</version>
    </dependency>

    <!-- Struts 1.3 framework -->
    <dependency>
      <groupId>org.apache.struts</groupId>
      <artifactId>struts-core</artifactId>
      <version>1.3.10</version>
    </dependency>

    <dependency>
      <groupId>org.apache.struts</groupId>
      <artifactId>struts-taglib</artifactId>
      <version>1.3.10</version>
    </dependency>

    <dependency>
      <groupId>org.apache.struts</groupId>
      <artifactId>struts-el</artifactId>
      <version>1.3.10</version>
    </dependency>

    <dependency>
      <groupId>org.apache.struts</groupId>
      <artifactId>struts-extras</artifactId>
      <version>1.3.10</version>
    </dependency>

    <!-- be sure to include extra struts modules, as needed,
         especially for used struts-plugins -->
    <dependency>
      <groupId>org.apache.struts</groupId>
      <artifactId>struts-tiles</artifactId>
      <version>1.3.10</version>
    </dependency>

Note: if you don't use spring-security you can very likely drop the spring-security related dependencies, also the exclusion in spring-struts was necessary to include the latest struts version instead of 1.2.9

hansfbaier