Uploaded image for project: 'Red Hat Decision Manager'
  1. Red Hat Decision Manager
  2. RHDM-1984

ClassNotFoundException occurs when launching business-application by mvn spring-boot:run

XMLWordPrintable

    • False
    • None
    • False
    • CR1
    • +
    • Hide
      $ unzip example_business-application_1b.zip
      $ cd example_business-application_1b
      $ cd business-application-service
      $ ./launch_spring_boot_run.sh clean install
      

      Expected behavior: ClassNotFoundException like in the Description of this JIRA is not thrown and spring-boot process starts successfully.

      Actual behavior: spring-boot process starts but ClassNotFoundException is thrown.

      Show
      $ unzip example_business-application_1b.zip $ cd example_business-application_1b $ cd business-application-service $ ./launch_spring_boot_run.sh clean install Expected behavior: ClassNotFoundException like in the Description of this JIRA is not thrown and spring-boot process starts successfully. Actual behavior: spring-boot process starts but ClassNotFoundException is thrown.
    • 2023 Week 27-29 (from Jul 3), 2023 Week 24-26 (from Jun 12)

      When creating self-contained spring-boot kie-server jar with ImmutableSpringBootKieServerImpl (kieserver.classPathContainer=true), the application works with a fat-jar. But failed when executing with mvn spring-boot:run.

       

      2023-06-22 14:49:23.156 ERROR 189745 --- [           main] o.k.server.services.impl.KieServerImpl   : Error creating container 'business-application-kjar-1.0' for module 'com.company:business-application-kjar:1.0'
      
      java.lang.RuntimeException: java.lang.ClassNotFoundException: com.company.example_process_1a.RulesE898CB354FBB2BBE30E2B018EA3CF48C
          at org.drools.modelcompiler.CanonicalKieModule.getModels(CanonicalKieModule.java:426) ~[drools-model-compiler-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at org.drools.modelcompiler.CanonicalKieModule.getModelForKBase(CanonicalKieModule.java:459) ~[drools-model-compiler-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at org.drools.modelcompiler.CanonicalKieModule.createKiePackages(CanonicalKieModule.java:303) ~[drools-model-compiler-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at org.drools.modelcompiler.CanonicalKieModule.lambda$createKieBase$1(CanonicalKieModule.java:234) ~[drools-model-compiler-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705) ~[na:na]
          at org.drools.modelcompiler.CanonicalKieModule.createKieBase(CanonicalKieModule.java:234) ~[drools-model-compiler-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at org.drools.compiler.kie.builder.impl.KieContainerImpl.createKieBase(KieContainerImpl.java:475) ~[drools-compiler-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:439) ~[drools-compiler-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at org.kie.server.services.drools.DroolsKieServerExtension.createContainer(DroolsKieServerExtension.java:102) ~[kie-server-services-drools-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at org.kie.server.services.impl.KieServerImpl.createContainer(KieServerImpl.java:343) ~[kie-server-services-common-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at org.kie.server.services.impl.ContainerManager.installContainersSync(ContainerManager.java:49) ~[kie-server-services-common-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at org.kie.server.services.impl.ContainerManager.installContainers(ContainerManager.java:35) ~[kie-server-services-common-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at org.kie.server.services.impl.ImmutableContainerStartupStrategy.startup(ImmutableContainerStartupStrategy.java:58) ~[kie-server-services-common-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at org.kie.server.services.impl.KieServerImpl.init(KieServerImpl.java:208) ~[kie-server-services-common-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at org.kie.server.springboot.ImmutableSpringBootKieServerImpl.init(ImmutableSpringBootKieServerImpl.java:64) ~[kie-server-spring-boot-autoconfiguration-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at org.kie.server.springboot.autoconfiguration.KieServerAutoConfiguration.kieServer(KieServerAutoConfiguration.java:125) ~[kie-server-spring-boot-autoconfiguration-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at org.kie.server.springboot.autoconfiguration.KieServerAutoConfiguration$$EnhancerBySpringCGLIB$$25c706f0.CGLIB$kieServer$2(<generated>) ~[kie-server-spring-boot-autoconfiguration-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at org.kie.server.springboot.autoconfiguration.KieServerAutoConfiguration$$EnhancerBySpringCGLIB$$25c706f0$$FastClassBySpringCGLIB$$af0f4767.invoke(<generated>) ~[kie-server-spring-boot-autoconfiguration-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.3.18.jar:5.3.18]
          at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-5.3.18.jar:5.3.18]
          at org.kie.server.springboot.autoconfiguration.KieServerAutoConfiguration$$EnhancerBySpringCGLIB$$25c706f0.kieServer(<generated>) ~[kie-server-spring-boot-autoconfiguration-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
          at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
          at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
          at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.18.jar:5.3.18]
          at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.18.jar:5.3.18]
          at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638) ~[spring-beans-5.3.18.jar:5.3.18]
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.3.18.jar:5.3.18]
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) ~[spring-beans-5.3.18.jar:5.3.18]
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.18.jar:5.3.18]
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.18.jar:5.3.18]
          at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.18.jar:5.3.18]
          at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.18.jar:5.3.18]
          at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.18.jar:5.3.18]
          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.18.jar:5.3.18]
          at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953) ~[spring-beans-5.3.18.jar:5.3.18]
          at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.18.jar:5.3.18]
          at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.18.jar:5.3.18]
          at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.12.jar:2.5.12]
          at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.5.12.jar:2.5.12]
          at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:448) ~[spring-boot-2.5.12.jar:2.5.12]
          at org.springframework.boot.SpringApplication.run(SpringApplication.java:339) ~[spring-boot-2.5.12.jar:2.5.12]
          at org.springframework.boot.SpringApplication.run(SpringApplication.java:1365) ~[spring-boot-2.5.12.jar:2.5.12]
          at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) ~[spring-boot-2.5.12.jar:2.5.12]
          at com.company.service.Application.main(Application.java:10) ~[classes/:na]
      Caused by: java.lang.ClassNotFoundException: com.company.example_process_1a.RulesE898CB354FBB2BBE30E2B018EA3CF48C
          at org.drools.reflective.classloader.ProjectClassLoader.tryDefineType(ProjectClassLoader.java:205) ~[drools-core-reflective-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at org.drools.reflective.classloader.ProjectClassLoader.loadType(ProjectClassLoader.java:195) ~[drools-core-reflective-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at org.drools.reflective.classloader.ProjectClassLoader.loadClass(ProjectClassLoader.java:149) ~[drools-core-reflective-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[na:na]
          at org.drools.modelcompiler.CanonicalKieModule.createInstance(CanonicalKieModule.java:167) ~[drools-model-compiler-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at org.drools.modelcompiler.CanonicalKieModule.initModelsFromProjectDescriptor(CanonicalKieModule.java:434) ~[drools-model-compiler-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          at org.drools.modelcompiler.CanonicalKieModule.getModels(CanonicalKieModule.java:424) ~[drools-model-compiler-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
          ... 45 common frames omitted

      The problem is that KieInJarModuleMetaDataImpl#InJarClassLoader.loadClassData() expects only "jar:file:" protocol, so it cannot find a class the url is "file:" protocol.

       

      Acceptance Criteria:

      Class can be found in case of mvn spring-boot:run

              rhn-support-tkobayas Toshiya Kobayashi
              rhn-support-smuhamma Syed Shayane Muhammad
              Marian Macik Marian Macik
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: