Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The package cannot be imported at runtime under certain situation. #16

Open
SungMinHong opened this issue Aug 24, 2022 · 2 comments
Open

Comments

@SungMinHong
Copy link

SungMinHong commented Aug 24, 2022

First and foremost, I would like to extend my gratitude for creating such a fantastic open-source project. 👏

I have a question. Please help me. 😿

I'm experiencing difficulties with the following condition:

condition

  • My Custom Module
    • Use eobermuhlner/java-scriptengine
    • Has MyUtill.class
  • Service Server
    • Using the module(My Custom Module) specified above
  • Sample code is written in java
    • ch.obermuhlner.scriptengine.java.JavaScriptEngine compiles this code
import com.utils.MyUtill;
public class Script {
    ...
}
  • In Service Server
    • 'Sample code' worked successfully when I ran it in IntelliJ without deploying it as a jar.
    • When deployed as a jar, the 'Service Server' can't find the package(com.utils.MyUtill) despite 'My Custom Module' being there. I got the following error:
Caused by: javax.script.ScriptException: /Script.java:1: error: package com.utils does not exist
import com.utils.MyUtill;

Is there any way to read the package?? 😢

@zwzhangyu
Copy link

Hello, I also encountered the same problem. The jar cannot import classes when it is running, except for jdk packages. Is there a solution now?

@Chris-SP365
Copy link

Happens for me also in development in a web-app started with 'jetty-maven-plugin'.
No problems in unittests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants