domino的java開發,找不到方法故障處理過程

jarge發表於2010-04-18
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;

然後再執行剛才測試程式

 4、執行結果:
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

5、把/opt/lotus/notes/65060/sunspa/jvm/lib/ext/axis.jar 這個jar包換掉就解決了

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10247040/viewspace-660055/,如需轉載,請註明出處,否則將追究法律責任。

相關文章