NoClassDEfFoundError while Using AXis with Lotus n

2019-09-13 11:38发布

问题:

I am trying to use APACHE-AXIS framework in Lotus notes 6.5.

I did:

  1. Created java library in Script library
  2. created the Java files from WSDL and added to the library
  3. added xml-apis.jar to the library.

Now i created an agent an added the created library to it. See Agent code below:

import lotus.domino.*;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.axis.client.*;
public class JavaAgent extends AgentBase {

    public void NotesMain() {

        try {
            Session session = getSession();
            AgentContext agentContext = session.getAgentContext();

            URL url = new URL("http://foo.com");
            QName qName = new QName("xxxx", "getFooDataUser");
            TestWebServiceLocator loc = new TestWebServiceLocator();

            System.out.println("Before STUB Calling");

                        // (Your code goes here) 

        } catch(Exception e) {
            e.printStackTrace();
        }
    }
}

Now in the agent whenever the code encounters any initialization code (Constructor calls), it is NoClassDefFoundError

See Stack trace below:

java.lang.NoClassDefFoundError: javax/xml/parsers/ParserConfigurationException

    at org.apache.axis.configuration.FileProvider.configureEngine(FileProvider.java:179)

    at org.apache.axis.AxisEngine.init(AxisEngine.java:172)

    at org.apache.axis.AxisEngine.<init>(AxisEngine.java:156)

    at org.apache.axis.client.AxisClient.<init>(AxisClient.java:52)

    at org.apache.axis.client.Service.getAxisClient(Service.java:103)

    at org.apache.axis.client.Service.<init>(Service.java:112)

    at JavaAgent.NotesMain(JavaAgent.java:18)

    at lotus.domino.AgentBase.runNotes(Unknown Source)

    at lotus.domino.NotesThread.run(NotesThread.java:218)

回答1:

Add xalan-2.0.1.jar to the library.

You can find the details in http://www.java2s.com/Code/Jar/x/Downloadxalan201jar.htm