1

First of all I am referring to this question (LINK) which did not help me because then versions of frameworks were lower so I am starting new question.

So I am using Grails 2.4.3 framework and trying to use Drools rule engine inside it. Java version is 1.0.8_20 and groovy version is 2.3.9. Dependencies in BuildConfig are:

runtime 'org.drools:drools-core:5.5.0.Final'
runtime 'org.drools:knowledge-api:5.5.0.Final'

In this line of code :

KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder()

I get this exception:

Error initializing the application: com/sun/tools/xjc/Options
Caused by ClassNotFoundException: com.sun.tools.xjc.Options

I've tried to change versions of drools-core/knowledge-api to higher (up to 6.0.1.Final) but keep getting the same error. I've also tried to import this strange xjc dependencies as mentioned in post that I was referring in the beginning but with no success.

Does anyone knows what is the solution to this problem?

Btw full stack trace is :

| Error 2014-12-19 18:04:49,851 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener  - Error initializing Grails: com/sun/tools/xjc/Options
Message: com/sun/tools/xjc/Options
    Line | Method
->> 2688 | privateGetDeclaredMethods        in java.lang.Class
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1962 | getDeclaredMethods               in     ''
|     46 | getLocked . . . . . . . . . . .  in org.codehaus.groovy.util.LazyReference
|     33 | get                              in     ''
|     46 | doCall . . . . . . . . . . . . . in account.manager.rule.knowledge.Knowledge$_initialize_closure1
|     43 | initialize                       in account.manager.rule.knowledge.Knowledge
|     39 | $tt__initialize . . . . . . . .  in account.manager.RuleSyncService
|     24 | doCall                           in BootStrap$_closure1
|    327 | evaluateEnvironmentSpecificBlock in grails.util.Environment
|    320 | executeForEnvironment            in     ''
|    296 | executeForCurrentEnvironment . . in     ''
|    266 | run                              in java.util.concurrent.FutureTask
|   1142 | runWorker . . . . . . . . . . .  in java.util.concurrent.ThreadPoolExecutor
|    617 | run                              in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run . . . . . . . . . . . . . .  in java.lang.Thread
Caused by ClassNotFoundException: com.sun.tools.xjc.Options
Community
  • 1
  • 1
Ivan Longin
  • 3,207
  • 4
  • 33
  • 42
  • Any chance for the *full* stack dump? – laune Dec 19 '14 at 17:00
  • It's probably not a good idea to change from Drools 5.5 to 6.x without making sure that everything is compatible. In that other link you say you are using 6.1.0-Final, but here you refer to 5.5.0.Final runtimes. Make sure to identify the actual version with your stackdump. – laune Dec 19 '14 at 17:04
  • Where is that line "KnowledgeBuilder knowledgeBuilder =..."? – laune Dec 19 '14 at 17:13
  • @laune I've added stack trace (as you can see, there is not many informations in there at least I cannot see anything smart out there :) ... In other link I said that I am using last version of drools but as I wrote here I have tried every version between 5.5 to 6.1. – Ivan Longin Dec 19 '14 at 17:14
  • So in my BootStrap I am calling some service which initialize my knowledge base (puts it into some map in memory) so that line is in service which is called from BootStrap. – Ivan Longin Dec 19 '14 at 17:15

1 Answers1

2

com/sun/tools/xjc/Options.class is in the jar jaxb-xjc.jar that comes with the JAXB distribution. Normally, javax.xml.bind and the xjc tool are available via JDK and the Java binaries. But, if some application needs to call the XML Schema compiler via its API, the individual classes contained in that jar must be available.

laune
  • 31,114
  • 3
  • 29
  • 42