gpt4 book ai didi

java - 线程 "main"java.lang.SecurityException : Prohibited package name: java. sql 中的异常

转载 作者:行者123 更新时间:2023-11-30 10:18:53 29 4
gpt4 key购买 nike

我有一个用 jdk 1.6 生成的 jar,它在 jdk 1.7 和 1.7 上运行良好,但在尝试用 1.9 运行它时出现以下异常:

Exception in thread "main" java.lang.SecurityException: Prohibited package name: java.sql
at java.base/java.lang.ClassLoader.preDefineClass(Unknown Source)
at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
at java.base/java.security.SecureClassLoader.defineClass(Unknown Source)
at java.base/java.net.URLClassLoader.defineClass(Unknown Source)
at java.base/java.net.URLClassLoader.access$100(Unknown Source)
at java.base/java.net.URLClassLoader$1.run(Unknown Source)
at java.base/java.net.URLClassLoader$1.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.net.URLClassLoader.findClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.base/java.lang.Class.getMethodsRecursive(Unknown Source)
at java.base/java.lang.Class.getMethod0(Unknown Source)
at java.base/java.lang.Class.getMethod(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:57)

我的主课:

package eai_principale;

import com.siebel.data.SiebelException;
import java.io.IOException;
import java.sql.SQLException;
import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.SAXException;

public class MainExecute
{
public static void main(String[] args)
throws SQLException, SiebelException, ParserConfigurationException, SAXException, IOException
{
System.out.println("-----------------START EAI CONNECTOR EXECUTION------------------");
Principale execute = new Principale();

String ligneId = args[0];
String path = args[1];

execute.execute(ligneId, path);

System.out.println("-----------------END EAI CONNECTOR EXECUTION------------------");
}
}

你能帮帮我吗?我正在使用 Eclipse,我正在使用 jdbc lib 。谢谢

最佳答案

看起来像是 Eclipse JDT 中的错误,特别是在 jarinjarloader 部分。它被引用为 Bug 525885 - jarinjarloader with jdbc jar does not work in jre9在 Eclipse Bugzilla 中。

bugzilla 文章建议使用标准 MANIFEST 可能是一种解决方法:

The thing is that my jar will execute in jre9 if I manually remove the jarinjarloader portion and use a standard MANIFEST file.

关于java - 线程 "main"java.lang.SecurityException : Prohibited package name: java. sql 中的异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49013013/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com