Testing dependencies - java.lang.ClassNotFoundException: com.yammer.dropwizard.json.Json

412 views
Skip to first unread message

Sri Gogineni

unread,
Jul 16, 2013, 2:59:50 PM7/16/13
to dropwiz...@googlegroups.com
Hi,

I'm using IntelliJ and maven for a project. It was working fine but now that I've added tests I get the error below. Goolge-ing and searching this group have yielded no results. Does anyone have any ideas?

java.lang.NoClassDefFoundError: com/yammer/dropwizard/json/Json
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2475)
at java.lang.Class.getDeclaredMethods(Class.java:1818)
at org.junit.runners.model.TestClass.<init>(TestClass.java:38)
at org.junit.runners.ParentRunner.<init>(ParentRunner.java:65)
at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:59)
at org.junit.internal.builders.JUnit4Builder.runnerForClass(JUnit4Builder.java:13)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:93)
at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:84)
at com.intellij.junit4.JUnit46ClassesRequestBuilder.collectWrappedRunners(JUnit46ClassesRequestBuilder.java:69)
at com.intellij.junit4.JUnit46ClassesRequestBuilder.getClassesRequest(JUnit46ClassesRequestBuilder.java:40)
at com.intellij.junit4.JUnit4TestRunnerUtil.buildRequest(JUnit4TestRunnerUtil.java:82)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.ClassNotFoundException: com.yammer.dropwizard.json.Json
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 23 more

Best,
Sri

Jeremy Levy

unread,
Jul 16, 2013, 3:08:08 PM7/16/13
to dropwiz...@googlegroups.com
Are you sure all references to DW in your pom.xml are referencing the correct version of dropwizard (0.6.2)?


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



--
_______________________________________________
Jeremy Levy | Chief Technology Officer
MeetMoi
520 Broadway, 10th Floor
New York, NY 10012
http://www.meetmoi.com
http://www.twitter.com/meetmoi
http://www.facebook.com/meetmoi

Sri Gogineni

unread,
Jul 16, 2013, 3:17:21 PM7/16/13
to dropwiz...@googlegroups.com
Thanks! That was exactly the issue! I accidentally specified 0.4.1 for dropwizard-testing.


--- pom.xml ---

    <properties>
        ...
        <encoding>UTF-8</encoding>

        <dropwizard.version>0.6.2</dropwizard.version>
        <dropwizard-testing.version>0.4.1</dropwizard-testing.version>
        ...
    </properties>

    <dependency>
            <groupId>com.yammer.dropwizard</groupId>
            <artifactId>dropwizard-core</artifactId>
            <version>${dropwizard.version}</version>
        </dependency>
        <dependency>
            <groupId>com.yammer.dropwizard</groupId>
            <artifactId>dropwizard-db</artifactId>
            <version>${dropwizard.version}</version>
        </dependency>
        <dependency>
            <groupId>com.yammer.dropwizard</groupId>
            <artifactId>dropwizard-jdbi</artifactId>
            <version>${dropwizard.version}</version>
        </dependency>
    <dependency>
            <groupId>com.yammer.dropwizard</groupId>
            <artifactId>dropwizard-testing</artifactId>
            <version>${dropwizard-testing.version}</version>
            <scope>test</scope>
        </dependency>


Best,
Sri
Reply all
Reply to author
Forward
0 new messages