You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by stlecho <st...@gmail.com> on 2011/07/14 16:14:40 UTC

NullPointerException when using LoggingInInterceptor

I have developed a webservice client with CXF v2.4.0 and I am able to execute
the client without any issue. 
When activating the LoggingInInterceptor, I'm receiving a
NullPointerException.
Could anyone please help me with this issue ?

*Config (copied from  http://cxf.apache.org/docs/debugging-and-logging.html
http://cxf.apache.org/docs/debugging-and-logging.html )*
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
   	<bean id="logInbound"
class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
    <bean id="logOutbound"
class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
    <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
        <property name="inInterceptors">
            <list>
                <ref bean="logInbound"/>
            </list>
        </property>
        <property name="outInterceptors">
            <list>
                <ref bean="logOutbound"/>
            </list>
        </property>
        <property name="outFaultInterceptors">
            <list>
                <ref bean="logOutbound"/>
            </list>
        </property>
        <property name="inFaultInterceptors">
            <list>
                <ref bean="logInbound"/>
            </list>
        </property>
    </bean>
</beans>

*Trace*
java.lang.NullPointerException
	at
org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:91)
	at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:203)
	at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:147)
	at
org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:90)
	at javax.xml.ws.Service.<init>(Service.java:56)
	at
be.belgium.fsb.wsconsultkbo.v1.WSConsultKBOService.<init>(WSConsultKBOService.java:54)
	at
be.fgov.minfin.stiron2.btwentiteit.consult.client.KBOConsultWebServiceTest.initWS(KBOConsultWebServiceTest.java:39)
	at
be.fgov.minfin.stiron2.btwentiteit.consult.client.KBOConsultWebServiceTest.init(KBOConsultWebServiceTest.java:33)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
	at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
	at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
	at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
	at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)

--
View this message in context: http://cxf.547215.n5.nabble.com/NullPointerException-when-using-LoggingInInterceptor-tp4586784p4586784.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: NullPointerException when using LoggingInInterceptor

Posted by Daniel Kulp <dk...@apache.org>.
On Friday, July 15, 2011 12:29:52 AM stlecho wrote:
> This solves indeed the issue. Does this mean that the
> http://cxf.apache.org/docs/debugging-and-logging.html
> http://cxf.apache.org/docs/debugging-and-logging.htm l page is obsolete and
> should be replaced by  http://cxf.apache.org/docs/configuration.html
> http://cxf.apache.org/docs/configuration.html  ? 

Yes.  Out of date.   Just fixed it.  Thanks.   Should sync to the live site 
soon.

Dan


> 
> PS: The shortest way to configure logging is the following one (as explained
> on  http://cxf.apache.org/docs/configuration.html
> http://cxf.apache.org/docs/configuration.html ):
> <beans xmlns="http://www.springframework.org/schema/beans"
>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>       xmlns:cxf="http://cxf.apache.org/core"
>       xsi:schemaLocation="
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
> 
>     <cxf:bus>
>         <cxf:features>
>             <cxf:logging/>
>         </cxf:features>
>     </cxf:bus>
> </beans>
> 
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/NullPointerException-when-using-LoggingInIn
> terceptor-tp4586784p4589713.html Sent from the cxf-user mailing list archive
> at Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com

Re: NullPointerException when using LoggingInInterceptor

Posted by Freeman Fang <fr...@gmail.com>.
Hi,
On 2011-7-15, at 下午3:29, stlecho wrote:

> This solves indeed the issue. Does this mean that the
> http://cxf.apache.org/docs/debugging-and-logging.html
> http://cxf.apache.org/docs/debugging-and-logging.htm l page is  
> obsolete and
> should be replaced by  http://cxf.apache.org/docs/configuration.html
> http://cxf.apache.org/docs/configuration.html  ?

No, that page is still valid, you can add logging with code or  
configuration, it just used for different scenario.

Freeman
>
> PS: The shortest way to configure logging is the following one (as  
> explained
> on  http://cxf.apache.org/docs/configuration.html
> http://cxf.apache.org/docs/configuration.html ):
> <beans xmlns="http://www.springframework.org/schema/beans"
>      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>      xmlns:cxf="http://cxf.apache.org/core"
>      xsi:schemaLocation="
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
>
>    <cxf:bus>
>        <cxf:features>
>            <cxf:logging/>
>        </cxf:features>
>    </cxf:bus>
> </beans>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/NullPointerException-when-using-LoggingInInterceptor-tp4586784p4589713.html
> Sent from the cxf-user mailing list archive at Nabble.com.

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com










Re: NullPointerException when using LoggingInInterceptor

Posted by stlecho <st...@gmail.com>.
This solves indeed the issue. Does this mean that the 
http://cxf.apache.org/docs/debugging-and-logging.html
http://cxf.apache.org/docs/debugging-and-logging.htm l page is obsolete and
should be replaced by  http://cxf.apache.org/docs/configuration.html
http://cxf.apache.org/docs/configuration.html  ?

PS: The shortest way to configure logging is the following one (as explained
on  http://cxf.apache.org/docs/configuration.html
http://cxf.apache.org/docs/configuration.html ):
<beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:cxf="http://cxf.apache.org/core"
      xsi:schemaLocation="
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

    <cxf:bus>
        <cxf:features>
            <cxf:logging/>
        </cxf:features>
    </cxf:bus> 
</beans>


--
View this message in context: http://cxf.547215.n5.nabble.com/NullPointerException-when-using-LoggingInInterceptor-tp4586784p4589713.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: NullPointerException when using LoggingInInterceptor

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

This is caused by the way how you configure cxf bus, cxf bus refactor  
a lot since cxf 2.4.0, you shouldn't use
<bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl"> anymore now,

should use something like
<cxf:bus>
         <cxf:inInterceptors>
                 ...
         </cxf:inInterceptors>

         <cxf:outInterceptors>
               ...
         </cxf:outInterceptors>

</cxf:bus>

Freeman
On 2011-7-14, at 下午10:14, stlecho wrote:

> I have developed a webservice client with CXF v2.4.0 and I am able  
> to execute
> the client without any issue.
> When activating the LoggingInInterceptor, I'm receiving a
> NullPointerException.
> Could anyone please help me with this issue ?
>
> *Config (copied from  http://cxf.apache.org/docs/debugging-and-logging.html
> http://cxf.apache.org/docs/debugging-and-logging.html )*
> <beans xmlns="http://www.springframework.org/schema/beans"
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
>   	<bean id="logInbound"
> class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>    <bean id="logOutbound"
> class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>    <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
>        <property name="inInterceptors">
>            <list>
>                <ref bean="logInbound"/>
>            </list>
>        </property>
>        <property name="outInterceptors">
>            <list>
>                <ref bean="logOutbound"/>
>            </list>
>        </property>
>        <property name="outFaultInterceptors">
>            <list>
>                <ref bean="logOutbound"/>
>            </list>
>        </property>
>        <property name="inFaultInterceptors">
>            <list>
>                <ref bean="logInbound"/>
>            </list>
>        </property>
>    </bean>
> </beans>
>
> *Trace*
> java.lang.NullPointerException
> 	at
> org 
> .apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java: 
> 91)
> 	at  
> org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:203)
> 	at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:147)
> 	at
> org 
> .apache 
> .cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java: 
> 90)
> 	at javax.xml.ws.Service.<init>(Service.java:56)
> 	at
> be 
> .belgium 
> .fsb 
> .wsconsultkbo.v1.WSConsultKBOService.<init>(WSConsultKBOService.java: 
> 54)
> 	at
> be 
> .fgov 
> .minfin 
> .stiron2 
> .btwentiteit 
> .consult 
> .client 
> .KBOConsultWebServiceTest.initWS(KBOConsultWebServiceTest.java:39)
> 	at
> be 
> .fgov 
> .minfin 
> .stiron2 
> .btwentiteit 
> .consult 
> .client.KBOConsultWebServiceTest.init(KBOConsultWebServiceTest.java: 
> 33)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
> sun 
> .reflect 
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at
> sun 
> .reflect 
> .DelegatingMethodAccessorImpl 
> .invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at
> org.junit.runners.model.FrameworkMethod 
> $1.runReflectiveCall(FrameworkMethod.java:44)
> 	at
> org 
> .junit 
> .internal 
> .runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> 	at
> org 
> .junit 
> .runners 
> .model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
> 	at
> org 
> .junit 
> .internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
> 	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> 	at
> org 
> .apache 
> .maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
> 	at
> org 
> .apache 
> .maven 
> .surefire 
> .suite 
> .AbstractDirectoryTestSuite 
> .executeTestSet(AbstractDirectoryTestSuite.java:140)
> 	at
> org 
> .apache 
> .maven 
> .surefire 
> .suite 
> .AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java: 
> 127)
> 	at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
> sun 
> .reflect 
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at
> sun 
> .reflect 
> .DelegatingMethodAccessorImpl 
> .invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at
> org 
> .apache 
> .maven 
> .surefire 
> .booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
> 	at
> org 
> .apache 
> .maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/NullPointerException-when-using-LoggingInInterceptor-tp4586784p4586784.html
> Sent from the cxf-user mailing list archive at Nabble.com.

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com