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

HttpServletRequest是如何不被SandboxClassLoader加载的 #193

Open
yihengwang4 opened this issue Feb 3, 2023 · 2 comments
Open

HttpServletRequest是如何不被SandboxClassLoader加载的 #193

yihengwang4 opened this issue Feb 3, 2023 · 2 comments

Comments

@yihengwang4
Copy link

sandbox中javax.servlet下的类都由SandboxClassLoader加载。在我自己的demo项目中,以增强HttpServlet中service为例,如果直接将入参对象转化为HttpServletRequest会出现由于classLoader不一样而引发的java.lang.ClassCastException。想请教一下sandbox-repeater中是怎么做到可以直接进行类型转化的呀
private ModuleJarClassLoader(final File moduleJarFile, final File tempModuleJarFile, final Routing... specialRouting) throws IOException { super( new URL[]{new URL("file:" + tempModuleJarFile.getPath())}, assembleRouting(new Routing( ModuleJarClassLoader.class.getClassLoader(), "^com\\.alibaba\\.jvm\\.sandbox\\.api\\..*$", "^javax\\.servlet\\..*$", "^javax\\.annotation\\.Resource.*$" ), specialRouting) ); // ... }

@reducm
Copy link

reducm commented Oct 10, 2023

相同疑问 +1

@haimachl
Copy link

+1 也遇到相同问题

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