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

JDK11环境下,base可以获取Nashorn脚本对象,在biz获取不到 #1064

Open
langke93 opened this issue Feb 8, 2025 · 1 comment
Labels

Comments

@langke93
Copy link

langke93 commented Feb 8, 2025

Feature description

使用以下代码分别运行在base和biz

        // 创建 ScriptEngineManager
        ScriptEngineManager manager = new ScriptEngineManager();
        // 列出所有可用的 ScriptEngineFactory
        List<ScriptEngineFactory> factories = manager.getEngineFactories();
        for (ScriptEngineFactory factory : factories) {
            logger.info("Engine: " + factory.getEngineName());
            logger.info("Language: " + factory.getLanguageName());
            logger.info("Mime Types: " + factory.getMimeTypes());
            logger.info("------");
        }
        // 获取 JavaScript 引擎
        ScriptEngine engine = manager.getEngineByName("JavaScript");

        if (engine == null) {
            logger.info("JavaScript 引擎不可用!");
        }else{
            logger.info("engineName: " + engine.getFactory().getEngineName());
        }

在base下执行,可以获取到,在biz下就获取不到
通过调试发现在BizClassLoader的jdkClassLoader.parent.classLoaderValueMap 有加载nashorn模块,但是代码获取不到该对象
Image

Copy link

This issue has been automatically marked as stale because it has not had recent activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue or help wanted) or other activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant