I am following description "Enabling message logging using the Logging
feature" at 
http://cwiki.apache.org/CXF20DOC/configuration.html
http://cwiki.apache.org/CXF20DOC/configuration.html . I'd like to be able to
see the raw SOAP messages that my CXF-based client sends to the server and
responses that come from the server.

I want to use log4j, and have found from 
http://www.techper.net/2008/01/30/configuring-cxf-logging-to-go-through-log4j/
http://www.techper.net/2008/01/30/configuring-cxf-logging-to-go-through-log4j/ 
how to do it. In my src directory I've created
META-INF/cxf/org.apache.cxf.Logger file that contains a single line:
org.apache.cxf.common.logging.Log4jLogger

To run the client, which happens to be a webapp, I don't need
cxf-2.0.4-incubator.jar, and everything just
works (except I don't see the raw SOAP messages). In order to be able to use
the class org.apache.cxf.common.logging.Log4jLogger, I have to add the 
cxf-2.0.4-incubator.jar to the WEB-INF/lib directory. Now I am getting a
NullPointerException in spring class
org.apache.cxf.bus.spring.BusApplicationContext, line 78:

        public void setConfigLocations(String[] locations) {
                Assert.noNullElements(locations, "Config locations must not be 
null");
                this.configLocations = new String[locations.length];         // 
<== NPE,
due to locations == null
                for (int i = 0; i < locations.length; i++) {
                        this.configLocations[i] = resolvePath(locations[i]);
                }
        }

which is caused because null is being passed from BusApplicationContext's
base class constructor in class 
org.apache.cxf.bus.spring.BusApplicationContext:

        public BusApplicationContext(String cf, boolean include, 
ApplicationContext
parent) {
        super((String[])null, false, parent);   // <== this null causes the
above NPE
        cfgFile = cf;
        includeDefaults = include;
        refresh();
    }

Before the NPE is thrown, I see that LogUtils correctly initializes
org.apache.cxf.common.logging.Log4jLogger for logging:
LogUtils.java (   72) : Using org.apache.cxf.common.logging.Log4jLogger for
logging.

My environment consists of:
CXF 2.0.4
Spring 2.5.2
Struts2 2.0.11
tomcat 6.0.16

So what am I doing wrong? Is this a spring question?

-- 
View this message in context: 
http://www.nabble.com/CXF-client-side-logging-setup-with-spring-throws-NPE-tp16345372p16345372.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to