TheAptKid
TheAptKid

Reputation: 1571

Missing class in jar file. NoClassDefFoundError exception returned

I'm trying to setup the WZwave library in my maven project. I followed instruction on thesetup page (also installed the RXTX library as described in this video). After running the application I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError:       
    io/netty/channel/rxtx/RxtxDeviceAddress
    at asd.WZWaveTest.<init>(WZWaveTest.java:13)
    at asd.WZWaveTest.main(WZWaveTest.java:27)
    Caused by: java.lang.ClassNotFoundException:     
    io.netty.channel.rxtx.RxtxDeviceAddress
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 2 more

If I understood correctly, the netty-transport jar file is missing the definition of the class RxtxDeviceAddress.

I tried updating to the lastest version of the jar file (4.0.36), but the problem persists.

Does anybody know, what else could be wrong?

EDIT1: My pom.xml is the same as the one from the setup page (linked above), with some different properties (I updated the "version" tag of the netty-transport dependeny to see, if the class existed there):

I'm trying to run if from the eclipse IDE.

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>asd</groupId>
  <artifactId>asd</artifactId>
  <version>0.0.1-SNAPSHOT</version>
   <packaging>jar</packaging>
   <dependencies>
      <dependency>
         <groupId>com.whizzosoftware</groupId>
         <artifactId>wzwave</artifactId>
         <version>0.0.3</version>
      </dependency>
      <dependency>
         <groupId>io.netty</groupId>
         <artifactId>netty-transport</artifactId>
         <version>4.0.36.Final</version>
         <scope>runtime</scope>
      </dependency>
   </dependencies>
</project>

EDIT2: It's working. As @Darek pointed out, the problem was in the missing jar dependency. I added netty-all.jar and a few others, and it started working. Thanks.

@Darek: If you write your comment as an answer I'll be happy to accept it.

Upvotes: 0

Views: 1099

Answers (1)

Darek
Darek

Reputation: 570

I'm guessing that there's need to add netty-all dependency. Why? Check where you can find RxtxDeviceAddress class on GrepCode

Upvotes: 1

Related Questions