Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency Conflict : Conflicting classes existing in different libraries [DATASOLR-447] #568

Closed
spring-projects-issues opened this issue Feb 20, 2018 · 2 comments

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Feb 20, 2018

PandaMonkey opened DATASOLR-447 and commented

Hi, by analyzing spring-data-solr-master\pom.xml, we found conflicting classes exist in libraries:
javax.servlet:servlet-api:3.0-alpha-1 and javax.servlet:javax.servlet-api:3.1.0.

Their introduced paths are:
[org.springframework.data:spring-data-solr:3.1.0.BUILD-SNAPSHOT::null->javax.servlet:servlet-api:3.0-alpha-1::test] and
[org.springframework.data:spring-data-solr:3.1.0.BUILD-SNAPSHOT::null->org.apache.solr:solr-core:6.6.1::compile->javax.servlet:javax.servlet-api:3.1.0::compile]

The conflicting classes have different implementations. As [org.springframework.data:spring-data-solr:3.1.0.BUILD-SNAPSHOT::null->org.apache.solr:solr-core:6.6.1::compile->javax.servlet:javax.servlet-api:3.1.0::compile] is first declared on the classpath, the conflicting classes in it will override those of [org.springframework.data:spring-data-solr:3.1.0.BUILD-SNAPSHOT::null->javax.servlet:servlet-api:3.0-alpha-1::test]. The reason is that the JVM only load the classes present first on the classpath and shadow the other duplicate ones, so this problem brings high risk of NoSuchMethodError or NoSuchMethodExceptions at runtime. The detail conflicting information is listed below. Please pay attention about that.

Maybe the solution is upgrading javax.servlet:servlet-api:3.0-alpha-1 to javax.servlet:javax.servlet-api:3.1.0. As they are the same library, but developers changed Servlet API's coordinate in Maven Central from javax.servlet:servlet-api to javax.servlet:javax.servlet-api after a revolution in 2008. And I noticed a annotation in your pom.xml: "solr 4.x requires servlet api to run in embedded mode", maybe you forgot to update the javax.servlet:servlet-api, during the evolution process. Hope this report can help you. Thanks!


Affects: 3.1 M1 (Lovelace)

Referenced from: commits a78acbf, ce9e3b7

Backported to: 3.0.6 (Kay SR6)

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Feb 20, 2018

PandaMonkey commented

Risk for jar-pair:javax.servlet:servlet-api:3.0-alpha-1:javax.servlet:javax.servlet-api:3.1.0:

  • Methods that only exist in javax.servlet:servlet-api:3.0-alpha-1:: [org.springframework.data:spring-data-solr:3.1.0.BUILD-SNAPSHOT::null->javax.servlet:servlet-api:3.0-alpha-1::test]*
    <javax.servlet.http.HttpUtils: java.lang.String parseName(java.lang.String,java.lang.StringBuffer)>

  • Methods that only exist in javax.servlet:javax.servlet-api:3.1.0:: [org.springframework.data:spring-data-solr:3.1.0.BUILD-SNAPSHOT::null->org.apache.solr:solr-core:6.6.1::compile->javax.servlet:javax.servlet-api:3.1.0::compile]*
    <javax.servlet.http.NoBodyOutputStream: boolean isReady()>
    <javax.servlet.http.NoBodyOutputStream: void setWriteListener(javax.servlet.WriteListener)>
    <javax.servlet.http.HttpServletResponseWrapper: java.util.Collection getHeaderNames()>
    <javax.servlet.http.HttpServletResponseWrapper: int getStatus()>
    <javax.servlet.http.HttpServletResponseWrapper: java.util.Collection getHeaders(java.lang.String)>
    <javax.servlet.http.HttpServletResponseWrapper: java.lang.String getHeader(java.lang.String)>
    <javax.servlet.http.HttpUtils: java.lang.String parseName(java.lang.String,java.lang.StringBuilder)>
    <javax.servlet.http.HttpServletResponse: java.util.Collection getHeaders(java.lang.String)>
    <javax.servlet.http.HttpServletResponse: java.lang.String getHeader(java.lang.String)>
    <javax.servlet.http.HttpServletResponse: java.util.Collection getHeaderNames()>
    <javax.servlet.http.HttpServletResponse: int getStatus()>
    <javax.servlet.http.HttpServletRequest: javax.servlet.http.HttpUpgradeHandler upgrade(java.lang.Class)>
    <javax.servlet.http.HttpServletRequest: boolean authenticate(javax.servlet.http.HttpServletResponse)>
    <javax.servlet.http.HttpServletRequest: void logout()>
    <javax.servlet.http.HttpServletRequest: javax.servlet.http.Part getPart(java.lang.String)>
    <javax.servlet.http.HttpServletRequest: java.lang.String changeSessionId()>
    <javax.servlet.http.HttpServletRequest: void login(java.lang.String,java.lang.String)>
    <javax.servlet.http.HttpServletRequest: java.util.Collection getParts()>
    <javax.servlet.http.Cookie: boolean isHttpOnly()>
    <javax.servlet.http.Cookie: void setHttpOnly(boolean)>
    <javax.servlet.http.NoBodyResponse: void addIntHeader(java.lang.String,int)>
    <javax.servlet.http.NoBodyResponse: void setContentLengthLong(long)>
    <javax.servlet.http.NoBodyResponse: void setHeader(java.lang.String,java.lang.String)>
    <javax.servlet.http.NoBodyResponse: void addHeader(java.lang.String,java.lang.String)>
    <javax.servlet.http.NoBodyResponse: void checkHeader(java.lang.String)>
    <javax.servlet.http.NoBodyResponse: void setIntHeader(java.lang.String,int)>
    <javax.servlet.http.HttpServletRequestWrapper: javax.servlet.http.Part getPart(java.lang.String)>
    <javax.servlet.http.HttpServletRequestWrapper: void login(java.lang.String,java.lang.String)>
    <javax.servlet.http.HttpServletRequestWrapper: boolean authenticate(javax.servlet.http.HttpServletResponse)>
    <javax.servlet.http.HttpServletRequestWrapper: java.util.Collection getParts()>
    <javax.servlet.http.HttpServletRequestWrapper: void logout()>
    <javax.servlet.http.HttpServletRequestWrapper: javax.servlet.http.HttpUpgradeHandler upgrade(java.lang.Class)>
    <javax.servlet.http.HttpServletRequestWrapper: java.lang.String changeSessionId()>
    <javax.servlet.ServletRequest: long getContentLengthLong()>
    <javax.servlet.ServletRequest: javax.servlet.AsyncContext getAsyncContext()>
    <javax.servlet.ServletRequest: javax.servlet.AsyncContext startAsync()>
    <javax.servlet.ServletRequest: boolean isAsyncSupported()>
    <javax.servlet.ServletRequest: javax.servlet.ServletContext getServletContext()>
    <javax.servlet.ServletRequest: boolean isAsyncStarted()>
    <javax.servlet.ServletRequest: javax.servlet.AsyncContext startAsync(javax.servlet.ServletRequest,javax.servlet.ServletResponse)>
    <javax.servlet.ServletRequest: javax.servlet.DispatcherType getDispatcherType()>
    <javax.servlet.ServletInputStream: boolean isFinished()>
    <javax.servlet.ServletInputStream: void setReadListener(javax.servlet.ReadListener)>
    <javax.servlet.ServletInputStream: boolean isReady()>
    <javax.servlet.ServletOutputStream: boolean isReady()>
    <javax.servlet.ServletOutputStream: void setWriteListener(javax.servlet.WriteListener)>
    <javax.servlet.ServletContext: void setSessionTrackingModes(java.util.Set)>
    <javax.servlet.ServletContext: javax.servlet.Filter createFilter(java.lang.Class)>
    <javax.servlet.ServletContext: java.lang.String getVirtualServerName()>
    <javax.servlet.ServletContext: javax.servlet.FilterRegistration$Dynamic addFilter(java.lang.String,java.lang.Class)>
    <javax.servlet.ServletContext: boolean setInitParameter(java.lang.String,java.lang.String)>
    <javax.servlet.ServletContext: javax.servlet.descriptor.JspConfigDescriptor getJspConfigDescriptor()>
    <javax.servlet.ServletContext: void addListener(java.lang.Class)>
    <javax.servlet.ServletContext: javax.servlet.FilterRegistration$Dynamic addFilter(java.lang.String,java.lang.String)>
    <javax.servlet.ServletContext: java.lang.ClassLoader getClassLoader()>
    <javax.servlet.ServletContext: javax.servlet.ServletRegistration$Dynamic addServlet(java.lang.String,java.lang.Class)>
    <javax.servlet.ServletContext: javax.servlet.ServletRegistration$Dynamic addServlet(java.lang.String,java.lang.String)>
    <javax.servlet.ServletContext: javax.servlet.ServletRegistration$Dynamic addServlet(java.lang.String,javax.servlet.Servlet)>
    <javax.servlet.ServletContext: java.util.Set getEffectiveSessionTrackingModes()>
    <javax.servlet.ServletContext: int getEffectiveMajorVersion()>
    <javax.servlet.ServletContext: int getEffectiveMinorVersion()>
    <javax.servlet.ServletContext: javax.servlet.Servlet createServlet(java.lang.Class)>
    <javax.servlet.ServletContext: void declareRoles(java.lang.String[])>
    <javax.servlet.ServletContext: javax.servlet.ServletRegistration getServletRegistration(java.lang.String)>
    <javax.servlet.ServletContext: java.util.Map getServletRegistrations()>
    <javax.servlet.ServletContext: java.util.Set getDefaultSessionTrackingModes()>
    <javax.servlet.ServletContext: java.util.Map getFilterRegistrations()>
    <javax.servlet.ServletContext: void addListener(java.lang.String)>
    <javax.servlet.ServletContext: javax.servlet.FilterRegistration getFilterRegistration(java.lang.String)>
    <javax.servlet.ServletContext: java.util.EventListener createListener(java.lang.Class)>
    <javax.servlet.ServletContext: javax.servlet.FilterRegistration$Dynamic addFilter(java.lang.String,javax.servlet.Filter)>
    <javax.servlet.ServletContext: javax.servlet.SessionCookieConfig getSessionCookieConfig()>
    <javax.servlet.ServletContext: void addListener(java.util.EventListener)>
    <javax.servlet.ServletResponseWrapper: boolean isWrapperFor(java.lang.Class)>
    <javax.servlet.ServletResponseWrapper: boolean isWrapperFor(javax.servlet.ServletResponse)>
    <javax.servlet.ServletResponseWrapper: void setContentLengthLong(long)>
    <javax.servlet.ServletRequestWrapper: javax.servlet.AsyncContext getAsyncContext()>
    <javax.servlet.ServletRequestWrapper: boolean isWrapperFor(javax.servlet.ServletRequest)>
    <javax.servlet.ServletRequestWrapper: javax.servlet.DispatcherType getDispatcherType()>
    <javax.servlet.ServletRequestWrapper: boolean isAsyncSupported()>
    <javax.servlet.ServletRequestWrapper: javax.servlet.AsyncContext startAsync()>
    <javax.servlet.ServletRequestWrapper: boolean isAsyncStarted()>
    <javax.servlet.ServletRequestWrapper: javax.servlet.AsyncContext startAsync(javax.servlet.ServletRequest,javax.servlet.ServletResponse)>
    <javax.servlet.ServletRequestWrapper: javax.servlet.ServletContext getServletContext()>
    <javax.servlet.ServletRequestWrapper: long getContentLengthLong()>
    <javax.servlet.ServletRequestWrapper: boolean isWrapperFor(java.lang.Class)>
    <javax.servlet.ServletResponse: void setContentLengthLong(long)>

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Mar 7, 2018

Christoph Strobl commented

Set priority to minor. Conflicting dependency has test scope.

[INFO] javax.servlet:servlet-api:jar:3.0-alpha-1:test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants