微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Weblogic 错误 - 无法初始化类 weblogic.jndi.Environment 要解决此问题,只需使用 WL 运行您的项目,这似乎只是 NetBeans 8.2 处的错误

如何解决Weblogic 错误 - 无法初始化类 weblogic.jndi.Environment 要解决此问题,只需使用 WL 运行您的项目,这似乎只是 NetBeans 8.2 处的错误

当我尝试调试配置为使用 WebApp 中的 Oracle Weblogic Server 运行的 NetBeans 10 时,我总是收到以下错误

甚至没有复杂的步骤,我只是打开我的项目然后right-click / Debug

java.lang.NoClassDefFoundError: Could not initialize class weblogic.jndi.Environment
    at weblogic.jndi.WLInitialContextFactory.getinitialContext(WLInitialContextFactory.java:117)
    at java.naming/javax.naming.spi.NamingManager.getinitialContext(NamingManager.java:730)
    at java.naming/javax.naming.InitialContext.getDefaultinitCtx(InitialContext.java:305)
    at java.naming/javax.naming.InitialContext.init(InitialContext.java:236)
    at java.naming/javax.naming.InitialContext.<init>(InitialContext.java:208)
    at weblogic.management.remote.common.ClientProviderBase.makeConnection(ClientProviderBase.java:178)
    at weblogic.management.remote.common.ClientProviderBase.newJMXConnector(ClientProviderBase.java:84)
    at java.management/javax.management.remote.JMXConnectorFactory.newJMXConnector(JMXConnectorFactory.java:378)
    at org.netbeans.modules.j2ee.weblogic9.WLConnectionSupport$1.call(WLConnectionSupport.java:182)
    at org.netbeans.modules.j2ee.weblogic9.WLConnectionSupport.executeAction(WLConnectionSupport.java:112)
    at org.netbeans.modules.j2ee.weblogic9.WLConnectionSupport.executeAction(WLConnectionSupport.java:161)
    at org.netbeans.modules.j2ee.weblogic9.deploy.WLDeploymentManager.getTargets(WLDeploymentManager.java:632)
    at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.getTargetMap(ServerInstance.java:560)
    at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.getTargets(ServerInstance.java:518)
    at org.netbeans.modules.j2ee.deployment.impl.ServerString.getTargets(ServerString.java:117)
    at org.netbeans.modules.j2ee.deployment.impl.ServerString.toTargets(ServerString.java:155)
    at org.netbeans.modules.j2ee.deployment.impl.TargetServer.init(TargetServer.java:146)
    at org.netbeans.modules.j2ee.deployment.impl.TargetServer.undeploy(TargetServer.java:771)
    at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.undeploy(Deployment.java:337)
    at org.netbeans.modules.j2ee.ant.Undeploy.execute(Undeploy.java:92)
    at org.apache.tools.ant.UnkNownElement.execute(UnkNownElement.java:292)
    at jdk.internal.reflect.GeneratedMethodAccessor99.invoke(UnkNown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    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: 0 seconds)

我的环境是:

  • 在 Java 10.0.2+13 上运行的 NetBeans 10
  • Windows 10
  • 在 Java 1.6.0.45 上运行的 Weblogic Server 10.3.6

如何解决

解决方法

我决定发布这个问题,因为我花了一上午才找到解决方案...特别是因为 java.lang.NoClassDefFoundError: Could not initialize class weblogic.jndi.Environment 发生的最常见原因是 weblogic.jar 和 {{ 1}} 没有被 wlfullclient.jarIDEWebApp 中的任何一个正确定位。

要解决此问题,只需使用 WL 运行您的项目,这似乎只是 NetBeans 8.2 处的错误。

另外,甚至不要尝试在 NB10NB11NB12NB12.1 上运行它。目前,Java EE plugin for those versions is discontinued 因此您甚至无法将 WL 添加到您的服务器列表中。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?