pingidentity / scim2

The UnboundID SCIM 2.0 SDK for Java
185 stars 75 forks source link

RESTEASY004655: Unable to serialize property 'operations' from com.unboundid.scim2.common.messages.PatchRequest #231

Closed Toru47 closed 2 months ago

Toru47 commented 2 months ago
scimService.modifyRequest("Users", "4711").replaceValue("title", "Prof. Dr.").invoke(UserResource.class);

causes

jakarta.ws.rs.ProcessingException: RESTEASY004655: Unable to invoke request: jakarta.ws.rs.ProcessingException: RESTEASY008205: JSON Binding serialization error jakarta.json.bind.JsonbException: Unable to serialize property 'operations' from com.unboundid.scim2.common.messages.PatchRequest
       at org.jboss.resteasy.client.jaxrs.engines.ManualClosingApacheHttpClient43Engine.invoke(ManualClosingApacheHttpClient43Engine.java:365)
       at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:427)
       at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:71)
       at org.jboss.resteasy.client.jaxrs.internal.ClientInvocationBuilder.method(ClientInvocationBuilder.java:285)
       at com.unboundid.scim2.client.requests.ModifyRequestBuilder$Typed.invoke(ModifyRequestBuilder.java:210)
       at ITest.runTest(ITest.java:179)
       at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
       at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.base/java.lang.reflect.Method.invoke(Method.java:566)
       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.InvokeMethod.evaluate(InvokeMethod.java:20)
       at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
       at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
       at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)
       at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
       at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
       at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
       at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
       at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
       at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
       at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:93)
       at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:529)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:756)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
Caused by: jakarta.ws.rs.ProcessingException: RESTEASY008205: JSON Binding serialization error jakarta.json.bind.JsonbException: Unable to serialize property 'operations' from com.unboundid.scim2.common.messages.PatchRequest
       at org.jboss.resteasy.plugins.providers.jsonb.JsonBindingProvider.writeTo(JsonBindingProvider.java:207)
       at org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.writeTo(AbstractWriterInterceptorContext.java:261)
       at org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.syncProceed(AbstractWriterInterceptorContext.java:224)
       at org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:207)
       at org.jboss.resteasy.security.doseta.DigitalSigningInterceptor.aroundWriteTo(DigitalSigningInterceptor.java:108)
       at org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.syncProceed(AbstractWriterInterceptorContext.java:231)
       at org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:207)
       at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.writeRequestBody(ClientInvocation.java:387)
       at org.jboss.resteasy.client.jaxrs.engines.ManualClosingApacheHttpClient43Engine.writeRequestBodyToOutputStream(ManualClosingApacheHttpClient43Engine.java:579)
       at org.jboss.resteasy.client.jaxrs.engines.ManualClosingApacheHttpClient43Engine.buildEntity(ManualClosingApacheHttpClient43Engine.java:548)
       at org.jboss.resteasy.client.jaxrs.engines.ManualClosingApacheHttpClient43Engine.loadHttpMethod(ManualClosingApacheHttpClient43Engine.java:486)
       at org.jboss.resteasy.client.jaxrs.engines.ManualClosingApacheHttpClient43Engine.invoke(ManualClosingApacheHttpClient43Engine.java:345)
       ... 28 more
Caused by: jakarta.json.bind.JsonbException: Unable to serialize property 'operations' from com.unboundid.scim2.common.messages.PatchRequest
       at org.eclipse.yasson.internal.serializer.ObjectSerializer.lambda$serialize$0(ObjectSerializer.java:43)
       at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
       at org.eclipse.yasson.internal.serializer.ObjectSerializer.serialize(ObjectSerializer.java:38)
       at org.eclipse.yasson.internal.serializer.RecursionChecker.serialize(RecursionChecker.java:38)
       at org.eclipse.yasson.internal.serializer.KeyWriter.serialize(KeyWriter.java:41)
       at org.eclipse.yasson.internal.serializer.NullVisibilitySwitcher.serialize(NullVisibilitySwitcher.java:40)
       at org.eclipse.yasson.internal.serializer.NullSerializer.serialize(NullSerializer.java:67)
       at org.eclipse.yasson.internal.SerializationContextImpl.serializeObject(SerializationContextImpl.java:197)
       at org.eclipse.yasson.internal.SerializationContextImpl.marshall(SerializationContextImpl.java:133)
       at org.eclipse.yasson.internal.SerializationContextImpl.marshall(SerializationContextImpl.java:159)
       at org.eclipse.yasson.internal.JsonBinding.toJson(JsonBinding.java:121)
       at org.jboss.resteasy.plugins.providers.jsonb.ManagedJsonb.toJson(ManagedJsonb.java:78)
       at org.jboss.resteasy.plugins.providers.jsonb.JsonBindingProvider.writeTo(JsonBindingProvider.java:204)
       ... 39 more
Caused by: jakarta.json.bind.JsonbException: Error accessing getter 'getJsonNode' declared in 'class com.unboundid.scim2.common.messages.PatchOperation$ReplaceOperation'
       at org.eclipse.yasson.internal.model.PropertyModel.createReadHandle(PropertyModel.java:513)
       at org.eclipse.yasson.internal.model.PropertyModel.isPropertyReadable(PropertyModel.java:498)
       at org.eclipse.yasson.internal.ClassParser.getSortedParentProperties(ClassParser.java:328)
       at org.eclipse.yasson.internal.ClassParser.parseProperties(ClassParser.java:67)
       at org.eclipse.yasson.internal.MappingContext.lambda$createParseClassModelFunction$1(MappingContext.java:104)
       at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1737)
       at org.eclipse.yasson.internal.MappingContext.getOrCreateClassModel(MappingContext.java:77)
       at org.eclipse.yasson.internal.serializer.SerializationModelCreator.serializerChainInternal(SerializationModelCreator.java:187)
       at org.eclipse.yasson.internal.serializer.SerializationModelCreator.serializerChainRuntime(SerializationModelCreator.java:123)
       at org.eclipse.yasson.internal.serializer.types.ObjectTypeSerializer.lambda$findSerializer$0(ObjectTypeSerializer.java:67)
       at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
       at org.eclipse.yasson.internal.serializer.types.ObjectTypeSerializer.findSerializer(ObjectTypeSerializer.java:65)
       at org.eclipse.yasson.internal.serializer.types.ObjectTypeSerializer.serializeValue(ObjectTypeSerializer.java:50)
       at org.eclipse.yasson.internal.serializer.types.TypeSerializer$ValueSerializer.serialize(TypeSerializer.java:51)
       at org.eclipse.yasson.internal.serializer.types.TypeSerializer.serialize(TypeSerializer.java:37)
       at org.eclipse.yasson.internal.serializer.types.ObjectTypeSerializer.serialize(ObjectTypeSerializer.java:31)
       at org.eclipse.yasson.internal.serializer.NullSerializer.serialize(NullSerializer.java:67)
       at org.eclipse.yasson.internal.serializer.CollectionSerializer.lambda$serialize$0(CollectionSerializer.java:37)
       at java.base/java.lang.Iterable.forEach(Iterable.java:75)
       at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1083)
       at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1083)
       at org.eclipse.yasson.internal.serializer.CollectionSerializer.serialize(CollectionSerializer.java:37)
       at org.eclipse.yasson.internal.serializer.KeyWriter.serialize(KeyWriter.java:41)
       at org.eclipse.yasson.internal.serializer.NullVisibilitySwitcher.serialize(NullVisibilitySwitcher.java:40)
       at org.eclipse.yasson.internal.serializer.NullSerializer.serialize(NullSerializer.java:67)
       at org.eclipse.yasson.internal.serializer.ValueGetterSerializer.serialize(ValueGetterSerializer.java:43)
       at org.eclipse.yasson.internal.serializer.ObjectSerializer.lambda$serialize$0(ObjectSerializer.java:41)
       ... 51 more
Caused by: java.lang.IllegalAccessException: class is not public: com.unboundid.scim2.common.messages.PatchOperation$ReplaceOperation.getJsonNode[Ljava.lang.Object;@630390b9/invokeSpecial, from public Lookup
       at java.base/java.lang.invoke.MemberName.makeAccessException(MemberName.java:942)
       at java.base/java.lang.invoke.MethodHandles$Lookup.checkAccess(MethodHandles.java:2206)
       at java.base/java.lang.invoke.MethodHandles$Lookup.checkMethod(MethodHandles.java:2146)
       at java.base/java.lang.invoke.MethodHandles$Lookup.getDirectMethodCommon(MethodHandles.java:2290)
       at java.base/java.lang.invoke.MethodHandles$Lookup.getDirectMethodNoSecurityManager(MethodHandles.java:2283)
       at java.base/java.lang.invoke.MethodHandles$Lookup.unreflect(MethodHandles.java:1747)
       at org.eclipse.yasson.internal.model.PropertyModel.createReadHandle(PropertyModel.java:510)
       ... 77 more

What's wrong?

Java Version: 11.0.3+7 SCIM 2 SDK version: 3.1.0 Libs from WildFly 33

kqarryzada commented 2 months ago

Hi @Toru47. The error message states:

jakarta.ws.rs.ProcessingException: RESTEASY008205: JSON Binding serialization error jakarta.json.bind.JsonbException: Unable to serialize property...

This is an error from the Jakarta JSON Binding (JSON-B) library. The SCIM 2 SDK uses Jackson for JSON serialization/deserialization, and does not use JSON-B. This typically indicates the project has a transitive JSON-B dependency that must be removed.

Are you using the oauth2-client library? If so, you'll need to exclude the json-binding library that is included with that dependency. Our FAQ has information on how to do this, as well as some further background: https://github.com/pingidentity/scim2/wiki/Common-Problems-and-FAQ#jsonbexceptions

Toru47 commented 2 months ago

@kqarryzada Okay, thanks. No, I don't use oauth2-client. I'll try to remove this dependency. But that can be a challenge...

Toru47 commented 2 months ago

In the meantime resolved by removing jakarta.json.bind-api-3.0.1.jar from classpath.