Bug 1120972 - NullPointerException during creating KieBase if using "KieClasspathContainer" and xsd type resource is present
Summary: NullPointerException during creating KieBase if using "KieClasspathContainer"...
Keywords:
Status: VERIFIED
Alias: None
Product: JBoss BRMS Platform 6
Classification: Retired
Component: BRE
Version: 6.0.2
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: DR2
: 6.1.0
Assignee: Mario Fusco
QA Contact: Marek Winkler
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-18 04:57 UTC by Lyle Wang
Modified: 2018-12-06 17:23 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)
reproducer maven project (8.89 KB, application/zip)
2014-07-18 04:57 UTC, Lyle Wang
no flags Details

Description Lyle Wang 2014-07-18 04:57:40 UTC
Created attachment 918966 [details]
reproducer maven project

Description of problem:

When using the code below to get KieBase, if using "KieClasspathContainer" and there is ".xsd" resource present in the classpath, NullPointerException will be thrown as "JaxbConfigurationImpl" was not set properly.

========================
    KieServices ks = KieServices.Factory.get();
    KieContainer kContainer = ks.getKieClasspathContainer();
    KieBase kBase = kContainer.getKieBase("kbase");
========================

Version-Release number of selected component (if applicable):

drools-compiler 6.0.3-redhat-4


How reproducible:

Always


Steps to Reproduce:
1. Unzip attachment "reproducer.zip" and import maven project "01144843" into JBDS / Eclipse
2. Compile and execute "ProcessMain # main()"


Actual results:

Following stacktrace is printed out:

Exception in thread "main" java.lang.NullPointerException
	at org.drools.compiler.compiler.PackageBuilder.addPackageFromXSD(PackageBuilder.java:823)
	at org.drools.compiler.compiler.CompositeKnowledgeBuilderImpl.buildResources(CompositeKnowledgeBuilderImpl.java:209)
	at org.drools.compiler.compiler.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:86)
	at org.drools.compiler.kie.builder.impl.AbstractKieModule.buildKnowledgePackages(AbstractKieModule.java:219)
	at org.drools.compiler.kie.builder.impl.KieContainerImpl.createKieBase(KieContainerImpl.java:387)
	at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:347)
	at com.sample.ProcessMain.main(ProcessMain.java:12)



Expected results:

KieBase object is expected with no exception thrown.


Additional info:

Comment 2 Mario Fusco 2014-07-21 17:55:21 UTC
I fixed this issue with this commit https://github.com/droolsjbpm/drools/commit/a1a717c8c

However I believe we have a more general problem here: we need to differentiate between resources with compilation problems and resources that are not related at all with Drools. For instance we could have lots of false compilation problems if Drools tries to parse a xls file thinking that it is a decision table while actually it isn't. At the moment we don't have such a mechanism, but we could at least try to implement some heuristics to "guess" if a xls file has to be treated as a decision table or not.

Comment 3 Marek Winkler 2014-09-26 16:14:16 UTC
Verified on BRMS 6.1.0.DR3.


Note You need to log in before you can comment on or make changes to this bug.