java.lang.NoSuchMethodError

3 messages Options
Embed this post
Permalink
watcher

java.lang.NoSuchMethodError

Reply Threaded More More options
Print post
Permalink
I've getting an error thats got me stumped.

I'm running a junit test through eclipse that passes but when I run it via the command line I'm getting the following error.

java.lang.NoSuchMethodError: au.com.bytecode.opencsv.bean.CsvToBean.parse(Lau/com/bytecode/opencsv/bean/MappingStrategy;Lau/com/bytecode/opencsv/CSVReader;)Ljava/util/List;

I've created my eclipse project using mvn eclipse:eclipse
so I expect that there should be no difference running junit tests through eclipse and the command line.

I have no idea what the problem could be. Any help or pointers to how to resolve this.

thanks


mraible

Re: java.lang.NoSuchMethodError

Reply Threaded More More options
Print post
Permalink
Run mvn dependency:tree and look at the output (or grep for opencsv).  
There's a good chance you have two different versions of the same JAR  
in your classpath. Once you find the offender, exclude it from its  
dependency.

Matt

On Nov 5, 2009, at 1:09 PM, watcher wrote:

>
> I've getting an error thats got me stumped.
>
> I'm running a junit test through eclipse that passes but when I run  
> it via
> the command line I'm getting the following error.
>
> java.lang.NoSuchMethodError:
> au.com.bytecode.opencsv.bean.CsvToBean.parse(Lau/com/bytecode/
> opencsv/bean/MappingStrategy;Lau/com/bytecode/opencsv/
> CSVReader;)Ljava/util/List;
>
> I've created my eclipse project using mvn eclipse:eclipse
> so I expect that there should be no difference running junit tests  
> through
> eclipse and the command line.
>
> I have no idea what the problem could be. Any help or pointers to  
> how to
> resolve this.
>
> thanks
>
>
>
> --
> View this message in context: http://old.nabble.com/java.lang.NoSuchMethodError-tp26220807s2369p26220807.html
> Sent from the AppFuse - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

watcher

Re: java.lang.NoSuchMethodError

Reply Threaded More More options
Print post
Permalink
I found the bugger.

The mvn dependency:tree didnt point to an earlier version of the same jar.
So I figured it had to be included in one of the jar that are compiled for scope test.

Finally, going through my repository I found the culprit.

                <dependency>
                        <groupId>org.liquibase</groupId>
                        <artifactId>liquibase-core</artifactId>
                        <version>1.8.1</version>
                        <type>jar</type>
                        <scope>test</scope>
                </dependency>

It had class files from the opencsv included.

Thanks Matt



mraible wrote:
Run mvn dependency:tree and look at the output (or grep for opencsv).  
There's a good chance you have two different versions of the same JAR  
in your classpath. Once you find the offender, exclude it from its  
dependency.

Matt