Re: NoSuchMethodError: com.google.common.collect.ImmutableList.of when using maven install

3,437 views
Skip to first unread message

Timo Westkämper

unread,
May 9, 2013, 8:52:31 AM5/9/13
to Querydsl on behalf of Edem Morny
Hi.

Querydsl uses Guava 13.0.1 : https://github.com/mysema/querydsl/blob/master/querydsl-root/pom.xml#L37
Br,
Timo

On Thu, May 9, 2013 at 3:49 PM, Edem Morny via Querydsl <querydsl+noreply-APn2wQdnGw9ho-B...@googlegroups.com> wrote:
Hi,

I'm just beginning to try out querydsl. When i execute "mvn clean install", I get a NoSuchMethodError as follows.

java.lang.RuntimeException: java.lang.NoSuchMethodError: com.google.common.collect.ImmutableList.of(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Object;)Lcom/google/common/collect/ImmutableList;

I had guava defined as a runtime dependency on my maven module, so I removed it so maven will resolve the needed version of guava to fix the problem. Version 11.0.2 of guava was resolved as a transitive dependency, but it still can't find the method. I've downloaded the source of guava, and I do see the method there, so confused as to what to do. Any ideas what I could be doing wrong?

My pom declarations are as follows.


<dependency>
            <groupId>com.mysema.querydsl</groupId>
            <artifactId>querydsl-apt</artifactId>
            <version>3.1.1</version>
            <scope>provided</scope>
        </dependency>   
   
        <dependency>
            <groupId>com.mysema.querydsl</groupId>
            <artifactId>querydsl-jpa</artifactId>
            <version>3.1.1</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.6.1</version>
        </dependency>
    </dependencies>
   
    <build>
        <plugins>
   
            <plugin>
                <groupId>com.mysema.maven</groupId>
                <artifactId>apt-maven-plugin</artifactId>
                <version>1.1.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>target/generated-sources/java</outputDirectory>
                            <processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
   
        </plugins>
    </build>

--
You received this message because you are subscribed to the Google Groups "Querydsl" group.
To unsubscribe from this group and stop receiving emails from it, send an email to querydsl+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Timo Westkämper
Mysema Oy
+358 (0)40 591 2172
www.mysema.com


Edem Morny

unread,
May 9, 2013, 9:23:53 AM5/9/13
to quer...@googlegroups.com
Hi,

I did check what the version could be, and explicitly specified 13.0.1 in my pom for guava, however that didn't seem to solve the problem. Here's the result when i do a "mvn dependency:resolve"

 The following files have been resolved:
    antlr:antlr:jar:2.7.7:compile
    asm:asm:jar:3.3.1:compile
    cglib:cglib:jar:2.2.2:compile
    com.google.code.findbugs:jsr305:jar:1.3.9:compile
    com.google.guava:guava:jar:13.0.1:compile
    com.mysema.codegen:codegen:jar:0.5.9:provided
    com.mysema.commons:mysema-commons-lang:jar:0.2.4:compile
    com.mysema.querydsl:querydsl-apt:jar:3.1.1:provided
    com.mysema.querydsl:querydsl-codegen:jar:3.1.1:provided
    com.mysema.querydsl:querydsl-core:jar:3.1.1:compile
    com.mysema.querydsl:querydsl-jpa:jar:3.1.1:compile
    com.queauji.hims:hims-entity-api:jar:1.0-SNAPSHOT:compile
    com.queauji.hims:hims-snofyre-shade:jar:1.0-SNAPSHOT:compile
    com.queauji.hims:hims-terminology:jar:1.0-SNAPSHOT:compile
    com.thoughtworks.paranamer:paranamer:jar:2.3:compile
    commons-codec:commons-codec:jar:1.6:compile
    commons-io:commons-io:jar:2.1:compile
    commons-lang:commons-lang:jar:2.6:compile
    javax:javaee-web-api:jar:6.0:provided

     ....

What do you think?

Timo Westkämper

unread,
May 9, 2013, 9:34:30 AM5/9/13
to Querydsl on behalf of Edem Morny
Hi.

You also added the needed exclusions? You need to make sure that no other Guava versions are on the runtime classpath.

Br,
Timo

--
You received this message because you are subscribed to the Google Groups "Querydsl" group.
To unsubscribe from this group and stop receiving emails from it, send an email to querydsl+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Edem Morny

unread,
May 9, 2013, 11:02:52 AM5/9/13
to quer...@googlegroups.com
Hi Timo,

Thanks for your patience.

I've now removed the guava dependency from my project, with the hope that the querydsl will transitively include the depdendency. From my "dependency:tree" output, the guava dependency only exists transtively, so it should work fine, but it doesn't. As you can see from the output below, there should be only 1 guava dependency, but I still get the same error.

I'll still keep trying and see, and will let you know if I make any headway. Thanks for your help.

]
] --- maven-dependency-plugin:2.1:tree (default-cli) @ hims-entity-impl ---

] com.queauji.hims:hims-entity-impl:jar:1.0-SNAPSHOT
] +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:
ded (scope not updated to compile)
] +- org.hibernate:hibernate-validator:jar:4.2.0.Final:provided
] +- javax.validation:validation-api:jar:1.0.0.GA:provided
] +- com.queauji.hims:hims-entity-api:jar:1.0-SNAPSHOT:compile
] |  +- com.queauji.hims:hims-snofyre-shade:jar:1.0-SNAPSHOT:compile
] |  \- com.queauji.hims:hims-terminology:jar:1.0-SNAPSHOT:compile
] |     \- commons-lang:commons-lang:jar:2.6:compile
] +- org.hibernate:hibernate-search:jar:4.2.0.Final:compile
] |  \- org.hibernate:hibernate-search-orm:jar:4.2.0.Final:compile
] |     +- org.hibernate:hibernate-search-engine:jar:4.2.0.Final:compile
] |     |  +- org.apache.lucene:lucene-core:jar:3.6.2:compile
] |     |  +- org.apache.avro:avro:jar:1.6.3:compile
] |     |  |  +- org.codehaus.jackson:jackson-core-asl:jar:1.8.8:compile
] |     |  |  +- org.codehaus.jackson:jackson-mapper-asl:jar:1.8.8:compile
] |     |  |  +- com.thoughtworks.paranamer:paranamer:jar:2.3:compile
] |     |  |  \- org.xerial.snappy:snappy-java:jar:1.0.4.1:compile
] |     |  \- org.apache.lucene:lucene-facet:jar:3.6.2:compile
] |     \- org.hibernate:hibernate-search-analyzers:jar:4.2.0.Final:compile

] |        +- org.apache.lucene:lucene-analyzers:jar:3.6.2:compile
] |        \- org.apache.solr:solr-analysis-extras:jar:3.6.2:compile
] |           +- org.apache.lucene:lucene-smartcn:jar:3.6.2:compile
] |           \- org.apache.lucene:lucene-stempel:jar:3.6.2:compile
] +- org.hibernate:hibernate-envers:jar:4.2.0.Final:provided
] |  \- org.hibernate:hibernate-entitymanager:jar:4.2.0.Final:provided
] +- joda-time:joda-time:jar:1.6:compile
] +- org.hibernate:hibernate-core:jar:4.2.0.Final:compile
] |  +- antlr:antlr:jar:2.7.7:compile
] |  +- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile
] |  +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar
0.Final:compile
] |  +- org.javassist:javassist:jar:3.13.0-GA:compile
] |  \- org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:
le
] +- com.mysema.querydsl:querydsl-apt:jar:3.1.1:provided
] |  \- com.mysema.querydsl:querydsl-codegen:jar:3.1.1:provided
] |     +- com.mysema.codegen:codegen:jar:0.5.9:provided
] |     |  \- org.eclipse.jdt.core.compiler:ecj:jar:3.7.2:provided
] |     \- javax.inject:javax.inject:jar:1:provided
] +- com.mysema.querydsl:querydsl-jpa:jar:3.1.1:compile
] |  +- com.mysema.querydsl:querydsl-core:jar:3.1.1:compile
] |  |  +- com.google.guava:guava:jar:13.0.1:compile (version managed from
2)
] |  |  +- com.google.code.findbugs:jsr305:jar:1.3.9:compile
] |  |  +- com.mysema.commons:mysema-commons-lang:jar:0.2.4:compile
] |  |  \- cglib:cglib:jar:2.2.2:compile
] |  |     \- asm:asm:jar:3.3.1:compile
] |  \- org.slf4j:slf4j-api:jar:1.6.1:compile
] +- org.slf4j:slf4j-log4j12:jar:1.6.1:compile
] |  \- log4j:log4j:jar:1.2.16:compile
] +- javax:javaee-web-api:jar:6.0:provided
] \- junit:junit:jar:4.8.2:test
] ------------------------------------------------------------------------
] BUILD SUCCESS

shawn.won

unread,
Nov 13, 2013, 1:19:16 AM11/13/13
to quer...@googlegroups.com
I have exact same problem. Any progress with you ?

2013년 5월 9일 목요일 오후 9시 49분 35초 UTC+9, Edem Morny 님의 말:

Timo Westkämper

unread,
Nov 13, 2013, 2:20:22 AM11/13/13
to Querydsl on behalf of shawn.won
Hi.

Are you sure there are no other guava versions on the classpath?

Timo


--
You received this message because you are subscribed to the Google Groups "Querydsl" group.
To unsubscribe from this group and stop receiving emails from it, send an email to querydsl+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

원상호

unread,
Nov 13, 2013, 2:23:54 AM11/13/13
to Querydsl on behalf of Timo Westkämper
Problem solved (in my case).

Actually I was using groovy-eclipse-compiler. (though I am not a groovy master) 
After changing groovy-eclipse-compiler version from 2.8.0-01 to 2.7.0-01 solved the problem.

Following links were helpful. 


Thank you.
-----------~~-----------------~~-----------------~~------------------~~--------------------~~--------------------~~------
* 원상호 (Won, Shawn)
* E-Mail (shaw...@gmail.com), Jabber ID : shaw...@gmail.com
* --- "The best way to predict the future is to invent it" - Alan Kay
-----------~~-----------------~~-----------------~~------------------~~--------------------~~--------------------~~------
Reply all
Reply to author
Forward
0 new messages