views:

51

answers:

1

In a jboss service I need to mock some inner class (not EJB) with JMockit. Just for tests I've created inner class ToBeMocked and another one Mock. While deploying to jboss I get error NoClassDefFoundError in line:

Mockit.setUpMock(ToBeMocked.class, new Mock());

with message:

java.lang.NoClassDefFoundError: mockit/Mockit

jmockit.jar is added to the classpath in jboss_service.xml.

Any ideas?

A: 

The "classpath" in jboss_service is very misleading in terms of jar location and how the attributes of the tag work. First, start by putting the Mockit jar in the server lib directory (if you didn't do anything fancy that is server/default/lib and restarting JBoss. If that works, then you can read more about how to correctly set that classpath attribute here (search for the word classpath).

Yishai