cancel
Showing results for 
Search instead for 
Did you mean: 

NoClassDefFoundError on dependency class

SOLVED
NHussey
Occasional Contributor

NoClassDefFoundError on dependency class

I'm having trouble using a dependency in a test step plugin that I'm working on.  Everything builds with no issue, and I'm able to add the plugin through the plugin manager, but when I try to add a test step, I get this error:

 

Thu Mar 19 15:12:10 EDT 2015:ERROR:Error building actions
java.lang.NoClassDefFoundError: org/springframework/web/socket/WebSocketHandler.

 

 

 In my plugin pom, I have the following dependency:

<dependency>
<groupId>promethean</groupId>
<artifactId>WebServiceTools</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>

 

The WebServiceTools module is a child module.  WebServiceTools' parent module has the following dependency:

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
<version>${org.springframework-version}</version>
</dependency>

spring-websocket contains the class that the error says is missing.  I can also see the spring-websocket jar and the missing class under my External Libraries.  If I remove all uses of spring-websocket, then I get no errors and I'm able to add the plugin test step.  Any ideas why the dependency is found at compile time, but not at runtime?  How do I make sure it's included in the plugin jar?

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
OLensmar
Staff

Re: NoClassDefFoundError on dependency class

Hi!

 

sounds like you need to use the maven assembly plugin to package up your plugin to contain your 3rd party dependencies - this is basically done in the following steps:

- add the assembly plugin to your pom.xml

- create the assembly configuration file to package your 3rd party libs with your jar

- run "mvn clean install assembly:single" to build the dist jar that will contain both your plugin classes and also the 3rd party libraries

 

To get this working - have a look at the Swagger plugin at https://github.com/olensmar/soapui-swagger-plugin

https://github.com/olensmar/soapui-swagger-plugin/blob/master/pom.xml configures the assembly plugin

https://github.com/olensmar/soapui-swagger-plugin/blob/master/src/assembly/dist-assembly.xml is that actual assembly descriptor that configures what goes into the assembly

 

You can indulge yourself in the assembly plugin at http://maven.apache.org/plugins/maven-assembly-plugin/ 🙂

 

Hope this helps - let us know!

 

/Ole

View solution in original post

2 REPLIES 2
OLensmar
Staff

Re: NoClassDefFoundError on dependency class

Hi!

 

sounds like you need to use the maven assembly plugin to package up your plugin to contain your 3rd party dependencies - this is basically done in the following steps:

- add the assembly plugin to your pom.xml

- create the assembly configuration file to package your 3rd party libs with your jar

- run "mvn clean install assembly:single" to build the dist jar that will contain both your plugin classes and also the 3rd party libraries

 

To get this working - have a look at the Swagger plugin at https://github.com/olensmar/soapui-swagger-plugin

https://github.com/olensmar/soapui-swagger-plugin/blob/master/pom.xml configures the assembly plugin

https://github.com/olensmar/soapui-swagger-plugin/blob/master/src/assembly/dist-assembly.xml is that actual assembly descriptor that configures what goes into the assembly

 

You can indulge yourself in the assembly plugin at http://maven.apache.org/plugins/maven-assembly-plugin/ 🙂

 

Hope this helps - let us know!

 

/Ole

View solution in original post

NHussey
Occasional Contributor

Re: NoClassDefFoundError on dependency class

Woot!  That did it.  Thanks!

New Here?
Join us and watch the welcome video:
Building with the Collaborator API

Help Documenation
The Collaborator API is a JSON-RPC API that lets you integrate with Collaborator 9.0 and above. For more information about how the API works, check out the API description here:


Sample Plugins
For an example of an add-in that uses the API, take a look at the Microsoft Word Add-in for Collaborator:


We list all the great plugins our network has already built on this page on the SmartBear website.