VB_
VB_

Reputation: 45692

HttpConstraintElement: maven dependency conflict

I tried to create WebArchieve from my application with help of ShrinkWrap. But even if I don't deploy anything but use:

final WebArchive archive = ShrinkWrap.create(WebArchive.class, "archieve.war");
archive.as(ShrinkWrapWebAppContext.class); // throws EXCEPTION!

Exception:

class "javax.servlet.HttpConstraintElement"'s signer information does not match signer information of other classes in the same package

What I've tried to do: As I understand, I use two jars, both contains HttpConstraintElement. And those maven dependencies have two different versions. So I tried to:

$ mvn dependency:tree -Dverbose |grep servlet
[INFO] +- javax.servlet:servlet-api:jar:2.5:compile
[INFO] +- javax.servlet.jsp:jsp-api:jar:2.2:compile
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] |  +- org.apache.tiles:tiles-servlet-wildcard:jar:2.2.2:compile
[INFO] |  |  +- (org.apache.tiles:tiles-servlet:jar:2.2.2:compile - omitted for duplicate)
[INFO] |  |  +- (org.apache.tiles:tiles-servlet:jar:2.2.2:compile - omitted for duplicate)
[INFO] |  |  +- (org.apache.tiles:tiles-servlet:jar:2.2.2:compile - omitted for duplicate)
[INFO] +- org.apache.tiles:tiles-servlet:jar:2.2.2:compile
[INFO] |  +- (org.apache.tiles:tiles-servlet:jar:2.2.2:compile - omitted for duplicate)
[INFO]    \- org.eclipse.jetty:jetty-servlet:jar:9.0.0.M4:compile
[INFO]             +- org.eclipse.jetty.orbit:javax.servlet:jar:3.0.0.v201112011016:compile

Questions:

Does it (maven's result above) means that problem is in jetty.websocket and jetty.orbit conflict?

If no, how to solve my problem?

If yes, how to resolve the conflict?

Upvotes: 1

Views: 1291

Answers (1)

Sander Verhagen
Sander Verhagen

Reputation: 9118

I believe this is the same problem as described in this question.

I fixed this as follows:

  1. Remove the dependency on javax.servlet:servlet-api
  2. Explicitly add the dependency on org.eclipse.jetty.orbit:javax.servlet, hence fully replacing javax.servlet:servlet-api

For a full explanation of this solution you may refer to my answer on abovementioned question.

Note that you may want to include (whichever) servlet-api on scope provided. Apache specifically describes this for "Servlet API".

Upvotes: 3

Related Questions