Saturday, March 2, 2013

Google Oauth/Jetty 8 Conflict

I've been in the process of applying Google Oauth2 to some of my web apps. I ran into an issue when adding Google Oauth2 to a Jetty 8 application:


java.lang.SecurityException: class "javax.servlet.FilterRegistration"'s signer information does not match signer information of other classes in the same package

The problem is the with the com.google.oauth-client dependency

    <dependency>
      <groupId>com.google.oauth-client</groupId>
      <artifactId>google-oauth-client-servlet</artifactId>
      <version>1.13.1-beta</version>
    </dependency>

This depends on an older version of servlet-api (javax.servlet:servlet-api:jar:2.5:compile), while Jetty 8 depends on Servlet 3 (javax.servlet:jar:3.0.0.v201112011016). 

You can run mvn dependency:tree to view the dependencies

To fix the issue I excluded the 2.5 in my Maven assembly dependencySet

      <excludes>
        <exclude>javax.servlet:servlet-api</exclude>
      </excludes>