Launching vscode in the maven root folder, the debug is able to manage correctly the classpath.
Whereas when vscode is launched in the parent folder (that contains more maven projects) it fails to execute the project due to a wrong classpath evaluation.
In order to debug, I've added those lines at the beginning of the main:
try {
Class.forName("org.drools.compiler.commons.jci.readers.ResourceReader");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
ClassLoader cl = EmbedMain.class.getClassLoader();
URL[] urls = ((URLClassLoader) cl).getURLs();
for (URL url : urls) {
System.out.println(url.getFile());
}
The output (attached) shows that the classpath is significantly different:
parent.txt
inner.txt
Linked issue:
redhat-developer/vscode-java#925
Environment
-
Operating System: Linux Fedora 30
-
JDK version: penjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)
-
Visual Studio Code version: 1.34
-
Java extension version: 0.44.0
-
pref
"java.home": "/usr/lib/jvm/java-1.8.0-openjdk/",
"java.jdt.ls.vmargs": "-noverify -Xmx3G -Xss128M -XX:+UseG1GC -XX:+UseStringDeduplication",
Steps To Reproduce
-
import projects:
https://gitlab.com/ba-demos/dmn-insurance/insurance-decision
https://gitlab.com/ba-demos/dmn-insurance/kie-client
-
install decision project
cd insurance-decision
mvn clean install
- running the client from maven, it works as expected
- Launch vscode inside
kie-client project:
- execute
client.EmbedMain
- the program runs with no error
- Launch vscode in the parent folder of the
kie-client project:
- open and execute the class:
client.EmbedMain
Current Result
Loading failed because Cannot create instance of class:
org.kie.pmml.assembler.PMMLAssemblerService
Exception in thread "main"
java.lang.ExceptionInInitializerError
at org.kie.api.internal.utils.ServiceRegistry.getInstance(ServiceRegistry.java:27)
ServiceRegistry.java:27
at org.kie.api.KieServices$Factory$LazyHolder.<clinit>(KieServices.java:341)
at org.kie.api.KieServices$Factory.get(KieServices.java:348)
(...)
Expected Result
it runs with no error and completes with:
(...)
DMNResultImpl{context={
PreviousIncidents: false
Age: 28
CarAge: 3
Insurance Base Price: 1000
Car reliability factor: function Car reliability factor( car age )
FinalPrice: 1100.0
}
, messages=org.kie.dmn.core.util.DefaultDMNMessagesManager@102d92c4}
Launching vscode in the maven root folder, the debug is able to manage correctly the classpath.
Whereas when vscode is launched in the parent folder (that contains more maven projects) it fails to execute the project due to a wrong classpath evaluation.
In order to debug, I've added those lines at the beginning of the main:
The output (attached) shows that the classpath is significantly different:
parent.txt
inner.txt
Linked issue:
redhat-developer/vscode-java#925
Environment
Operating System: Linux Fedora 30
JDK version: penjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)
Visual Studio Code version: 1.34
Java extension version: 0.44.0
pref
"java.home": "/usr/lib/jvm/java-1.8.0-openjdk/",
"java.jdt.ls.vmargs": "-noverify -Xmx3G -Xss128M -XX:+UseG1GC -XX:+UseStringDeduplication",
Steps To Reproduce
import projects:
https://gitlab.com/ba-demos/dmn-insurance/insurance-decision
https://gitlab.com/ba-demos/dmn-insurance/kie-client
install decision project
cd insurance-decision mvn clean installkie-clientproject:client.EmbedMainkie-clientproject:client.EmbedMainCurrent Result
Loading failed because Cannot create instance of class:
Expected Result
it runs with no error and completes with: