Hi, 

I am trying to run "Hello World" using drools as osgi bundle in Jboss AS.
Deployed below jars  to Jboss container :

drools-compiler-6.0.0.Beta1.jar
drools-core-6.0.0.Beta1.jar
drools-templates-6.0.0.Beta1.jar
kie-api-6.0.0.Beta1.jar
kie-internal-6.0.0.beta1.jar

While deploying my own bundle to Jboss which has "Hello World" Drools
application, I get below exception:

Caused by: org.drools.RuntimeDroolsException: Unable to load dialect
'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java:org.drools.rule.builder.dialect.java.JavaDialectConfiguration'
        at
org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:321)
        at
org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:307)
        at
org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:192)
        at
org.drools.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:170)
        at
org.drools.builder.impl.KnowledgeBuilderFactoryServiceImpl.newKnowledgeBuilderConfiguration(KnowledgeBuilderFactoryServiceImpl.java:22)
        at
org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(KnowledgeBuilderFactory.java:74)
        at
org.drools.container.spring.beans.KnowledgeBaseBeanFactory.afterPropertiesSet(KnowledgeBaseBeanFactory.java:80)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
        ... 34 more
Caused by: java.lang.RuntimeException: The Eclipse JDT Core jar is not in
the classpath
        at
org.drools.rule.builder.dialect.java.JavaDialectConfiguration.setCompiler(JavaDialectConfiguration.java:100)
        at
org.drools.rule.builder.dialect.java.JavaDialectConfiguration.init(JavaDialectConfiguration.java:61)
        at
org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:317)
        ... 42 more


Then added "org.eclipse.jdt.core_3.8.3.v20130121-145325.jar" to classpath of
OSGI bundle (Hello World Bundle) and deployed again.

Above exception has got resolved, but application is not working.
Code below :

public void start(){
                
                logger.info("started.");
                System.out.println("Hello World in client!! ");
                
                //droolsSession = createKnowledgeSession();
                
                MessageTest message = new MessageTest();
        
        message.setMessage("Testing Hello World");
        message.setStatus(MessageTest.HELLO);
        
        droolsSession.insert(message);
        droolsSession.fireAllRules();           
                
                
        }
        
        @SuppressWarnings("deprecation")
        private StatefulKnowledgeSession createKnowledgeSession() {
                System.out.println("Inside createKnowledgeSession!! ");
                KnowledgeBuilderFactoryServiceImpl 
knowledgeBuilderFactoryServiceImpl  =
new KnowledgeBuilderFactoryServiceImpl();
        KnowledgeBuilder kbuilder =
knowledgeBuilderFactoryServiceImpl.newKnowledgeBuilder();
        kbuilder.add((Resource) new ClassPathResource("Sample.drl"),
ResourceType.DRL);
        
        System.out.println("Completed createKnowledgeSession!! ");
        if (kbuilder.hasErrors()) {
            if (kbuilder.getErrors().size() > 0) {
                for (KnowledgeBuilderError kerror : kbuilder.getErrors()) {
                    System.err.println(kerror);
                }
            }
        }
        KnowledgeBase kbase = kbuilder.newKnowledgeBase();
        return kbase.newStatefulKnowledgeSession();
        //return kbase.newStatefulKnowledgeSession();
    }







--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-as-osgi-bundle-in-Jboss-AS-tp4027885.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to