Bug 996144
Summary: | Kie-spring cannot create KieModule when in container | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | [Retired] JBoss BRMS Platform 6 | Reporter: | Marek Winkler <mwinkler> | ||||||||||||
Component: | BRE | Assignee: | Mario Fusco <mfusco> | ||||||||||||
Status: | CLOSED CURRENTRELEASE | QA Contact: | Marek Winkler <mwinkler> | ||||||||||||
Severity: | high | Docs Contact: | |||||||||||||
Priority: | unspecified | ||||||||||||||
Version: | 6.0.0 | CC: | mfusco, rzhang | ||||||||||||
Target Milestone: | ER3 | ||||||||||||||
Target Release: | 6.0.0 | ||||||||||||||
Hardware: | Unspecified | ||||||||||||||
OS: | Unspecified | ||||||||||||||
Whiteboard: | |||||||||||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||||||||||
Doc Text: | Story Points: | --- | |||||||||||||
Clone Of: | Environment: | ||||||||||||||
Last Closed: | 2014-08-06 20:20:31 UTC | Type: | Bug | ||||||||||||
Regression: | --- | Mount Type: | --- | ||||||||||||
Documentation: | --- | CRM: | |||||||||||||
Verified Versions: | Category: | --- | |||||||||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||||||||
Embargoed: | |||||||||||||||
Attachments: |
|
Description
Marek Winkler
2013-08-12 13:56:37 UTC
Created attachment 785695 [details]
server.log
Created attachment 785696 [details]
Exception stacktrace
After discussion with Vinod, I have created application context using new ClassPathXmlApplicationContext(appContextXmlFile) which helped me to get further. However, the ClasspathKieProject.getPomProperties() fails to locate pom.properties file in the deployed WAR archive and throws a NPE (see attachment for full stacktrace): java.lang.NullPointerException: null at java.io.File.<init>(File.java:251) at org.drools.compiler.kie.builder.impl.ClasspathKieProject.getPomProperties(ClasspathKieProject.java:240) The server log contains the following error, which indicates (unless I missed something), that the rootPath variable in ClasspathKieProject.getPomProperties(String) is absolute after removing the protocol 'vfs:', and therefore points to non-existent directory: 10:51:15,486 WARN [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (http-/127.0.0.1:8080-2) Unable to load pom.properties tried recursing down from/content/spring.war/WEB-INF/classes/ null In my opinion, there are two problems: - the NPE should be caught and handled - ClasspathKieProject.getPomProperties() seems not to handle correctly the vfs: protocol - this should manifest in KIE CDI container tests as well, I will check it. Created attachment 786089 [details]
server.log with wrong pom.properties path
Created attachment 786090 [details]
NPE in ClasspathKieProject.getPomProperties() - parent dir is null?
Another update: Plain KIE CDI tests (without Spring) pass. I realized that there is probably a problem in not using the ClasspathKieProject.fixURLFromKProjectPath(URL) method, as the ClasspathKieProject.fetchKModule(URL) does for plain (without Spring) CDI. I have tried to change the org.kie.spring.KModuleBeanFactoryPostProcessor.initConfigFilePath() to the following: protected void initConfigFilePath() { // the original initialization code //configFilePath = getClass().getResource("/").getPath(); ProjectClassLoader cl = ProjectClassLoader.createProjectClassLoader(); configFilePath = ClasspathKieProject.fixURLFromKProjectPath(cl.getResource("META-INF/kmodule.xml")); } and our KIE Spring tests in container pass. However, this is not a general solution, as this code: - detects the configFilePath from any location (e.g. any JAR) on the classpath, i.e. the found pom.properties might be not the one really looked for; - requires META-INF/kmodule.xml to be located in the module, where pom.properties is being looked for (I think it was the original intention to get rid of kmodule.xml in this case). Should there be any generic configFilePath detection mechanism (I am not sure if it is possible in this case), or should the configFilePath be set externally, e.g. in the Spring context XML? Created PR with reproducer: https://github.com/droolsjbpm/droolsjbpm-integration/pull/66 Please run org.drools.jboss.integration.spring.KieSpringTest and note two possible problems: - NPE in org.drools.compiler.kie.builder.impl.ClasspathKieProject.getPomProperties - log message indicating that it is trying to look for pom.properties in a non-existent location (/content/...): 15:24:49,672 WARN [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (pool-1-thread-1) Unable to load pom.properties tried recursing down from/content/arquillian-service/ null Sorry, forgot to mention that you should run the tests with 'arquillian-jbossas-managed' maven profile, otherwise the weld container is used instead of JBoss AS. The problem is present when using EAP 6.1. Verified on BRMS 6.0.0-ER3. |