Skip to content

Runtime classpath problem with maven dependencies #925

Closed

Description

@dmarrazzo

[provide a description of the issue]

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.33.1

  • 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
  1. import projects:
    https://gitlab.com/ba-demos/dmn-insurance/insurance-decision
    https://gitlab.com/ba-demos/dmn-insurance/kie-client

  2. install decision
    cd insurance-decision
    mvn clean install

  3. run the client from maven work as expected
    mvn clean exec:java

  4. 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.(KieServices.java:341)
at org.kie.api.KieServices$Factory.get(KieServices.java:348)
(...)

Expected Result

Run as:
mvn clean exec:java

Activity

  1. dmarrazzo commented on May 18, 2019

    @dmarrazzo
    Author

    Hi @fbricon
    is it the right place for this issue?
    Thank you

  2. dmarrazzo commented on May 18, 2019

    @dmarrazzo
    Author

    I've noticed this behavior:

    • when I run vscode inside the project (kie-client) it works nicely!
    • when I run vscode in the parent folder (that contains other projects and kie-client), It has the problem.

    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

  3. fbricon commented on May 18, 2019

    @fbricon
    Collaborator

    vscode-java is not providing the Java running facilities in VS Code. That would be https://github.com/Microsoft/vscode-java-debug. Now it seems you're running mvn directly, so that's probably not even vscode's issue. You should see the exact same results when running in a terminal.
    I won't be able to look at this issue until the next few days, but maybe someone else can help you investigate in the meantime.

  4. dmarrazzo commented on May 18, 2019

    @dmarrazzo
    Author

    Hi @fbricon thank you for the prompt reply, I've open the same issue in vscode-java-debug.
    BTW, the execution in maven command line was there just for comparison.
    Now it's not more relevant since the same vscode has 2 different behaviour depending on the workspace root.

  5. dmarrazzo commented on May 23, 2019

    @dmarrazzo
    Author

    It's a bug of vscode-java-debug, so I'm closing here.
    I'm looking forward to see the resolution! Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions