Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account

Maven: javax.servlet specification deployed

0

85 views

I've a web application configured with Maven which uses a library, also configured with Maven and when I package geronimo-servlet_3.0_spec-1.0.jar is included in WEB-INF/lib and I don't understand why.

I check the library with mvn dependency:tree

$ mvn dependency:tree | grep geronimo
[INFO] +- org.apache.geronimo.specs:geronimo-servlet_3.0_spec:jar:1.0:provided

I check my web app:

$ mvn dependency:tree | grep geronimo
$

However when I run mvn:package the file gets included in WEB-INF/lib.

When I run mvn tomcat:run I can see:

INFO: validateJarFile(/home/stivlo/workspace/private/src/main/webapp/WEB-INF/lib/geronimo-servlet_3.0_spec-1.0.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

Why and how to avoid? Thank you.

asked June 25, 2011 6:43 am CDT
posted via StackOverflow

2 Answers

0
 

Based from your pom.xml, the only dependency that might have dependency on geronimo servlet is

 <dependency>
        <groupId>org.obliquid.helpers</groupId>
        <artifactId>obliquid-helpers</artifactId>
        <version>0.9-SNAPSHOT</version>
        <scope>compile</scope>
    </dependency>

Can you try excluding the geronimo in this dependency?

  <dependency>
            <groupId>org.obliquid.helpers</groupId>
            <artifactId>obliquid-helpers</artifactId>
            <version>0.9-SNAPSHOT</version>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.geronimo.specs</groupId>
                    <artifactId>geronimo-servlet_3.0_spec</artifactId>
                 </exclusion>
             </exclusions>
        </dependency>

answered June 25, 2011 1:43 pm CDT
0
 

Clearly, something has a dependency on that JAR file. If it is not showing up in the dependency tree, perhaps it is due to a dependency of your webapp WAR file on another WAR file that has this dependency.

If that is the case, then you could get add an <excludes> to the <overlay> element of the build descriptor for the WAR file plugin; e.g.

...
<build>
  <finalName>webapp</finalName>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.1</version>
        <configuration>
          <overlays>
            <overlay>
              <groupId>xxx</groupId>
              <artifactId>yyy</artifactId>
              <excludes>
                <exclude>WEB-INF/lib/whatever.jar</exclude>
              </excludes>
            </overlay>
          </overlays>
        </configuration>
      </plugin>
    </plugins>
  </build>
  ...

answered June 25, 2011 1:43 pm CDT

Your answer

Join with account you already have


Sign in with Twitter account
Sign in with Facebook account
Sign in with Google Friend Connect

Preview
Similar questions