domino的java开发,找不到方法故障处理过程
故障现象:
2010-04-18 14:09:20
HTTP JVM: java.lang.NoSuchMethodError
2010-04-18 14:09:20 HTTP JVM: at org.apache.axis.deployment.wsdd.WSDDDocument.setDocument(WSDDDocument.java:136)
2010-04-18 14:09:20 HTTP JVM: at org.apache.axis.deployment.wsdd.WSDDDocument.(WSDDDocument.java:65)
2010-04-18 14:09:20 HTTP JVM: at org.apache.axis.configuration.FileProvider.configureEngine(FileProvider.java:179)
2010-04-18 14:09:20 HTTP JVM: at org.apache.axis.AxisEngine.init(AxisEngine.java:172)
2010-04-18 14:09:20 HTTP JVM: at org.apache.axis.AxisEngine.(AxisEngine.java:156)
2010-04-18 14:09:20 HTTP JVM: at org.apache.axis.client.AxisClient.(AxisClient.java:52)
2010-04-18 14:09:20 HTTP JVM: at org.apache.axis.client.Service.getAxisClient(Service.java:104)
2010-04-18 14:09:20 HTTP JVM: at org.apache.axis.client.Service.(Service.java:113)
2010-04-18 14:09:20 HTTP JVM: at IASServiceLocator.(IASServiceLocator.java:11)
2010-04-18 14:09:20 HTTP JVM: at SyncUserInfoFromUUV.NotesMain(SyncUserInfoFromUUV.java:49)
2010-04-18 14:09:20 HTTP JVM: at lotus.domino.AgentBase.runNotes(Unknown Source)
2010-04-18 14:09:20 HTTP JVM: at lotus.domino.NotesThread.run(NotesThread.java:249)
===============================================
分析:
1、 类是找到了,但找不到相关方法。应该是找错了同名类。现在关键是要定位出 “org.apache.axis.deployment.wsdd.WSDDDocument” 类在哪个 jar 包。
用以面的测试代码来调试:
import lotus.domino.*;
import java.io.*;
import java.util.*;
import java.lang.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
Class test = Class.forName("org.apache.axis.deployment.wsdd.WSDDDocument");
System.out.println(test.getClassLoader().getResource(""));
System.out.println(ClassLoader.getSystemResource(""));
System.out.println(test.getResource(""));
System.out.println(test.getResource("/"));
System.out.println(new File("").getAbsolutePath());
System.out.println(System.getProperty("user.dir"));
} catch(Exception e) {
e.printStackTrace();
}
}
}
2、运行第一步写的那个类后,报下面的权限错误:
2010-04-18 16:35:17 HTTP JVM: java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)
2010-04-18 16:35:17 HTTP JVM: at java.security.AccessControlContext.checkPermission(AccessControlContext.java:272)
2010-04-18 16:35:17 HTTP JVM: at java.security.AccessController.checkPermission(AccessController.java:399)
2010-04-18 16:35:17 HTTP JVM: at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
2010-04-18 16:35:17 HTTP JVM: at java.lang.Class.getClassLoader(Class.java:433)
2010-04-18 16:35:17 HTTP JVM: at JavaAgent.NotesMain(JavaAgent.java:16)
2010-04-18 16:35:17 HTTP JVM: at lotus.domino.AgentBase.runNotes(Unknown Source)
2010-04-18 16:35:17 HTTP JVM: at lotus.domino.NotesThread.run(NotesThread.java:249)
说明没有执行权限。
3、由于没有权限,所以执行上面的 jar 包定位代码时报错,需要在 " domino\jvm\lib\security\java.policy" 文件中加入:
//开放所有权限
permission java.security.AllPermission;
然后再执行刚才测试程序
HTTP JVM: file:/maildata/
HTTP JVM: file:/maildata/
HTTP JVM: jar:file:/opt/lotus/notes/65060/sunspa/jvm/lib/ext/axis.jar!/org/apache/axis/deployment/wsdd/
HTTP JVM: file:/maildata/
HTTP JVM: /maildata
HTTP JVM: /maildata
HTTP JVM: file:/maildata/
HTTP JVM: jar:file:/opt/lotus/notes/65060/sunspa/jvm/lib/ext/axis.jar!/org/apache/axis/deployment/wsdd/
HTTP JVM: file:/maildata/
HTTP JVM: /maildata
HTTP JVM: /maildata
5、把 /opt/lotus/notes/65060/sunspa/jvm/lib/ext/axis.jar 这个jar包换掉就解决了
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10247040/viewspace-660055/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10247040/viewspace-660055/