我在tomcat上有一个web应用程序,当我尝试在netbeans中部署它时,会发生此错误。
java.lang.IllegalAccessError: class org.netbeans.modules.tomcat5.deploy.TomcatManagerImpl (in unnamed module @0x3196dd3d) cannot access class com.sun.org.apache.xerces.internal.impl.dv.util.Base64 (in module java.xml) because module java.xml does not export com.sun.org.apache.xerces.internal.impl.dv.util to unnamed module @0x3196dd3d
堆栈跟踪
java.lang.IllegalAccessError: class org.netbeans.modules.tomcat5.deploy.TomcatManagerImpl (in unnamed module @0x3196dd3d) cannot access class com.sun.org.apache.xerces.internal.impl.dv.util.Base64 (in module java.xml) because module java.xml does not export com.sun.org.apache.xerces.internal.impl.dv.util to unnamed module @0x3196dd3d
at org.netbeans.modules.tomcat5.deploy.TomcatManagerImpl.run(TomcatManagerImpl.java:533)
at org.netbeans.modules.tomcat5.deploy.TomcatManagerImpl.list(TomcatManagerImpl.java:372)
at org.netbeans.modules.tomcat5.deploy.TomcatManager.modules(TomcatManager.java:718)
at org.netbeans.modules.tomcat5.deploy.TomcatManager.getAvailableModules(TomcatManager.java:529)
at org.netbeans.modules.tomcat5.optional.TMIDResolver.lookupTargetModuleID(TMIDResolver.java:56)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.checkUndeployForSharedReferences(TargetServer.java:349)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.checkUndeployForSharedReferences(TargetServer.java:322)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.checkUndeployForSharedReferences(TargetServer.java:319)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.processLastTargetModules(TargetServer.java:440)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.init(TargetServer.java:170)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.deploy(TargetServer.java:605)
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:221)
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:141)
at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:86)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at jdk.internal.reflect.GeneratedMethodAccessor46.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1388)
at org.apache.tools.ant.Project.executeTarget(Project.java:1361)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:261)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:574)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:128)
BUILD FAILED (total time: 1 second)
我该如何解决这个问题?我回答了这些问题,但对我来说,基于javaxBased的部署问题不起作用。
openjdK版本
openjdk 16 2021-03-16
OpenJDK Runtime Environment 21.3 (build 16+36)
OpenJDK 64-Bit Server VM 21.3 (build 16+36, mixed mode, sharing)
Net beans版本
Apache Netbeans IDE 12.0
这是一个错误,将在netbeans 12.4中修复https://issues.apache.org/jira/browse/NETBEANS-5602?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-选项卡
Apache Netbeans 12.0需要jdk 14或更低才能正常工作,因此我建议安装Amazon Corretto 11或任何jdk 11发行版并重新安装Apache Netbeans。