5

I have a question regarding SPOCK + Drools testing. Here's the thing,

KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder();

That line of code works absolutely fine,inside a JUnit test case. It doesn't inside SPOCK.

I get the following exception,

java.lang.NoClassDefFoundError: com/sun/tools/xjc/Options
    at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
    at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)

Caused by: java.lang.ClassNotFoundException: com.sun.tools.xjc.Options
    ... 3 more

What could be the problem? Is it drools related? Unable to get ny head riund the problem. Any help is much appreciated :)

Update:

I am running the test inside a webapp w/o it being deployed(if that makes any sense :)). I added the jar to the classpath(not WEB-INF/libs) and it is working fine now.

Avinash
  • 347
  • 1
  • 4
  • 15

1 Answers1

1

Although OP states in his update that the problem got fixed by adding appropriate libs to classpath, he does not specify the libs.

I believe this issue gets fixed by adding the following to your dependencies

build('com.sun.xml.bind:jaxb-xjc:2.1')
build('com.sun.xml.bind:jaxb-impl:2.1')
kaskelotti
  • 4,709
  • 9
  • 45
  • 72
  • I have the same problem but this dependencies did not helped me. Does anyone know what should be a solution? I am using 6.1.0.Final version of both drools and knowledge-api – Ivan Longin Dec 19 '14 at 00:29
  • @ivan In my case the **Drools version was 5.5-something**. I'd recommend you to post a new question with Drools 6.1.0 specific tags. And also link you new question to this one stating that it's not a duplicate. – kaskelotti Dec 19 '14 at 03:23