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

Classpath has classes with the same name but different implementation #1846

Open
40rn05lyv opened this issue Nov 5, 2021 · 2 comments
Open
Labels
pinned Pinnend issues are not touched by the stale bot

Comments

@40rn05lyv
Copy link

40rn05lyv commented Nov 5, 2021

Found that sometimes there are issue related to Unmarshaller implementation. I don't have exact steps, but found that there are classes with the same name, but different implementation in scm-webapp dependencies. That can be the cause of my issue.

I run enforcer on scm-webapp module and it showed following results:

Enforcer rule 'enforcer.rules.BanDuplicateClasses' was triggered.
Duplicate classes found:

  Found in:
    jakarta.xml.bind-api-2.3.2.jar (jakarta.xml.bind:jakarta.xml.bind-api:2.3.2)
  Duplicate classes:
    javax/xml/bind/annotation/adapters/CollapsedStringAdapter.class
    javax/xml/bind/annotation/W3CDomHandler.class
    javax/xml/bind/Binder.class
    javax/xml/bind/DatatypeConverter.class
    javax/xml/bind/helpers/AbstractUnmarshallerImpl.class
    javax/xml/bind/helpers/ValidationEventLocatorImpl.class
    javax/xml/bind/JAXBException.class
    javax/xml/bind/ServiceLoaderUtil.class
    javax/xml/bind/util/JAXBSource.class
    javax/xml/bind/annotation/adapters/HexBinaryAdapter.class
    javax/xml/bind/annotation/XmlAccessOrder.class
    javax/xml/bind/ContextFinder$1.class
    javax/xml/bind/DatatypeConverterImpl$CalendarFormatter.class
    javax/xml/bind/helpers/DefaultValidationEventHandler.class
    javax/xml/bind/JAXB$Cache.class
    javax/xml/bind/JAXB.class
    javax/xml/bind/JAXBContext.class
    javax/xml/bind/Marshaller$Listener.class
    javax/xml/bind/PropertyException.class
    javax/xml/bind/annotation/adapters/NormalizedStringAdapter.class
    javax/xml/bind/annotation/XmlElement$DEFAULT.class
    javax/xml/bind/attachment/AttachmentUnmarshaller.class
    javax/xml/bind/DataBindingException.class
    javax/xml/bind/helpers/AbstractMarshallerImpl.class
    javax/xml/bind/helpers/ValidationEventImpl.class
    javax/xml/bind/JAXBElement.class
    javax/xml/bind/ModuleUtil.class
    javax/xml/bind/TypeConstraintException.class
    javax/xml/bind/util/Messages.class
    javax/xml/bind/WhiteSpaceProcessor.class
    javax/xml/bind/annotation/adapters/XmlAdapter.class
    javax/xml/bind/annotation/XmlElementDecl$GLOBAL.class
    javax/xml/bind/annotation/XmlNsForm.class
    javax/xml/bind/ContextFinder$4.class
    javax/xml/bind/GetPropertyAction.class
    javax/xml/bind/MarshalException.class
    javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter$DEFAULT.class
    javax/xml/bind/annotation/XmlAccessType.class
    javax/xml/bind/ContextFinder$2.class
    javax/xml/bind/ContextFinder$3.class
    javax/xml/bind/JAXBContext$1.class
    javax/xml/bind/JAXBPermission.class
    javax/xml/bind/Unmarshaller$Listener.class
    javax/xml/bind/util/ValidationEventCollector.class
    javax/xml/bind/annotation/XmlElementRef$DEFAULT.class
    javax/xml/bind/annotation/XmlType$DEFAULT.class
    javax/xml/bind/DatatypeConverterImpl.class
    javax/xml/bind/helpers/PrintConversionEventImpl.class
    javax/xml/bind/JAXBElement$GlobalScope.class
    javax/xml/bind/Messages.class
    javax/xml/bind/ServiceLoaderUtil$ExceptionHandler.class
    javax/xml/bind/util/JAXBSource$1.class
    javax/xml/bind/ValidationException.class
    javax/xml/bind/ContextFinder$5.class
    javax/xml/bind/helpers/NotIdentifiableEventImpl.class
    javax/xml/bind/helpers/ParseConversionEventImpl.class
    javax/xml/bind/SchemaOutputResolver.class
    javax/xml/bind/util/JAXBResult.class
    javax/xml/bind/annotation/XmlSchemaType$DEFAULT.class
    javax/xml/bind/attachment/AttachmentMarshaller.class
    javax/xml/bind/ContextFinder.class
    javax/xml/bind/helpers/Messages.class
    javax/xml/bind/JAXBIntrospector.class
    javax/xml/bind/UnmarshalException.class

  Found in:
    javax.annotation-api-1.3.2.jar (javax.annotation:javax.annotation-api:1.3.2)
    jboss-annotations-api_1.3_spec-2.0.1.Final.jar (org.jboss.spec.javax.annotation:jboss-annotations-api_1.3_spec:2.0.1.Final)
  Duplicate classes:
    javax/annotation/Resource$AuthenticationType.class

  Found in:
    jakarta.activation-1.2.2.jar (com.sun.activation:jakarta.activation:1.2.2)
  Duplicate classes:
    javax/activation/CommandInfo$Beans$1.class
    javax/activation/MimeTypeParseException.class
    javax/activation/CommandObject.class
    javax/activation/MailcapCommandMap$1.class
    javax/activation/DataSourceDataContentHandler.class
    javax/activation/FileDataSource.class
    javax/activation/CommandMap.class
    javax/activation/SecuritySupport$5.class
    javax/activation/CommandInfo.class
    javax/activation/MimeTypeParameterList.class
    javax/activation/SecuritySupport$3.class
    javax/activation/MimetypesFileTypeMap$1.class
    javax/activation/UnsupportedDataTypeException.class
    javax/activation/CommandInfo$Beans.class
    javax/activation/FileTypeMap.class
    javax/activation/MimetypesFileTypeMap.class
    javax/activation/DataHandlerDataSource.class
    javax/activation/DataSource.class
    javax/activation/MailcapCommandMap.class
    javax/activation/SecuritySupport$1.class
    javax/activation/ActivationDataFlavor.class
    javax/activation/SecuritySupport$2.class
    javax/activation/DataHandler.class
    javax/activation/SecuritySupport$4.class
    javax/activation/ObjectDataContentHandler.class
    javax/activation/SecuritySupport.class
    javax/activation/DataContentHandlerFactory.class
    javax/activation/MimeType.class
    javax/activation/DataContentHandler.class
    javax/activation/URLDataSource.class
    javax/activation/DataHandler$1.class

  Found in:
    jcl-over-slf4j-1.7.30.jar (org.slf4j:jcl-over-slf4j:1.7.30)
    commons-logging-1.2.jar (commons-logging:commons-logging:1.2)
  Duplicate classes:
    org/apache/commons/logging/impl/SimpleLog.class
    org/apache/commons/logging/impl/NoOpLog.class
    org/apache/commons/logging/impl/SimpleLog$1.class
    org/apache/commons/logging/LogConfigurationException.class
    org/apache/commons/logging/LogFactory.class
    org/apache/commons/logging/Log.class

Need to choose between those libs to have consistently behaving app.

In order to run enforcer over scm-webapp project, you have to disable it in settings.gradle, add it to scm-webapp and comment all corePlugin dependencies.

enforce {
  rule(enforcer.rules.BanDuplicateClasses) { r ->
    r.findAllDuplicates = true
    r.ignoreWhenIdentical = true
  }
}
@pfeuffer
Copy link
Member

Hi, thank you for the hint. We will take a look at it.

@stale
Copy link

stale bot commented Dec 11, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Issue is stale and will be closed if no further activity occurs label Dec 11, 2021
@sdorra sdorra added the pinned Pinnend issues are not touched by the stale bot label Dec 11, 2021
@stale stale bot removed the stale Issue is stale and will be closed if no further activity occurs label Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pinned Pinnend issues are not touched by the stale bot
Projects
None yet
Development

No branches or pull requests

3 participants