问题描述
参考Example: Using a Java Program to Display the Status of Oracle Business Intelligence按照步骤运行命令时,出现异常。
问题出现的环境背景及自己尝试过哪些方法
已经检查过Url构造是没有问题,服务器也是正常可访问的。参考过NoInitialContextException error,但是还是不知如何解决。
相关代码
[oracle@biapptst jmx]$ java -classpath .:./wlclient.jar MBeanAPIExample1 localhost 9500 weblogic password
Connecting using URL: service:jmx:iiop://localhost:9500/jndi/weblogic.management.mbeanservers.domainruntime ...
Exception in thread "main" java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:369)
at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:270)
at MBeanAPIExample1.connect(MBeanAPIExample1.java:50)
at MBeanAPIExample1.main(MBeanAPIExample1.java:85)
Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:350)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1955)
at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1922)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:287)
... 3 more
你期待的结果是什么?实际看到的错误信息又是什么?
期待跑通。
添加回答
举报
0/150
提交
取消