Bug 1051585 - Kie-spring cannot create KieModule in container on Windows
Summary: Kie-spring cannot create KieModule in container on Windows
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss BRMS Platform 6
Classification: Retired
Component: BRE
Version: 6.0.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ER2
: 6.0.1
Assignee: Mario Fusco
QA Contact: Marek Winkler
URL:
Whiteboard:
Depends On:
Blocks: 1058254
TreeView+ depends on / blocked
 
Reported: 2014-01-10 16:10 UTC by Marek Winkler
Modified: 2014-08-06 19:57 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
When trying to deploy a Maven project with a WAR file on EAP6 in a Windows environment (2012 Server and Windows 8.1), the kie-spring throws a NullPointerException when trying to load KieModule. The deployment doesn't seem to raise any errors, but the server log shows the error and the WAR file is not actually deployed. Cause: Consequence: Fix: Result:
Clone Of:
Environment:
Last Closed: 2014-08-06 19:57:22 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Maven project with WAR illustrating the issue (5.56 KB, application/zip)
2014-01-10 16:10 UTC, Marek Winkler
no flags Details
server.log with NPE (9.54 KB, text/plain)
2014-01-10 16:11 UTC, Marek Winkler
no flags Details
server.log part illustrating searching wrong directory for pom.properties (4.81 KB, text/plain)
2014-02-20 15:28 UTC, Marek Winkler
no flags Details
Maven project with reproducer updated to ER1 (5.57 KB, application/zip)
2014-02-21 09:42 UTC, Marek Winkler
no flags Details
server.log from deploying the ER1 reproducer on Windows (13.87 KB, text/plain)
2014-02-21 12:05 UTC, Marek Winkler
no flags Details

Description Marek Winkler 2014-01-10 16:10:52 UTC
Created attachment 848277 [details]
Maven project with WAR illustrating the issue

Description of problem:

Kie-spring throws the following NPE when trying to load KieModule on EAP 6 running on Windows:

ava.lang.NullPointerException: null
	at java.io.File.<init>(File.java:222)
	at org.drools.compiler.kie.builder.impl.ClasspathKieProject.getPomProperties(ClasspathKieProject.java:228)
	at org.kie.spring.KModuleBeanFactoryPostProcessor.postProcessBeanFactory(KModuleBeanFactoryPostProcessor.java:95)
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:663)
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:653)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:407)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)

According to the attached server.log part, the bug is likely to be related to BZ 1036556.

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

BRMS 6.0.0 ER7
EAP 6.1.1
Windows 2012 Server

How reproducible:

Please try to deploy WAR from the attached maven project onto EAP 6.1.1 on Windows.

You need to do mvn clean install and deploy target/kie-spring-war-1.0.0-SNAPSHOT.war into EAP 6.1.1.

It deploys successfully (the web app does not actually do anything apart from initialization of Spring context), but see the server.log for the error.

Actual results:

NPE is thrown during deployment.

Expected results:

Application deploys without errors in the log.

Comment 1 Marek Winkler 2014-01-10 16:11:43 UTC
Created attachment 848278 [details]
server.log with NPE

Comment 2 Edson Tirelli 2014-01-10 16:14:45 UTC
Marek, just to be clear, does this problem also happens in other platforms (e.g. Linux) or only on Windows?

Comment 3 Marek Winkler 2014-01-10 16:20:28 UTC
The problem appears only on Windows (2012 Server and Windows 8.1 so far), for instance RHEL 6 and Solaris are ok. I suspect a problem with path separators but it is just a guess.

Comment 5 Ryan Zhang 2014-01-15 05:06:57 UTC
By comparing the upstream log, this issue is not picked up in CR1 tag(sync.2014.01.14) and needs to flag to 6.0.1.

Comment 6 Marek Winkler 2014-02-20 15:25:30 UTC
The original NPE is fixed, but another problem remains: ClasspathKieProject fails to find pom.properties because it tries to locate it in a EAP module directory:

(http-/127.0.0.1:8080-1) Unable to load pom.properties from/w:/workspace/brms-bre-container-matrix-jvm-os/36a0f575/jboss-eap-6.1/modules/system/layers/base/sun/jdk/main/service-loader-resources/

and not in the deployed application.

Subsequently, the resources for KieBases defined in spring context cannot be found:

03:33:51,520 WARN  [org.drools.compiler.kie.builder.impl.AbstractKieModule] (http-/127.0.0.1:8080-1) No files found for KieBase kbaseDRL, searching folder \workspace\brms-bre-container-matrix-jvm-os\36a0f575\jboss-eap-6.1\modules\system\layers\base\sun\jdk\main\service-loader-resources

Please see the attached server.log part for details (it comes from our test suite, not the reproducer attached). I will verify that the reproducer illustrates this (as soon as I can get to a Windows machine) and attach a new reproducer, if necessary.

Comment 7 Marek Winkler 2014-02-20 15:28:59 UTC
Created attachment 865581 [details]
server.log part illustrating searching wrong directory for pom.properties

Part of server.log illustrating the problem on our test suite. I will attach the log corresponding to a simpler reproducer as soon as possible.

Comment 8 Marek Winkler 2014-02-21 09:42:09 UTC
Created attachment 865889 [details]
Maven project with reproducer updated to ER1

Adding maven project with reproducer updated to ER1. Just build it, deploy onto EAP 6.1.1 on Windows and see server.log.

Comment 9 Marek Winkler 2014-02-21 12:05:49 UTC
Created attachment 865938 [details]
server.log from deploying the ER1 reproducer on Windows

Comment 10 Kamal Mansoor 2014-02-25 23:51:15 UTC
This behavior is also true for:
Ubuntu 12.4
Kie 6.0.1
Tomcat 7.

java.lang.NullPointerException
        at java.io.File.<init>(File.java:277)
        at org.drools.compiler.kie.builder.impl.ClasspathKieProject.getPomProperties(ClasspathKieProject.java:228)
        at org.kie.spring.KModuleBeanFactoryPostProcessor.postProcessBeanFactory(KModuleBeanFactoryPostProcessor.java:93)

Comment 12 Mario Fusco 2014-02-26 17:03:17 UTC
This problem started appearing when we migrated from EAP 6.1.0 to EAP 6.1.1.

In EAP 6.1.0 when I tried to retrieve the root of the application context path with:

    applicationContext.getResource("classpath:/").getURL();

I got something like:

    vfs:/content/kie-spring-war-1.0.0-SNAPSHOT.war/WEB-INF/classes/

Conversely on EAP 6.1.1 that same statement returns something like:

    file:/opt/jboss/modules/system/layers/base/sun/jdk/main/service-loader-resources/

that doesn't make any sense (under my point of view). What I did to workaround this problem was getting the moduleName from the ModuleClassLoader and artificially recreating the url I got on EAP 6.1.0 with:

    new URL("vfs:/content/" + moduleName + "/WEB-INF/classes/")

However as reported with this ticket this solution worked on linux but not on Windows. Now I've found a more robust way to obtain the correct vfs url. In particular doing:

    getClass().getClassLoader().getResources("/")

returns an enumaration having as first element the usual meaningless url:

    file:/opt/jboss/modules/system/layers/base/sun/jdk/main/service-loader-resources/

Nevertheless iterating this enumeration it is possible to retrieve the correct url in one of its subsequent element. I tested that the vfs url retrieved in this way is correct on both linux and Windows.

Comment 13 Kamal Mansoor 2014-02-27 11:47:31 UTC
Please pardon my ignorance if I missed the point. It seems as though this issue was perceived to be only affecting Windows. This is not correct, I am getting this exception on Ubuntu, so It is Linux & Windows.

My environment:
Ubuntu 12.04.4 LTS
Drools: 6.0.1
Spring 4.0

Comment 14 Marek Winkler 2014-03-10 09:07:57 UTC
Verified that this issue has been fixed in BRMS 6.0.1 ER2 when running on Windows.

Kamal, could you verify this in your Ubuntu environment, and create a separate JIRA for this if it did not work? The reason is that I cannot replicate your issue in any of the supported configurations for BRMS. Thanks a lot for reporting this! Please drop me an email, if you needed further information.


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