本文介绍了使用axis api的Lotus Notes 6.5中的JavaAgent给出了Exception“没有为org.apache.commons.logging.LogFactory定义的实现”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在Lotus Notes 6.5 DB中编写JavaAgent来访问Web服务。我为此目的使用了Axis Apache API。我创建了一个Java代理,并使用编辑项目按钮在代理中添加了轴的jar文件。

I needed to write a JavaAgent in a Lotus Notes 6.5 DB to access a web service. I used Axis Apache API for this purpose. I created A Java agent and added the jar files of axis in the agent by using Edit Project button.

以下是代理代码:

import lotus.domino.*;
import javax.xml.*;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
import java.net.URL;

public class JavaAgent extends AgentBase {

    public void NotesMain() {

        try {


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

            String  endpoint = "http://ws.apache.org:5049/axis/services/echo";
            Service service = new Service();
            Call     call    = (Call) service.createCall();
            call.setTargetEndpointAddress(new java.net.URL(endpoint) );

            call.setOperationName(new QName("http://soapinterop.org/", "echoString"));
            String ret = (String) call.invoke( new Object[] { "Hello!" } );
            System.out.println("Sent 'Hello!', got '" + ret + "'");

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

以下是抛出的异常:

java.lang.ExceptionInInitializerError: org.apache.commons.discovery.DiscoveryException: No implementation defined for org.apache.commons.logging.LogFactory

    at org.apache.commons.discovery.tools.SPInterface.newInstance(SPInterface.java:197)

    at org.apache.commons.discovery.tools.DiscoverClass.newInstance(DiscoverClass.java:579)

    at org.apache.commons.discovery.tools.DiscoverSingleton.find(DiscoverSingleton.java:418)

    at org.apache.commons.discovery.tools.DiscoverSingleton.find(DiscoverSingleton.java:378)

    at org.apache.axis.components.logger.LogFactory$1.run(LogFactory.java:84)

    at java.security.AccessController.doPrivileged(Native Method)

    at org.apache.axis.components.logger.LogFactory.getLogFactory(LogFactory.java:80)

    at org.apache.axis.components.logger.LogFactory.<clinit>(LogFactory.java:72)

    at org.apache.axis.configuration.EngineConfigurationFactoryFinder.<clinit>(EngineConfigurationFactoryFinder.java:94)

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

    at JavaAgent.NotesMain(JavaAgent.java:17)

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

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

我很想跟随互联网上的一些链接,但我无法得到它要求的确切内容。例如:

I thried to follow some links on the internet like, But i was not able to get exactly what it was asking to do. eg: http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/40d033fba3897f4d85256cd30034026a?OpenDocument

任何帮助将是巨大的。我想做的就是写一个代理,这样我就可以访问一个网络服务,比如w3schools上的温度转换网络服务。

Any help will be great. All i wanted to do is write an agent so that i can access a web service, say temperature conversion web service on w3schools. http://www.w3schools.com/webservices/tempconvert.asmx?op=FahrenheitToCelsius

推荐答案

我用Google搜索了您的错误消息,这是第一次点击:

I googled with your error message and this is the first hit:

建议使用 commons-logging.properties 文件:

org.apache.commons.logging.Log = org.apache.commons.logging.impl.Log4JLogger  
org.apache.commons.logging.LogFactory = org.apache.commons.logging.impl.LogFactoryImpl

或将其放入您的代码:

@BeforeClass  
public static void beforeClass() {  
 System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Log4JLogger");  
 System.setProperty("org.apache.commons.logging.LogFactory", "org.apache.commons.logging.impl.LogFactoryImpl");  
}

可能你已经尝试过这个,因为它是谷歌的第一个热门但只是如果......

Probably you've already tried this because it's the first hit with google but just in case...

这篇关于使用axis api的Lotus Notes 6.5中的JavaAgent给出了Exception“没有为org.apache.commons.logging.LogFactory定义的实现”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 22:13