You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by so...@e-mail.de on 2025/02/21 18:14:09 UTC
Two bug reports for the JAX-RS frontend
Hi everyone,
I would like to report two bugs in the JAX-RS frontend, hope this is the right place in absence of a Jira Account.
Reproducers for both bugs can be found at https://github.com/Sola-ris/cxf-reproducers
CXF version: 4.1.0
Java version: Temurin-21.0.6+7
# CXF's implementation of EntityPart.Builder does not seem to work in a Java SE environment.
Attempting to build the EntityPart in a Java SE environment like e.g. a JUnit test always fails with a NullPointerException
Steps to reproduce:
EntityPart.withName("greeting")
.content("hello")
.build();
Stacktrace:
java.lang.NullPointerException: Cannot invoke "org.apache.cxf.message.Message.getExchange()" because "m" is null
at org.apache.cxf.jaxrs.provider.ServerProviderFactory.getInstance(ServerProviderFactory.java:124)
at org.apache.cxf.jaxrs.impl.EntityPartBuilderImpl.build(EntityPartBuilderImpl.java:111)
at org.example.EntityPartReproducerTest.testBuildEntityPart(EntityPartReproducerTest.java:15)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
# When using the Microprofile RestClient, ClientRequestContext#getConfiguration always returns null
This makes it impossible to access properties set on the RestClientBuilder inside ClientRequest/ResponseFilters.
Steps to reproduce:
@Path("")
public interface GreetingClient {
@GET
Response greet();
}
public static class Filter implements ClientRequestFilter {
@Override
public void filter(ClientRequestContext requestContext) {
System.out.println(requestContext.getConfiguration().getProperty("foo"));
}
}
RestClientBuilder.newBuilder()
.baseUri(URI.create("http://localhost:8080"))
.property("foo", "bar")
.register(Filter.class)
.build(GreetingClient.class)
.greet();
Stacktrace:
jakarta.ws.rs.ProcessingException: java.lang.NullPointerException: Cannot invoke "jakarta.ws.rs.core.Configuration.getProperty(String)" because the return value of "jakarta.ws.rs.client.ClientRequestContext.getConfiguration()" is null
at org.apache.cxf.jaxrs.client.AbstractClient.checkClientException(AbstractClient.java:645)
at org.apache.cxf.jaxrs.client.AbstractClient.preProcessResult(AbstractClient.java:619)
at org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:926)
at org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:347)
at org.apache.cxf.microprofile.client.proxy.MicroProfileClientProxyImpl.invokeActual(MicroProfileClientProxyImpl.java:496)
at org.apache.cxf.microprofile.client.proxy.MicroProfileClientProxyImpl$Invoker.call(MicroProfileClientProxyImpl.java:515)
at org.apache.cxf.microprofile.client.cdi.CDIInterceptorWrapper$BasicCDIInterceptorWrapper.invoke(CDIInterceptorWrapper.java:43)
at org.apache.cxf.microprofile.client.proxy.MicroProfileClientProxyImpl.invoke(MicroProfileClientProxyImpl.java:492)
at jdk.proxy2/jdk.proxy2.$Proxy21.greet(Unknown Source)
at org.example.MpRestClientConfigurationReproducerTest.testAccessConfigurationInFilter(MpRestClientConfigurationReproducerTest.java:24)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: java.lang.NullPointerException: Cannot invoke "jakarta.ws.rs.core.Configuration.getProperty(String)" because the return value of "jakarta.ws.rs.client.ClientRequestContext.getConfiguration()" is null
at org.example.MpRestClientConfigurationReproducerTest$Filter.filter(MpRestClientConfigurationReproducerTest.java:38)
at org.apache.cxf.jaxrs.client.spec.ClientRequestFilterInterceptor.handleMessage(ClientRequestFilterInterceptor.java:70)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
at org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:717)
at org.apache.cxf.microprofile.client.proxy.MicroProfileClientProxyImpl.doRunInterceptorChain(MicroProfileClientProxyImpl.java:184)
at org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:924)
... 10 more
Best regards,
Sola-ris
Re: Re: Two bug reports for the JAX-RS frontend
Posted by Andriy Redko <dr...@gmail.com>.
All good, thank you!
Best Regards,
Andriy Redko
On Fri, Feb 21, 2025, 2:36 p.m. <so...@e-mail.de> wrote:
> Hi Andriy,
>
> I have raised [1] and [2] in Jira.
> Sorry I didn't raise them there in the first place.
>
> [1] https://issues.apache.org/jira/browse/CXF-9113
> [2] https://issues.apache.org/jira/browse/CXF-9114
>
> Best Regards,
> Sola-ris
>
> > Gesendet: Freitag, 21. Februar 2025 um 19:31 Uhr
> > Von: "Andriy Redko" <dr...@gmail.com>
> > An: "Daniel Kulp" <de...@cxf.apache.org>
> > Betreff: Re: Two bug reports for the JAX-RS frontend
> >
> > Hi Sola-ris,
> >
> > Could you please create issues here [1] for these bug reports, thank you.
> >
> > [1] https://issues.apache.org/jira/
> >
> > Best Regards,
> > Andriy Redko
> >
> > On Fri, Feb 21, 2025, 1:15 p.m. <so...@e-mail.de> wrote:
> >
> > > Hi everyone,
> > > I would like to report two bugs in the JAX-RS frontend, hope this is
> the
> > > right place in absence of a Jira Account.
> > > Reproducers for both bugs can be found at
> > > https://github.com/Sola-ris/cxf-reproducers
> > >
> > > CXF version: 4.1.0
> > > Java version: Temurin-21.0.6+7
> > >
> > > # CXF's implementation of EntityPart.Builder does not seem to work in a
> > > Java SE environment.
> > >
> > > Attempting to build the EntityPart in a Java SE environment like e.g. a
> > > JUnit test always fails with a NullPointerException
> > >
> > > Steps to reproduce:
> > >
> > > EntityPart.withName("greeting")
> > > .content("hello")
> > > .build();
> > >
> > > Stacktrace:
> > > java.lang.NullPointerException: Cannot invoke
> > > "org.apache.cxf.message.Message.getExchange()" because "m" is null
> > > at
> > >
> org.apache.cxf.jaxrs.provider.ServerProviderFactory.getInstance(ServerProviderFactory.java:124)
> > > at
> > >
> org.apache.cxf.jaxrs.impl.EntityPartBuilderImpl.build(EntityPartBuilderImpl.java:111)
> > > at
> > >
> org.example.EntityPartReproducerTest.testBuildEntityPart(EntityPartReproducerTest.java:15)
> > > at java.base/java.lang.reflect.Method.invoke(Method.java:580)
> > > at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
> > > at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
> > >
> > > # When using the Microprofile RestClient,
> > > ClientRequestContext#getConfiguration always returns null
> > >
> > > This makes it impossible to access properties set on the
> RestClientBuilder
> > > inside ClientRequest/ResponseFilters.
> > >
> > > Steps to reproduce:
> > >
> > > @Path("")
> > > public interface GreetingClient {
> > > @GET
> > > Response greet();
> > > }
> > >
> > > public static class Filter implements ClientRequestFilter {
> > > @Override
> > > public void filter(ClientRequestContext requestContext) {
> > >
> > >
> System.out.println(requestContext.getConfiguration().getProperty("foo"));
> > > }
> > > }
> > >
> > > RestClientBuilder.newBuilder()
> > > .baseUri(URI.create("http://localhost:8080"))
> > > .property("foo", "bar")
> > > .register(Filter.class)
> > > .build(GreetingClient.class)
> > > .greet();
> > >
> > > Stacktrace:
> > > jakarta.ws.rs.ProcessingException: java.lang.NullPointerException:
> Cannot
> > > invoke "jakarta.ws.rs.core.Configuration.getProperty(String)" because
> the
> > > return value of
> > > "jakarta.ws.rs.client.ClientRequestContext.getConfiguration()" is null
> > > at
> > >
> org.apache.cxf.jaxrs.client.AbstractClient.checkClientException(AbstractClient.java:645)
> > > at
> > >
> org.apache.cxf.jaxrs.client.AbstractClient.preProcessResult(AbstractClient.java:619)
> > > at
> > >
> org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:926)
> > > at
> > >
> org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:347)
> > > at
> > >
> org.apache.cxf.microprofile.client.proxy.MicroProfileClientProxyImpl.invokeActual(MicroProfileClientProxyImpl.java:496)
> > > at
> > >
> org.apache.cxf.microprofile.client.proxy.MicroProfileClientProxyImpl$Invoker.call(MicroProfileClientProxyImpl.java:515)
> > > at
> > >
> org.apache.cxf.microprofile.client.cdi.CDIInterceptorWrapper$BasicCDIInterceptorWrapper.invoke(CDIInterceptorWrapper.java:43)
> > > at
> > >
> org.apache.cxf.microprofile.client.proxy.MicroProfileClientProxyImpl.invoke(MicroProfileClientProxyImpl.java:492)
> > > at jdk.proxy2/jdk.proxy2.$Proxy21.greet(Unknown Source)
> > > at
> > >
> org.example.MpRestClientConfigurationReproducerTest.testAccessConfigurationInFilter(MpRestClientConfigurationReproducerTest.java:24)
> > > at java.base/java.lang.reflect.Method.invoke(Method.java:580)
> > > at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
> > > at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
> > > Caused by: java.lang.NullPointerException: Cannot invoke
> > > "jakarta.ws.rs.core.Configuration.getProperty(String)" because the
> return
> > > value of
> "jakarta.ws.rs.client.ClientRequestContext.getConfiguration()" is
> > > null
> > > at
> > >
> org.example.MpRestClientConfigurationReproducerTest$Filter.filter(MpRestClientConfigurationReproducerTest.java:38)
> > > at
> > >
> org.apache.cxf.jaxrs.client.spec.ClientRequestFilterInterceptor.handleMessage(ClientRequestFilterInterceptor.java:70)
> > > at
> > >
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
> > > at
> > >
> org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:717)
> > > at
> > >
> org.apache.cxf.microprofile.client.proxy.MicroProfileClientProxyImpl.doRunInterceptorChain(MicroProfileClientProxyImpl.java:184)
> > > at
> > >
> org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:924)
> > > ... 10 more
> > >
> > > Best regards,
> > > Sola-ris
> > >
> >
>
Re: Re: Two bug reports for the JAX-RS frontend
Posted by so...@e-mail.de.
Hi Andriy,
I have raised [1] and [2] in Jira.
Sorry I didn't raise them there in the first place.
[1] https://issues.apache.org/jira/browse/CXF-9113
[2] https://issues.apache.org/jira/browse/CXF-9114
Best Regards,
Sola-ris
> Gesendet: Freitag, 21. Februar 2025 um 19:31 Uhr
> Von: "Andriy Redko" <dr...@gmail.com>
> An: "Daniel Kulp" <de...@cxf.apache.org>
> Betreff: Re: Two bug reports for the JAX-RS frontend
>
> Hi Sola-ris,
>
> Could you please create issues here [1] for these bug reports, thank you.
>
> [1] https://issues.apache.org/jira/
>
> Best Regards,
> Andriy Redko
>
> On Fri, Feb 21, 2025, 1:15 p.m. <so...@e-mail.de> wrote:
>
> > Hi everyone,
> > I would like to report two bugs in the JAX-RS frontend, hope this is the
> > right place in absence of a Jira Account.
> > Reproducers for both bugs can be found at
> > https://github.com/Sola-ris/cxf-reproducers
> >
> > CXF version: 4.1.0
> > Java version: Temurin-21.0.6+7
> >
> > # CXF's implementation of EntityPart.Builder does not seem to work in a
> > Java SE environment.
> >
> > Attempting to build the EntityPart in a Java SE environment like e.g. a
> > JUnit test always fails with a NullPointerException
> >
> > Steps to reproduce:
> >
> > EntityPart.withName("greeting")
> > .content("hello")
> > .build();
> >
> > Stacktrace:
> > java.lang.NullPointerException: Cannot invoke
> > "org.apache.cxf.message.Message.getExchange()" because "m" is null
> > at
> > org.apache.cxf.jaxrs.provider.ServerProviderFactory.getInstance(ServerProviderFactory.java:124)
> > at
> > org.apache.cxf.jaxrs.impl.EntityPartBuilderImpl.build(EntityPartBuilderImpl.java:111)
> > at
> > org.example.EntityPartReproducerTest.testBuildEntityPart(EntityPartReproducerTest.java:15)
> > at java.base/java.lang.reflect.Method.invoke(Method.java:580)
> > at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
> > at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
> >
> > # When using the Microprofile RestClient,
> > ClientRequestContext#getConfiguration always returns null
> >
> > This makes it impossible to access properties set on the RestClientBuilder
> > inside ClientRequest/ResponseFilters.
> >
> > Steps to reproduce:
> >
> > @Path("")
> > public interface GreetingClient {
> > @GET
> > Response greet();
> > }
> >
> > public static class Filter implements ClientRequestFilter {
> > @Override
> > public void filter(ClientRequestContext requestContext) {
> >
> > System.out.println(requestContext.getConfiguration().getProperty("foo"));
> > }
> > }
> >
> > RestClientBuilder.newBuilder()
> > .baseUri(URI.create("http://localhost:8080"))
> > .property("foo", "bar")
> > .register(Filter.class)
> > .build(GreetingClient.class)
> > .greet();
> >
> > Stacktrace:
> > jakarta.ws.rs.ProcessingException: java.lang.NullPointerException: Cannot
> > invoke "jakarta.ws.rs.core.Configuration.getProperty(String)" because the
> > return value of
> > "jakarta.ws.rs.client.ClientRequestContext.getConfiguration()" is null
> > at
> > org.apache.cxf.jaxrs.client.AbstractClient.checkClientException(AbstractClient.java:645)
> > at
> > org.apache.cxf.jaxrs.client.AbstractClient.preProcessResult(AbstractClient.java:619)
> > at
> > org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:926)
> > at
> > org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:347)
> > at
> > org.apache.cxf.microprofile.client.proxy.MicroProfileClientProxyImpl.invokeActual(MicroProfileClientProxyImpl.java:496)
> > at
> > org.apache.cxf.microprofile.client.proxy.MicroProfileClientProxyImpl$Invoker.call(MicroProfileClientProxyImpl.java:515)
> > at
> > org.apache.cxf.microprofile.client.cdi.CDIInterceptorWrapper$BasicCDIInterceptorWrapper.invoke(CDIInterceptorWrapper.java:43)
> > at
> > org.apache.cxf.microprofile.client.proxy.MicroProfileClientProxyImpl.invoke(MicroProfileClientProxyImpl.java:492)
> > at jdk.proxy2/jdk.proxy2.$Proxy21.greet(Unknown Source)
> > at
> > org.example.MpRestClientConfigurationReproducerTest.testAccessConfigurationInFilter(MpRestClientConfigurationReproducerTest.java:24)
> > at java.base/java.lang.reflect.Method.invoke(Method.java:580)
> > at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
> > at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
> > Caused by: java.lang.NullPointerException: Cannot invoke
> > "jakarta.ws.rs.core.Configuration.getProperty(String)" because the return
> > value of "jakarta.ws.rs.client.ClientRequestContext.getConfiguration()" is
> > null
> > at
> > org.example.MpRestClientConfigurationReproducerTest$Filter.filter(MpRestClientConfigurationReproducerTest.java:38)
> > at
> > org.apache.cxf.jaxrs.client.spec.ClientRequestFilterInterceptor.handleMessage(ClientRequestFilterInterceptor.java:70)
> > at
> > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
> > at
> > org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:717)
> > at
> > org.apache.cxf.microprofile.client.proxy.MicroProfileClientProxyImpl.doRunInterceptorChain(MicroProfileClientProxyImpl.java:184)
> > at
> > org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:924)
> > ... 10 more
> >
> > Best regards,
> > Sola-ris
> >
>
Re: Two bug reports for the JAX-RS frontend
Posted by Andriy Redko <dr...@gmail.com>.
Hi Sola-ris,
Could you please create issues here [1] for these bug reports, thank you.
[1] https://issues.apache.org/jira/
Best Regards,
Andriy Redko
On Fri, Feb 21, 2025, 1:15 p.m. <so...@e-mail.de> wrote:
> Hi everyone,
> I would like to report two bugs in the JAX-RS frontend, hope this is the
> right place in absence of a Jira Account.
> Reproducers for both bugs can be found at
> https://github.com/Sola-ris/cxf-reproducers
>
> CXF version: 4.1.0
> Java version: Temurin-21.0.6+7
>
> # CXF's implementation of EntityPart.Builder does not seem to work in a
> Java SE environment.
>
> Attempting to build the EntityPart in a Java SE environment like e.g. a
> JUnit test always fails with a NullPointerException
>
> Steps to reproduce:
>
> EntityPart.withName("greeting")
> .content("hello")
> .build();
>
> Stacktrace:
> java.lang.NullPointerException: Cannot invoke
> "org.apache.cxf.message.Message.getExchange()" because "m" is null
> at
> org.apache.cxf.jaxrs.provider.ServerProviderFactory.getInstance(ServerProviderFactory.java:124)
> at
> org.apache.cxf.jaxrs.impl.EntityPartBuilderImpl.build(EntityPartBuilderImpl.java:111)
> at
> org.example.EntityPartReproducerTest.testBuildEntityPart(EntityPartReproducerTest.java:15)
> at java.base/java.lang.reflect.Method.invoke(Method.java:580)
> at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
> at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
>
> # When using the Microprofile RestClient,
> ClientRequestContext#getConfiguration always returns null
>
> This makes it impossible to access properties set on the RestClientBuilder
> inside ClientRequest/ResponseFilters.
>
> Steps to reproduce:
>
> @Path("")
> public interface GreetingClient {
> @GET
> Response greet();
> }
>
> public static class Filter implements ClientRequestFilter {
> @Override
> public void filter(ClientRequestContext requestContext) {
>
> System.out.println(requestContext.getConfiguration().getProperty("foo"));
> }
> }
>
> RestClientBuilder.newBuilder()
> .baseUri(URI.create("http://localhost:8080"))
> .property("foo", "bar")
> .register(Filter.class)
> .build(GreetingClient.class)
> .greet();
>
> Stacktrace:
> jakarta.ws.rs.ProcessingException: java.lang.NullPointerException: Cannot
> invoke "jakarta.ws.rs.core.Configuration.getProperty(String)" because the
> return value of
> "jakarta.ws.rs.client.ClientRequestContext.getConfiguration()" is null
> at
> org.apache.cxf.jaxrs.client.AbstractClient.checkClientException(AbstractClient.java:645)
> at
> org.apache.cxf.jaxrs.client.AbstractClient.preProcessResult(AbstractClient.java:619)
> at
> org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:926)
> at
> org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:347)
> at
> org.apache.cxf.microprofile.client.proxy.MicroProfileClientProxyImpl.invokeActual(MicroProfileClientProxyImpl.java:496)
> at
> org.apache.cxf.microprofile.client.proxy.MicroProfileClientProxyImpl$Invoker.call(MicroProfileClientProxyImpl.java:515)
> at
> org.apache.cxf.microprofile.client.cdi.CDIInterceptorWrapper$BasicCDIInterceptorWrapper.invoke(CDIInterceptorWrapper.java:43)
> at
> org.apache.cxf.microprofile.client.proxy.MicroProfileClientProxyImpl.invoke(MicroProfileClientProxyImpl.java:492)
> at jdk.proxy2/jdk.proxy2.$Proxy21.greet(Unknown Source)
> at
> org.example.MpRestClientConfigurationReproducerTest.testAccessConfigurationInFilter(MpRestClientConfigurationReproducerTest.java:24)
> at java.base/java.lang.reflect.Method.invoke(Method.java:580)
> at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
> at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
> Caused by: java.lang.NullPointerException: Cannot invoke
> "jakarta.ws.rs.core.Configuration.getProperty(String)" because the return
> value of "jakarta.ws.rs.client.ClientRequestContext.getConfiguration()" is
> null
> at
> org.example.MpRestClientConfigurationReproducerTest$Filter.filter(MpRestClientConfigurationReproducerTest.java:38)
> at
> org.apache.cxf.jaxrs.client.spec.ClientRequestFilterInterceptor.handleMessage(ClientRequestFilterInterceptor.java:70)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
> at
> org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:717)
> at
> org.apache.cxf.microprofile.client.proxy.MicroProfileClientProxyImpl.doRunInterceptorChain(MicroProfileClientProxyImpl.java:184)
> at
> org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:924)
> ... 10 more
>
> Best regards,
> Sola-ris
>