Cosium / spring-data-jpa-entity-graph

Spring Data JPA extension allowing full dynamic usage of EntityGraph on repositories
MIT License
469 stars 52 forks source link

NoClassDefFoundError: com/mysema/commons/lang/Assert #9

Closed netmikey closed 7 years ago

netmikey commented 7 years ago

It looks like spring-data-jpa-entity-graph depends on the class com.mysema.commons.lang.Assert, but the mysema-commons-lang library isn't declared as transitive dependency.

My setup is as follows:

Here's my build.gradle:

plugins {
    id 'org.springframework.boot' version '1.5.1.RELEASE'
}

apply plugin: 'java'
apply plugin: 'eclipse'

repositories {
    mavenCentral()
}

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    compile("org.springframework.boot:spring-boot-starter-data-jpa")
    compile("com.cosium.spring.data:spring-data-jpa-entity-graph:1.11.01")
    [...]
}

Spring Data JPA resolves the following dependencies:

 org.springframework.boot:spring-boot-starter-data-jpa: -> 1.5.1.RELEASE
    +--- org.springframework.boot:spring-boot-starter:1.5.1.RELEASE (*)
    +--- org.springframework.boot:spring-boot-starter-aop:1.5.1.RELEASE
    |    +--- org.springframework.boot:spring-boot-starter:1.5.1.RELEASE (*)
    |    +--- org.springframework:spring-aop:4.3.6.RELEASE (*)
    |    \--- org.aspectj:aspectjweaver:1.8.9
    +--- org.springframework.boot:spring-boot-starter-jdbc:1.5.1.RELEASE
    |    +--- org.springframework.boot:spring-boot-starter:1.5.1.RELEASE (*)
    |    +--- org.apache.tomcat:tomcat-jdbc:8.5.11
    |    |    \--- org.apache.tomcat:tomcat-juli:8.5.11
    |    \--- org.springframework:spring-jdbc:4.3.6.RELEASE
    |         +--- org.springframework:spring-beans:4.3.6.RELEASE (*)
    |         +--- org.springframework:spring-core:4.3.6.RELEASE
    |         \--- org.springframework:spring-tx:4.3.6.RELEASE
    |              +--- org.springframework:spring-beans:4.3.6.RELEASE (*)
    |              \--- org.springframework:spring-core:4.3.6.RELEASE
    +--- org.hibernate:hibernate-core:5.0.11.Final -> 5.2.3.Final
    |    +--- org.jboss.logging:jboss-logging:3.3.0.Final
    |    +--- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final
    |    +--- org.javassist:javassist:3.20.0-GA -> 3.21.0-GA
    |    +--- antlr:antlr:2.7.7
    |    +--- org.jboss:jandex:2.0.0.Final
    |    +--- com.fasterxml:classmate:1.3.0 -> 1.3.3
    |    +--- dom4j:dom4j:1.6.1
    |    \--- org.hibernate.common:hibernate-commons-annotations:5.0.1.Final
    |         \--- org.jboss.logging:jboss-logging:3.3.0.Final
    +--- org.hibernate:hibernate-entitymanager:5.0.11.Final -> 5.2.3.Final
    |    +--- org.jboss.logging:jboss-logging:3.3.0.Final
    |    +--- org.hibernate:hibernate-core:5.2.3.Final (*)
    |    +--- dom4j:dom4j:1.6.1
    |    +--- org.hibernate.common:hibernate-commons-annotations:5.0.1.Final (*)
    |    +--- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final
    |    \--- org.javassist:javassist:3.20.0-GA -> 3.21.0-GA
    +--- javax.transaction:javax.transaction-api:1.2
    +--- org.springframework.data:spring-data-jpa:1.11.0.RELEASE
    |    +--- org.springframework.data:spring-data-commons:1.13.0.RELEASE
    |    |    +--- org.springframework:spring-core:4.3.6.RELEASE
    |    |    +--- org.springframework:spring-beans:4.3.6.RELEASE (*)
    |    |    +--- org.slf4j:slf4j-api:1.7.22
    |    |    \--- org.slf4j:jcl-over-slf4j:1.7.22 (*)
    |    +--- org.springframework:spring-orm:4.3.6.RELEASE
    |    |    +--- org.springframework:spring-beans:4.3.6.RELEASE (*)
    |    |    +--- org.springframework:spring-core:4.3.6.RELEASE
    |    |    +--- org.springframework:spring-jdbc:4.3.6.RELEASE (*)
    |    |    \--- org.springframework:spring-tx:4.3.6.RELEASE (*)
    |    +--- org.springframework:spring-context:4.3.6.RELEASE (*)
    |    +--- org.springframework:spring-aop:4.3.6.RELEASE (*)
    |    +--- org.springframework:spring-tx:4.3.6.RELEASE (*)
    |    +--- org.springframework:spring-beans:4.3.6.RELEASE (*)
    |    +--- org.springframework:spring-core:4.3.6.RELEASE
    |    +--- org.slf4j:slf4j-api:1.7.22
    |    \--- org.slf4j:jcl-over-slf4j:1.7.22 (*)
    \--- org.springframework:spring-aspects:4.3.6.RELEASE
         \--- org.aspectj:aspectjweaver:1.8.9

... and spring-data-jpa-entity-graph doesn't resolve any transitive dependencies.


And here's the error:

Caused by: java.lang.NoClassDefFoundError: com/mysema/commons/lang/Assert
        at com.cosium.spring.data.jpa.entity.graph.domain.EntityGraphUtils.fromAttributePaths(EntityGraphUtils.java:49) ~[spring-data-jpa-entity-graph-1.11.01.jar:na]

It would probably be desirable to avoid the dependency on mysema-commons-lang to reduce spring-data-jpa-entity-graph's dependency footprint.

reda-alaoui commented 7 years ago

You are right, this bug was recently introduced. I am fixing it right now.

reda-alaoui commented 7 years ago

1.10.15 and 1.11.02 released. Available in the next hour ;)