ServiceConfigurationError io.jsonwebtoken.io.Serializer: io.jsonwebtoken.gson.io.GsonSerializer not a subtype

47 views Asked by At

So I'm trying to upgrade from

<dependency>
    <groupId>io.jsonwebtoken</groupId>
    <artifactId>jjwt</artifactId>
    <version>0.9.1</version>
</dependency>

to the new

<!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-api -->
<dependency>
    <groupId>io.jsonwebtoken</groupId>
    <artifactId>jjwt-api</artifactId>
    <version>0.11.5</version>
</dependency>

I've added the jjwt-impl and jjwt-gson as runtime dependencies.

Everything works fine on the first application deploy and continues to work, until I redeploy the application then the following error occurs when trying to create a JWT token:

    org.apache.cxf.interceptor.Fault: io.jsonwebtoken.io.Serializer: io.jsonwebtoken.gson.io.GsonSerializer not a subtype
                    at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)
                    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128)
                    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:201)
                    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:104)
                    at org.apache.openejb.server.cxf.rs.AutoJAXRSInvoker.invoke(AutoJAXRSInvoker.java:68)
....
Caused by: java.util.ServiceConfigurationError: io.jsonwebtoken.io.Serializer: io.jsonwebtoken.gson.io.GsonSerializer not a subtype
                at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:593)
                at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1244)

I restart the server (Tomee 9.1.0 Plus) and everything works fine again, until the next redeploy. Any suggestions on how to debug and find the reason ?

So I'm trying to upgrade from

<dependency>
    <groupId>io.jsonwebtoken</groupId>
    <artifactId>jjwt</artifactId>
    <version>0.9.1</version>
</dependency>

to the new

<!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-api -->
<dependency>
    <groupId>io.jsonwebtoken</groupId>
    <artifactId>jjwt-api</artifactId>
    <version>0.11.5</version>
</dependency>

I've added the jjwt-impl and jjwt-gson as runtime dependencies.

Everything works fine on the first application deploy and continues to work, until I redeploy the application then the following error occurs when trying to create a JWT token:

    org.apache.cxf.interceptor.Fault: io.jsonwebtoken.io.Serializer: io.jsonwebtoken.gson.io.GsonSerializer not a subtype
                    at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)
                    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128)
                    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:201)
                    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:104)
                    at org.apache.openejb.server.cxf.rs.AutoJAXRSInvoker.invoke(AutoJAXRSInvoker.java:68)
....
Caused by: java.util.ServiceConfigurationError: io.jsonwebtoken.io.Serializer: io.jsonwebtoken.gson.io.GsonSerializer not a subtype
                at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:593)
                at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1244)

I restart the server (Tomee 9.1.0 Plus) and everything works fine again, until the next redeploy. Any suggestions on how to debug and find the reason ?

0

There are 0 answers