2

I am working on a maven project for which I am using a custom jar file and I included that in pom.xml as

<dependency>
        <groupId>io.dropwizard</groupId>
        <artifactId>dropwizard-migrations</artifactId>
        <scope>system</scope>
        <version>0.7.0</version>
        <systemPath>${basedir}/dropwizard-migrations-0.7.0.jar</systemPath>
</dependency>

but after mvn package and Compiling I am getting the NoClassDefFoundError

Exception in thread "main" java.lang.NoClassDefFoundError: io/dropwizard/migrations/MigrationsBundle
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at in.myGroupID.Artifact.game.myApplication.initialize(myApplication.java:48)
    at io.dropwizard.Application.run(Application.java:70)
    at in.myGroupID.Artifact.game.myApplication.main(myApplication.java:44)
Caused by: java.lang.ClassNotFoundException: io.dropwizard.migrations.MigrationsBundle
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 15 more
Dheerendra
  • 1,488
  • 5
  • 19
  • 36
  • 1
    The possible duplicate of [this](http://stackoverflow.com/questions/5692256/maven-best-way-of-linking-custom-external-jar-to-my-project). And check out [this](http://www.mkyong.com/maven/how-to-include-library-manully-into-maven-local-repository/) as well for installing jar in local repository. – Wundwin Born May 23 '14 at 04:05

1 Answers1

0

I think everything is all right in your case. But please make sure that the location of your jar is correct. I mean in ${basedir}/dropwizard-migrations-0.7.0.jar ${baseDir} means project home directory and your jar must be in your project home directory . If it is not in project home directory, put it there or change systemPath value to point actual location to the jar file.

Kuldeep Singh
  • 199
  • 1
  • 11