Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jersey-dev] [External] : Re: NullPointerException problem in jersey

I just read about this statement and it seems to be applicable to us.

https://eclipse-ee4j.github.io/jersey.github.io/documentation/latest30x/media.html#json.jackson

In order to use Jackson as your JSON (JAXB/POJO) provider you need to register JacksonFeature and a ContextResolver<T> for ObjectMapper, if needed, in your Configurable (client/server).

So I added the registration, and it seems to work better.

@ApplicationPath("api")
public class MyApp extends ResourceConfig {

  public MyApp(){
    super();        
    register(JacksonFeature.class);
    packages("my.rest.api");
  }

- Den

On Thursday, March 7, 2024 at 11:33:45 AM EST, Jan Supol <jan.supol@xxxxxxxxxx> wrote:


Hi, 
It sounds like the same issue but it should be fixed in 3.0.12.
--Jan


From: jersey-dev <jersey-dev-bounces@xxxxxxxxxxx> on behalf of denny wong via jersey-dev <jersey-dev@xxxxxxxxxxx>
Sent: Thursday, March 7, 2024 12:00 AM
To: jersey-dev@xxxxxxxxxxx <jersey-dev@xxxxxxxxxxx>
Cc: denny wong <tecgie88@xxxxxxxxx>
Subject: [External] : Re: [jersey-dev] NullPointerException problem in jersey
 
Hi All

Recently, we upgraded to Jetty11/jdk17/jakarta9/jersey 3.0.12, and have been running into the following intermittent error. We couldn't find anything in the code. Please advise on how to resolve this error. Thanks 

java.lang.NullPointerException: Cannot invoke "org.glassfish.jersey.message.filtering.spi.ObjectProvider.getFilteringObject(java.lang.reflect.Type, boolean, java.lang.annotation.Annotation[])" because the return value of "jakarta.inject.Provider.get()" is null at org.glassfish.jersey.jackson.internal.FilteringJacksonJaxbJsonProvider.writeTo(FilteringJacksonJaxbJsonProvider.java:116) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:242) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:227) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:139) at org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:85) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:139) at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:61) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:139) at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1116)


Back to the top