Scripting Interface behaves different for UberJar - Class and Package not found

Hi team,

Need your kind advise.

My application loads Java source file by Scripting interface.
It’s working well if app launched by Idea, but throws exception if run by UberJar, saying cannot find package and class and symbols etc.

Something wrong with classloader? Or I missed to configure something?

test0804.zip (425.8 KB)

Here’s a project could reproduce the issue.
Steps:

  1. Modify cuba.confDir setting in both app.properties and build.gradle, to “/conf”
    Another question: why cuba.confDir in app.properties doesn’t work for UberJar?

  2. Launch the application by Idea, no issue.

  3. Build UberJar, and run by command line, then error happens
    java -Dapp.home=./app-home -jar ./app.jar

thank you

To rectify:
step 1. modify cuba.confDir to “[project-path]/conf”

Running by UberJar, below configuration seems wrong for Jetty.
I tried to modify cubaClasspathDirectories, but still got compilation exception.

cubaClasspathDirectories: ${catalina.base}/lib;${catalina.base}/shared/classes;${catalina.base}/shared/lib;${catalina.base}/webapps/app-core/WEB-INF/classes;${catalina.b
ase}/webapps/app-core/WEB-INF/lib

catalinaBase: null

Hi, @xingjl6280!

Unfortunately, hot deploy of classes does not work for UberJar because of the class loading mechanism in that case. I’ve created an issue to investigate that problem. Property cuba.confDir from app.properties does not work for UberJar because application properties for UberJar should be defined separately by appProperties task parameter.

Regards,
Sergey

Noted.
And I have tried to use tomcat fast deployment and change DockerFile slightly to copy artifacts and startup tomcat. So far it’s working well.