OHDSI / WhiteRabbit

WhiteRabbit is a small application that can be used to analyse the structure and contents of a database as preparation for designing an ETL. It comes with RabbitInAHat, an application for interactive design of an ETL to the OMOP Common Data Model with the help of the the scan report generated by White Rabbit.
http://ohdsi.github.io/WhiteRabbit
Apache License 2.0
174 stars 85 forks source link

“NoSuchMethodErrors” due to multiple versions of org.apache.poi:poi-ooxml-schemas #288

Closed Bing-ok closed 3 years ago

Bing-ok commented 3 years ago

Issue description:

There are multiple versions of org.apache.poi:poi-ooxml-schemas in rabbit-core. As shown in the following dependency tree, according to Maven's "nearest wins" strategy, only org.apache.poi:poi-ooxml-schemas:3.9 can be loaded, org.apache.poi:poi-ooxml-schemas:3.17 will be shadowed.

However, several methods defined in shadowed version org.apache.poi:poi-ooxml-schemas:3.17 are referenced by client project via org.apache.poi:poi-ooxml:3.17 but missing in the actually loaded version org.apache.poi:poi-ooxml-schemas:3.9.

For instance, the following missing method(defined in org.apache.poi:poi-ooxml-schemas:3.17) are actually referenced by rabbit-core, which will introduce a runtime error(i.e., "NoSuchMethodError") into rabbit-core.

  1. com.microsoft.schemas.office.visio.x2012.main.MasterContentsDocument$Factory: com.microsoft.schemas.office.visio.x2012.main.MasterContentsDocument parse(java.io.InputStream) is invoked by rabbit-core via the following path:

    
    Invocation path------
    <org.ohdsi.ooxml.CustomXWPFDocument: void init(java.io.InputStream)> WhiteRabbit\rabbit-core\target\classes
    <org.apache.poi.xwpf.usermodel.XWPFDocument: void init(java.io.InputStream)> Repositories\org\apache\poi\poi-ooxml\3.17\poi-ooxml-3.17.jar
    <org.apache.poi.POIXMLDocument: void load(org.apache.poi.POIXMLFactory)> Repositories\org\apache\poi\poi-ooxml\3.17\poi-ooxml-3.17.jar
    <org.apache.poi.xdgf.usermodel.XmlVisioDocument: void onDocumentRead()> Repositories\org\apache\poi\poi-ooxml\3.17\poi-ooxml-3.17.jar
    <org.apache.poi.xdgf.usermodel.XDGFMasters: void onDocumentRead()> Repositories\org\apache\poi\poi-ooxml\3.17\poi-ooxml-3.17.jar
    <org.apache.poi.xdgf.usermodel.XDGFMasterContents: void onDocumentRead()> Repositories\org\apache\poi\poi-ooxml\3.17\poi-ooxml-3.17.jar
    <com.microsoft.schemas.office.visio.x2012.main.MasterContentsDocument$Factory: com.microsoft.schemas.office.visio.x2012.main.MasterContentsDocument parse(java.io.InputStream)>
    
  2. com.microsoft.schemas.office.visio.x2012.main.MastersDocument$Factory: com.microsoft.schemas.office.visio.x2012.main.MastersDocument parse(java.io.InputStream) is invoked by rabbit-core via the following path:

    
    Invocation path------
    <org.ohdsi.ooxml.CustomXWPFDocument: void init(java.io.InputStream)> WhiteRabbit\rabbit-core\target\classes
    <org.apache.poi.xwpf.usermodel.XWPFDocument: void init(java.io.InputStream)> Repositories\org\apache\poi\poi-ooxml\3.17\poi-ooxml-3.17.jar
    <org.apache.poi.POIXMLDocument: void load(org.apache.poi.POIXMLFactory)> Repositories\org\apache\poi\poi-ooxml\3.17\poi-ooxml-3.17.jar
    <org.apache.poi.xdgf.usermodel.XmlVisioDocument: void onDocumentRead()> Repositories\org\apache\poi\poi-ooxml\3.17\poi-ooxml-3.17.jar
    <org.apache.poi.xdgf.usermodel.XDGFMasters: void onDocumentRead()> Repositories\org\apache\poi\poi-ooxml\3.17\poi-ooxml-3.17.jar
    <com.microsoft.schemas.office.visio.x2012.main.MastersDocument$Factory: com.microsoft.schemas.office.visio.x2012.main.MastersDocument parse(java.io.InputStream)>
    
  3. com.microsoft.schemas.office.visio.x2012.main.PageContentsDocument$Factory: com.microsoft.schemas.office.visio.x2012.main.PageContentsDocument parse(java.io.InputStream) is invoked by rabbit-core via the following path:

    
    Invocation path------
    <org.ohdsi.ooxml.CustomXWPFDocument: void init(java.io.InputStream)> WhiteRabbit\rabbit-core\target\classes
    <org.apache.poi.xwpf.usermodel.XWPFDocument: void init(java.io.InputStream)> Repositories\org\apache\poi\poi-ooxml\3.17\poi-ooxml-3.17.jar
    <org.apache.poi.POIXMLDocument: void load(org.apache.poi.POIXMLFactory)> Repositories\org\apache\poi\poi-ooxml\3.17\poi-ooxml-3.17.jar
    <org.apache.poi.xdgf.usermodel.XmlVisioDocument: void onDocumentRead()> Repositories\org\apache\poi\poi-ooxml\3.17\poi-ooxml-3.17.jar
    <org.apache.poi.xdgf.usermodel.XDGFPages: void onDocumentRead()> Repositories\org\apache\poi\poi-ooxml\3.17\poi-ooxml-3.17.jar
    <org.apache.poi.xdgf.usermodel.XDGFPageContents: void onDocumentRead()> Repositories\org\apache\poi\poi-ooxml\3.17\poi-ooxml-3.17.jar
    <com.microsoft.schemas.office.visio.x2012.main.PageContentsDocument$Factory: com.microsoft.schemas.office.visio.x2012.main.PageContentsDocument parse(java.io.InputStream)>
    
  4. com.microsoft.schemas.office.visio.x2012.main.PagesDocument$Factory: com.microsoft.schemas.office.visio.x2012.main.PagesDocument parse(java.io.InputStream) is invoked by rabbit-core via the following path:

    
    Invocation path------
    <org.ohdsi.ooxml.CustomXWPFDocument: void init(java.io.InputStream)> WhiteRabbit\rabbit-core\target\classes
    <org.apache.poi.xwpf.usermodel.XWPFDocument: void init(java.io.InputStream)> Repositories\org\apache\poi\poi-ooxml\3.17\poi-ooxml-3.17.jar
    <org.apache.poi.POIXMLDocument: void load(org.apache.poi.POIXMLFactory)> Repositories\org\apache\poi\poi-ooxml\3.17\poi-ooxml-3.17.jar
    <org.apache.poi.xdgf.usermodel.XmlVisioDocument: void onDocumentRead()> Repositories\org\apache\poi\poi-ooxml\3.17\poi-ooxml-3.17.jar
    <org.apache.poi.xdgf.usermodel.XDGFPages: void onDocumentRead()> Repositories\org\apache\poi\poi-ooxml\3.17\poi-ooxml-3.17.jar
    <com.microsoft.schemas.office.visio.x2012.main.PagesDocument$Factory: com.microsoft.schemas.office.visio.x2012.main.PagesDocument parse(java.io.InputStream)>
    

Suggested fixing solutions:

Upgrade direct dependency org.apache.poi:poi-ooxml-schemas from 3.9 to 3.17. Because version 3.17 includes the above missing methods and is compatible with versions 3.9 in the project. This repair will introduce the following new conflicts, but these conflicts are benign (will not cause runtime exceptions). Conflict: org.apache.xmlbeans:xmlbeans versions: [2.3.0, /2.6.0]

Thank you very much for your attention. Best regards,

Dependency tree----


[INFO] org.ohdsi:rabbit-core:jar:0.10.3
[INFO] +- com.oracle.jdbc:ojdbc14:jar:10.2.0.1.0:compile
[INFO] +- com.microsoft.sqlserver:sqljdbc4:jar:4.0:compile
[INFO] +- mysql:mysql-connector-java:jar:8.0.16:compile
[INFO] |  \- com.google.protobuf:protobuf-java:jar:3.6.1:compile
[INFO] +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] +- org.apache.poi:poi:jar:3.17:compile
[INFO] |  +- commons-codec:commons-codec:jar:1.10:compile
[INFO] |  \- org.apache.commons:commons-collections4:jar:4.1:compile
[INFO] +- org.apache.poi:poi-ooxml:jar:3.17:compile
[INFO] |  +- (org.apache.poi:poi:jar:3.17:compile - omitted for duplicate)
[INFO] |  +- (org.apache.poi:poi-ooxml-schemas:jar:3.17:compile - omitted for conflict with 3.9)
[INFO] |  \- com.github.virtuald:curvesapi:jar:1.04:compile
[INFO] +- org.apache.poi:poi-excelant:jar:3.17:compile
[INFO] |  +- (org.apache.poi:poi:jar:3.17:compile - omitted for duplicate)
[INFO] |  +- (org.apache.poi:poi-ooxml:jar:3.17:compile - omitted for duplicate)
[INFO] |  \- org.apache.ant:ant:jar:1.8.2:compile
[INFO] |     \- org.apache.ant:ant-launcher:jar:1.8.2:compile
[INFO] +- org.apache.poi:poi-ooxml-schemas:jar:3.9:compile
[INFO] |  \- (org.apache.xmlbeans:xmlbeans:jar:2.3.0:compile - omitted for duplicate)
[INFO] +- stax:stax-api:jar:1.0.1:compile
[INFO] +- org.apache.xmlbeans:xmlbeans:jar:2.3.0:compile
[INFO] |  \- (stax:stax-api:jar:1.0.1:compile - omitted for duplicate)
[INFO] +- org.postgresql:postgresql:jar:42.2.5:compile
[INFO] +- com.cedarsoftware:json-io:jar:3.0.1:compile
[INFO] +- org.apache.commons:commons-csv:jar:1.1:compile
[INFO] +- commons-lang:commons-lang:jar:2.0:compile
[INFO] +- commons-logging:commons-logging:jar:1.2:compile
[INFO] +- org.hsqldb:hsqldb:jar:2.2.6:compile
[INFO] +- com.healthmarketscience.jackcess:jackcess:jar:2.1.3:compile
[INFO] |  +- (commons-lang:commons-lang:jar:2.6:compile - omitted for conflict with 2.0)
[INFO] |  \- (commons-logging:commons-logging:jar:1.1.3:compile - omitted for conflict with 1.2)
[INFO] +- net.sf.ucanaccess:ucanaccess:jar:3.0.3.1:compile
[INFO] |  +- (org.hsqldb:hsqldb:jar:2.3.1:compile - omitted for conflict with 2.2.6)
[INFO] |  \- (com.healthmarketscience.jackcess:jackcess:jar:2.1.3:compile - omitted for duplicate)
[INFO] +- com.amazon.redshift:redshift-jdbc41:jar:1.1.10.1010:compile
[INFO] +- com.teradata.jdbc:terajdbc4:jar:16.0.0.32:compile
[INFO] +- com.teradata.tdgss:tdgssconfig:jar:16.0.0.0:compile
[INFO] +- com.simba.googlebigquery.jdbc:GoogleBigQueryJDBC:jar:42:compile
[INFO] +- com.simba.googlebigquery.jdbc:google-api-client:jar:1.28.0:compile
[INFO] +- com.simba.googlebigquery.jdbc:google-http-client:jar:1.29.0:compile
[INFO] +- com.simba.googlebigquery.jdbc:gax:jar:1.42.0:compile
[INFO] +- com.simba.googlebigquery.jdbc:google-http-client-jackson2:jar:1.28.0:compile
[INFO] +- com.simba.googlebigquery.jdbc:google-oauth-client:jar:1.28.0:compile
[INFO] +- com.simba.googlebigquery.jdbc:google-auth-library-oauth2-http:jar:0.13.0:compile
[INFO] +- com.simba.googlebigquery.jdbc:google-auth-library-credentials:jar:0.15.0:compile
[INFO] +- com.simba.googlebigquery.jdbc:jackson-core:jar:2.9.6:compile
[INFO] +- com.simba.googlebigquery.jdbc:guava:jar:26.0:compile
[INFO] +- com.simba.googlebigquery.jdbc:google-api-service-bigquery:jar:V2-rev426-1.25.0:compile
[INFO] +- com.simba.googlebigquery.jdbc:opencensus-api:jar:0.18.0:compile
[INFO] +- com.simba.googlebigquery.jdbc:opencensus-contrib-http-util:jar:0.18.0:compile
[INFO] +- com.simba.googlebigquery.jdbc:grpc-context:jar:1.18.0:compile
[INFO] +- com.simba.googlebigquery.jdbc:joda-time:jar:2.10.1:compile
[INFO] +- com.simba.googlebigquery.jdbc:avro:jar:1.8.2:compile
[INFO] \- com.epam:parso:jar:2.0:compile
[INFO]    \- org.slf4j:slf4j-api:jar:1.7.5:compile
MaximMoinat commented 3 years ago

Thanks for reporting and including a solution.

For my information, was this when compiling WhiteRabbit yourself or using the released distribution? If so, what branch/version were you using?

Bing-ok commented 3 years ago

I used the latest master branch. This happened when compile and test it myself.

Bing-ok commented 3 years ago

Thanks for your support!