You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Dmitriy Fedoriv (JIRA)" <ji...@apache.org> on 2015/05/18 19:59:00 UTC
[jira] [Updated] (CXF-6408) HTTP Conduit throws NPE exception for
"invalid" 401 HTTP response
[ https://issues.apache.org/jira/browse/CXF-6408?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dmitriy Fedoriv updated CXF-6408:
---------------------------------
Description:
Hi guys,
In process of using RESTful client based on Apache CXF JAX-RS with activated auto-redirect option, I observed NPE on my logs. The short investigation shows that the problem was caused by Web Service side, that send "401 Unauthorized" HTTP response without "WWW-Authenticate" header.
In this case, on HTTPConduit class when we try to handle retransmits (by auto-redirect option), we expect that response message MUST contains authentication params, but header map doesn't contain it. As a result we observe the following exception:
2015-05-18 21:43:12,730 [WARN|org.apache.cxf.phase.PhaseInterceptorChain|LogUtils] Interceptor for {<TEST_SERVER>}WebClient has thrown exception, unwinding now
java.lang.NullPointerException: NullPointerException invoking <TEST_SERVER>: null
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1359)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1348)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:638)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
at org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:619)
at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1084)
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:883)
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:854)
at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:320)
at org.apache.cxf.jaxrs.client.WebClient.get(WebClient.java:346)
at com.edifecs.etools.xeserver.restful.client.transport.impl.Test.main(Test.java:40)
Caused by: java.lang.NullPointerException
at org.apache.cxf.transport.http.auth.HttpAuthHeader.<init>(HttpAuthHeader.java:52)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.authorizationRetransmit(HTTPConduit.java:1480)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.processRetransmit(HTTPConduit.java:1420)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRetransmits(HTTPConduit.java:1395)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1522)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1330)
... 11 more
I understand that described case is invalid by server, but I think it will be cool if we log some more informative. For example: "Authentication parameters is not specified".
Thank you!
was:
Hi guys,
In process of using RESTful client based on Apache CXF JAX-RS with activated auto-redirect option, I observed NPE on my logs. The short investigation shows that the problem was caused by Web Service side, that send "401 Unauthorized" HTTP response without "WWW-Authenticate".
In this case, on HTTPConduit class when we try to handle retransmits (by auto-redirect option), we expect that response message MUST contains authentication params, but header map doesn't contain it. As a result we observe the following exception:
2015-05-18 21:43:12,730 [WARN|org.apache.cxf.phase.PhaseInterceptorChain|LogUtils] Interceptor for {<TEST_SERVER>}WebClient has thrown exception, unwinding now
java.lang.NullPointerException: NullPointerException invoking <TEST_SERVER>: null
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1359)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1348)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:638)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
at org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:619)
at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1084)
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:883)
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:854)
at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:320)
at org.apache.cxf.jaxrs.client.WebClient.get(WebClient.java:346)
at com.edifecs.etools.xeserver.restful.client.transport.impl.Test.main(Test.java:40)
Caused by: java.lang.NullPointerException
at org.apache.cxf.transport.http.auth.HttpAuthHeader.<init>(HttpAuthHeader.java:52)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.authorizationRetransmit(HTTPConduit.java:1480)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.processRetransmit(HTTPConduit.java:1420)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRetransmits(HTTPConduit.java:1395)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1522)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1330)
... 11 more
I understand that described case is invalid by server, but I think it will be cool if we log some more informative. For example: "Authentication parameters is not specified".
Thank you!
> HTTP Conduit throws NPE exception for "invalid" 401 HTTP response
> -----------------------------------------------------------------
>
> Key: CXF-6408
> URL: https://issues.apache.org/jira/browse/CXF-6408
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS, Transports
> Affects Versions: 3.0.2, 3.1.0
> Environment: Windows 7, JDK1.7.0_65, cxf-rt-transports-http: 3.0.x
> Reporter: Dmitriy Fedoriv
> Priority: Minor
>
> Hi guys,
> In process of using RESTful client based on Apache CXF JAX-RS with activated auto-redirect option, I observed NPE on my logs. The short investigation shows that the problem was caused by Web Service side, that send "401 Unauthorized" HTTP response without "WWW-Authenticate" header.
> In this case, on HTTPConduit class when we try to handle retransmits (by auto-redirect option), we expect that response message MUST contains authentication params, but header map doesn't contain it. As a result we observe the following exception:
> 2015-05-18 21:43:12,730 [WARN|org.apache.cxf.phase.PhaseInterceptorChain|LogUtils] Interceptor for {<TEST_SERVER>}WebClient has thrown exception, unwinding now
> java.lang.NullPointerException: NullPointerException invoking <TEST_SERVER>: null
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
> at java.lang.reflect.Constructor.newInstance(Unknown Source)
> at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1359)
> at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1348)
> at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
> at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:638)
> at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
> at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
> at org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:619)
> at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1084)
> at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:883)
> at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:854)
> at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:320)
> at org.apache.cxf.jaxrs.client.WebClient.get(WebClient.java:346)
> at com.edifecs.etools.xeserver.restful.client.transport.impl.Test.main(Test.java:40)
> Caused by: java.lang.NullPointerException
> at org.apache.cxf.transport.http.auth.HttpAuthHeader.<init>(HttpAuthHeader.java:52)
> at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.authorizationRetransmit(HTTPConduit.java:1480)
> at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.processRetransmit(HTTPConduit.java:1420)
> at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRetransmits(HTTPConduit.java:1395)
> at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1522)
> at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1330)
> ... 11 more
> I understand that described case is invalid by server, but I think it will be cool if we log some more informative. For example: "Authentication parameters is not specified".
> Thank you!
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)