Put a breakpoint just before you call
KnowledgeBuilderFactory.newKnowledgeBuilder()
and do
System.out.println(KnowledgeBuilderFactory.getClass().getPackage().getImplementationVersion());
System.out.println(CompositeClassLoader.getClass().getPackage().getImplementationVersion());
Instead of getImplementationVersion(), also try getSpecificationVersion().
If you use debug, there's a variable/method on that Package that will
actually show you the filepath of the jar which defines it.
Op 07-08-12 17:21, pratibhapandey schreef:
Hello Team,
I am creating a web service in java using eclipse and axis2 which has some
drools functionality in it.
This is my drools class:
public class LeverageDrools {
public LeverageDrools(){
}
public List<List<String>>
findCorpLeverageName(List<LeverageBSLAData>
lvgBsladataList) throws Exception{
KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
KnowledgeRuntimeLogger logger =
KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");
List<List<String>> corpLevList = new
ArrayList<List<String>>();
for(int i=0; i<lvgBsladataList.size();i++){
LeverageBSLAData lvgBsladata = lvgBsladataList.get(i);
lvgBsladata.setCorpLeverageName("");
ksession.insert(lvgBsladata);
ksession.fireAllRules();
List<String> bslaList = new ArrayList<String>();
bslaList.add(lvgBsladata.getInvestmentNumber());
bslaList.add(lvgBsladata.getCorpLeverageName());
corpLevList.add(bslaList);
}
logger.close();
return corpLevList;
}
private static KnowledgeBase readKnowledgeBase() throws Exception {
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
DecisionTableConfiguration config =
KnowledgeBuilderFactory.newDecisionTableConfiguration();
config.setInputType(DecisionTableInputType.XLS);
//kbuilder.add(ResourceFactory.newClassPathResource("com/ge/re/leverage/drools/resources/LeverageTagging.drl"),
ResourceType.DRL);
kbuilder.add(ResourceFactory.newClassPathResource("com/LeverageRuleSheet.xls"),
ResourceType.DTABLE, config);
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0) {
for (KnowledgeBuilderError error: errors) {
System.err.println(error);
}
throw new IllegalArgumentException("Could not parse
knowledge.");
}
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
return kbase;
}
}
and this is my POM:
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr-runtime</artifactId>
<version>3.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>knowledge-api</artifactId>
<version>5.4.0.Final</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>5.4.0.Final</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>5.4.0.Final</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-jsr94</artifactId>
<version>5.4.0.Final</version>
</dependency>
<dependency>
<groupId>org.mvel</groupId>
<artifactId>mvel2</artifactId>
<version>2.1.0.drools16</version>
</dependency>
<dependency>
<groupId>javax.rules</groupId>
<artifactId>jsr94</artifactId>
<version>1.4.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6.10</version>
</dependency>
The build is fine and service also deploys well. but when I try to access
the service from a client, I get the following error on:
20:30:33,105 INFO [STDOUT] [ERROR]
org.drools.util.CompositeClassLoader.clone()Lorg/drools/util/CompositeClassLoader;
java.lang.NoSuchMethodError:
org.drools.util.CompositeClassLoader.clone()Lorg/drools/util/CompositeClassLoader;
at
org.drools.compiler.PackageBuilderConfiguration.getClassLoader(PackageBuilderConfiguration.java:358)
at
org.drools.rule.builder.dialect.java.JavaDialectConfiguration.setCompiler(JavaDialectConfiguration.java:94)
at
org.drools.rule.builder.dialect.java.JavaDialectConfiguration.init(JavaDialectConfiguration.java:57)
at
org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:309)
at
org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:298)
at
org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:187)
at
org.drools.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:165)
at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:301)
at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:229)
at
org.drools.builder.impl.KnowledgeBuilderFactoryServiceImpl.newKnowledgeBuilder(KnowledgeBuilderFactoryServiceImpl.java:34)
at
org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:47)
the error is coming on KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder(); this line..
Please help as this is an urgent issue.
--
View this message in context:
http://drools.46999.n3.nabble.com/Getting-java-lang-NoSuchMethodError-org...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
With kind regards,
Geoffrey De Smet