Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blackbird doesn't work on Java 15+ #138

Closed
jirkapinkas opened this issue Jun 16, 2021 · 16 comments · Fixed by #162
Closed

Blackbird doesn't work on Java 15+ #138

jirkapinkas opened this issue Jun 16, 2021 · 16 comments · Fixed by #162
Labels
blackbird Issue related to Blackbird module
Milestone

Comments

@jirkapinkas
Copy link

On OpenJDK 15 & 16 Blackbird throws this exception. I don't use Module path.

java.lang.invoke.LambdaConversionException: Exception defining lambda proxy class at java.base/java.lang.invoke.InnerClassLambdaMetafactory.generateInnerClass(InnerClassLambdaMetafactory.java:413) ~[na:na] at java.base/java.lang.invoke.InnerClassLambdaMetafactory.spinInnerClass(InnerClassLambdaMetafactory.java:304) ~[na:na] at java.base/java.lang.invoke.InnerClassLambdaMetafactory.buildCallSite(InnerClassLambdaMetafactory.java:218) ~[na:na] at java.base/java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:328) ~[na:na] at com.fasterxml.jackson.module.blackbird.ser.BBSerializerModifier.createProperty(BBSerializerModifier.java:151) ~[jackson-module-blackbird-2.12.3.jar:2.12.3] at com.fasterxml.jackson.module.blackbird.ser.BBSerializerModifier.lambda$findProperties$0(BBSerializerModifier.java:64) ~[jackson-module-blackbird-2.12.3.jar:2.12.3] at com.fasterxml.jackson.module.blackbird.util.Unchecked.lambda$runnable$0(Unchecked.java:31) ~[jackson-module-blackbird-2.12.3.jar:2.12.3] at com.fasterxml.jackson.module.blackbird.ser.BBSerializerModifier.findProperties(BBSerializerModifier.java:65) ~[jackson-module-blackbird-2.12.3.jar:2.12.3] at com.fasterxml.jackson.module.blackbird.ser.BBSerializerModifier.changeProperties(BBSerializerModifier.java:49) ~[jackson-module-blackbird-2.12.3.jar:2.12.3] at com.fasterxml.jackson.databind.ser.BeanSerializerFactory.constructBeanOrAddOnSerializer(BeanSerializerFactory.java:407) ~[jackson-databind-2.12.3.jar:2.12.3] at com.fasterxml.jackson.databind.ser.BeanSerializerFactory.findBeanOrAddOnSerializer(BeanSerializerFactory.java:290) ~[jackson-databind-2.12.3.jar:2.12.3] at com.fasterxml.jackson.databind.ser.BeanSerializerFactory._createSerializer2(BeanSerializerFactory.java:235) ~[jackson-databind-2.12.3.jar:2.12.3] at com.fasterxml.jackson.databind.ser.BeanSerializerFactory.createSerializer(BeanSerializerFactory.java:169) ~[jackson-databind-2.12.3.jar:2.12.3] at com.fasterxml.jackson.databind.SerializerProvider._createUntypedSerializer(SerializerProvider.java:1473) ~[jackson-databind-2.12.3.jar:2.12.3] at com.fasterxml.jackson.databind.SerializerProvider._createAndCacheUntypedSerializer(SerializerProvider.java:1421) ~[jackson-databind-2.12.3.jar:2.12.3] at com.fasterxml.jackson.databind.SerializerProvider._findExplicitUntypedSerializer(SerializerProvider.java:1390) ~[jackson-databind-2.12.3.jar:2.12.3] at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.hasSerializerFor(DefaultSerializerProvider.java:260) ~[jackson-databind-2.12.3.jar:2.12.3] at com.fasterxml.jackson.databind.ObjectMapper.canSerialize(ObjectMapper.java:3350) ~[jackson-databind-2.12.3.jar:2.12.3] at org.springframework.messaging.converter.MappingJackson2MessageConverter.canConvertTo(MappingJackson2MessageConverter.java:163) ~[spring-messaging-5.3.8.jar:5.3.8] at org.springframework.messaging.converter.AbstractMessageConverter.toMessage(AbstractMessageConverter.java:197) ~[spring-messaging-5.3.8.jar:5.3.8] at org.springframework.messaging.converter.CompositeMessageConverter.toMessage(CompositeMessageConverter.java:96) ~[spring-messaging-5.3.8.jar:5.3.8] at org.springframework.messaging.core.AbstractMessageSendingTemplate.doConvert(AbstractMessageSendingTemplate.java:181) ~[spring-messaging-5.3.8.jar:5.3.8] at org.springframework.messaging.core.AbstractMessageSendingTemplate.convertAndSend(AbstractMessageSendingTemplate.java:150) ~[spring-messaging-5.3.8.jar:5.3.8] at org.springframework.messaging.core.AbstractMessageSendingTemplate.convertAndSend(AbstractMessageSendingTemplate.java:129) ~[spring-messaging-5.3.8.jar:5.3.8] at org.springframework.messaging.core.AbstractMessageSendingTemplate.convertAndSend(AbstractMessageSendingTemplate.java:122) ~[spring-messaging-5.3.8.jar:5.3.8] at com.company.web.controller.rest.AlarmController.publishUpdates(AlarmController.java:86) ~[classes/:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[na:na] at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84) ~[spring-context-5.3.8.jar:5.3.8] at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-5.3.8.jar:5.3.8] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[na:na] at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[na:na] at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) ~[na:na] at java.base/java.lang.Thread.run(Thread.java:831) ~[na:na] Caused by: java.lang.IllegalAccessException: com.company.web.pojo.AlarmWebsocketResult/com.fasterxml.jackson.module.blackbird.BlackbirdModule$$Lambda$1069/0x000000080133cd78 does not have full privilege access at java.base/java.lang.invoke.MethodHandles$Lookup.defineHiddenClass(MethodHandles.java:2130) ~[na:na] at java.base/java.lang.invoke.InnerClassLambdaMetafactory.generateInnerClass(InnerClassLambdaMetafactory.java:409) ~[na:na] ... 37 common frames omitted

@jirkapinkas jirkapinkas changed the title Blackbird doesn't work on 15+ Blackbird doesn't work on Java 15+ Jun 16, 2021
@carterkozak
Copy link
Contributor

A colleague just hit the same issue on jdk15 (which cannot be reproduced on jdk11) which resulted in IllegalAccessException: <type> does not have full privilege access. The problem appears to occur across classloader boundaries.

@carterkozak
Copy link
Contributor

@jirkapinkas any chance you have a reproducer for this?

@carterkozak
Copy link
Contributor

@stevenschlansker I wonder if you have thoughts/ideas on this? Unfortunately I don't have a minimal repro yet.

@stevenschlansker
Copy link
Contributor

I have not experienced this exception personally, and we run blackbird on jdk16 in production with classpath (no modulepath). We also have spring and spring-boot, but that should not be relevant.

I could definitely believe there's a bug, or a missed case (do you have a special classloader?)

There's probably some subtle environmental or JVM configuration difference that we need to isolate. A repro is definitely best, but I appreciate it might be tricky.

@cowtowncoder cowtowncoder added the blackbird Issue related to Blackbird module label Jul 9, 2021
@Quantum64
Copy link

I had this issue today. This seems to be caused by Blackbird trying to serialize something that was loaded by a different classloader than Blackbird itself. I tested the serialization of an object loaded by both a parent and child classloader of the classloader that loaded Blackbird and both cases produce this error.

@Quantum64
Copy link

Here's a self-contained minimal reproducer.

package test;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.module.blackbird.BlackbirdModule;

public class BlackbirdReproducer {
    public static void main(String[] args) {
        try {
            var mapper = new ObjectMapper().registerModule(new BlackbirdModule());
            var loader = new TestLoader(BlackbirdReproducer.class.getClassLoader());
            var clazz = Class.forName("test.BlackbirdReproducer$Data", true, loader);
            var constructor = clazz.getConstructor(int.class);
            var data = constructor.newInstance(42);
            System.out.println(mapper.writeValueAsString(data));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


    public static class TestLoader extends ClassLoader {
        /**
         *    The following class was compiled with javac to
         *    produce the bytecode contained in the below array
         *
         *    public static class Data {
         *         private int field;
         *
         *         public Data(int field) {
         *             this.field = field;
         *         }
         *
         *         public int getField() {
         *             return field;
         *         }
         *
         *         public void setField(int field) {
         *             this.field = field;
         *         }
         *     }
         *
         */
        private static int[] data = new int[]{
                0xCA, 0xFE, 0xBA, 0xBE, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x1D, 0x0A, 0x00, 0x02, 0x00, 0x03, 0x07, 0x00, 0x04, 0x0C, 0x00, 0x05, 0x00, 0x06, 0x01, 0x00, 0x10,
                0x6A, 0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67, 0x2F, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x01, 0x00, 0x06, 0x3C, 0x69, 0x6E, 0x69, 0x74, 0x3E, 0x01,
                0x00, 0x03, 0x28, 0x29, 0x56, 0x09, 0x00, 0x08, 0x00, 0x09, 0x07, 0x00, 0x0A, 0x0C, 0x00, 0x0B, 0x00, 0x0C, 0x01, 0x00, 0x1D, 0x74, 0x65, 0x73, 0x74, 0x2F,
                0x42, 0x6C, 0x61, 0x63, 0x6B, 0x62, 0x69, 0x72, 0x64, 0x52, 0x65, 0x70, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x65, 0x72, 0x24, 0x44, 0x61, 0x74, 0x61, 0x01, 0x00,
                0x05, 0x66, 0x69, 0x65, 0x6C, 0x64, 0x01, 0x00, 0x01, 0x49, 0x01, 0x00, 0x04, 0x28, 0x49, 0x29, 0x56, 0x01, 0x00, 0x04, 0x43, 0x6F, 0x64, 0x65, 0x01, 0x00,
                0x0F, 0x4C, 0x69, 0x6E, 0x65, 0x4E, 0x75, 0x6D, 0x62, 0x65, 0x72, 0x54, 0x61, 0x62, 0x6C, 0x65, 0x01, 0x00, 0x12, 0x4C, 0x6F, 0x63, 0x61, 0x6C, 0x56, 0x61,
                0x72, 0x69, 0x61, 0x62, 0x6C, 0x65, 0x54, 0x61, 0x62, 0x6C, 0x65, 0x01, 0x00, 0x04, 0x74, 0x68, 0x69, 0x73, 0x01, 0x00, 0x1F, 0x4C, 0x74, 0x65, 0x73, 0x74,
                0x2F, 0x42, 0x6C, 0x61, 0x63, 0x6B, 0x62, 0x69, 0x72, 0x64, 0x52, 0x65, 0x70, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x65, 0x72, 0x24, 0x44, 0x61, 0x74, 0x61, 0x3B,
                0x01, 0x00, 0x08, 0x67, 0x65, 0x74, 0x46, 0x69, 0x65, 0x6C, 0x64, 0x01, 0x00, 0x03, 0x28, 0x29, 0x49, 0x01, 0x00, 0x08, 0x73, 0x65, 0x74, 0x46, 0x69, 0x65,
                0x6C, 0x64, 0x01, 0x00, 0x0A, 0x53, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6C, 0x65, 0x01, 0x00, 0x18, 0x42, 0x6C, 0x61, 0x63, 0x6B, 0x62, 0x69, 0x72,
                0x64, 0x52, 0x65, 0x70, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x65, 0x72, 0x2E, 0x6A, 0x61, 0x76, 0x61, 0x01, 0x00, 0x08, 0x4E, 0x65, 0x73, 0x74, 0x48, 0x6F, 0x73,
                0x74, 0x07, 0x00, 0x1A, 0x01, 0x00, 0x18, 0x74, 0x65, 0x73, 0x74, 0x2F, 0x42, 0x6C, 0x61, 0x63, 0x6B, 0x62, 0x69, 0x72, 0x64, 0x52, 0x65, 0x70, 0x72, 0x6F,
                0x64, 0x75, 0x63, 0x65, 0x72, 0x01, 0x00, 0x0C, 0x49, 0x6E, 0x6E, 0x65, 0x72, 0x43, 0x6C, 0x61, 0x73, 0x73, 0x65, 0x73, 0x01, 0x00, 0x04, 0x44, 0x61, 0x74,
                0x61, 0x00, 0x21, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x0B, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x05, 0x00,
                0x0D, 0x00, 0x01, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x46, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0A, 0x2A, 0xB7, 0x00, 0x01, 0x2A, 0x1B, 0xB5, 0x00, 0x07,
                0xB1, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x03, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x09, 0x00, 0x19, 0x00,
                0x10, 0x00, 0x00, 0x00, 0x16, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x11, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x0B, 0x00, 0x0C, 0x00,
                0x01, 0x00, 0x01, 0x00, 0x13, 0x00, 0x14, 0x00, 0x01, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x2F, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x2A, 0xB4, 0x00,
                0x07, 0xAC, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x10, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x01,
                0x00, 0x00, 0x00, 0x05, 0x00, 0x11, 0x00, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x15, 0x00, 0x0D, 0x00, 0x01, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x02,
                0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x2A, 0x1B, 0xB5, 0x00, 0x07, 0xB1, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x02, 0x00, 0x00,
                0x00, 0x20, 0x00, 0x05, 0x00, 0x21, 0x00, 0x10, 0x00, 0x00, 0x00, 0x16, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x11, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x06, 0x00, 0x0B, 0x00, 0x0C, 0x00, 0x01, 0x00, 0x03, 0x00, 0x16, 0x00, 0x00, 0x00, 0x02, 0x00, 0x17, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x19,
                0x00, 0x1B, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x01, 0x00, 0x08, 0x00, 0x19, 0x00, 0x1C, 0x00, 0x09
        };

        public TestLoader(ClassLoader parent) {
            super(parent);
        }

        protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
            synchronized (getClassLoadingLock(name)) {
                try {
                    Class<?> clazz;
                    if (name.equals("test.BlackbirdReproducer$Data")) {
                        byte[] bytes = new byte[data.length];
                        for (int i = 0; i < bytes.length; i++) {
                            bytes[i] = (byte) data[i];
                        }
                        clazz = defineClass(name, bytes, 0, bytes.length);
                    } else {
                        clazz = super.loadClass(name, resolve);
                    }
                    if (resolve) resolveClass(clazz);
                    return clazz;
                } catch (Exception e) {
                    e.printStackTrace();
                    throw new ClassNotFoundException("Unable to load class", e);
                }
            }
        }
    }
}

@stevenschlansker
Copy link
Contributor

Thank you for the test case! That should make it a lot easier to get to the bottom of this.

@stevenschlansker
Copy link
Contributor

@cowtowncoder , I am trying to add this test to jackson-modules-base, but it always passes on Java 8 because the problem is introduced with later JDK. Is there a way to write Jackson tests that run against a newer JDK to make sure to actually detect the problem or a later regression? Thanks!

@GedMarc
Copy link
Contributor

GedMarc commented Jul 18, 2021

https://github.com/FasterXML/jackson-jdk11-compat-test

@stevenschlansker
Copy link
Contributor

I'm struggling to come up with a solution here. Any attempt to get a MethodHandle.Lookup in the foreign classloader (for example via Lookup.in) seems to drop lookup privileges necessary to use the LambdaMetafactory.

So far the only solution I have found is to call the custom BlackbirdModule(Supplier<MethodHandles.Lookup>) constructor (or the more general Function-accepting constructor), providing a MethodHandles.lookup() done by a class in the target classloader back to the outside classloading world.

This at least does make it work (as verified by passing the test above) but is not the easiest "end user experience".
I will continue investigating, and maybe post on core-libs-dev asking for help if I cannot make forward progress...

@cowtowncoder
Copy link
Member

Yeah, compat test would be the place, although I'd need to find time to port that over to Github actions from Travis (trivial to do I know but have been too busy lately).

@stevenschlansker
Copy link
Contributor

I made some progress, although the solution I'm looking at right now is a bit crazy.
Instead of requiring the user to give us a Lookup from the target classloader, we can instead use our not-quite-privileged-enough Lookup to defineClass an accessor class which returns a Lookup from inside the target classloader.
I'll toy with it a bit more and verify there's no better way to do this before writing up a PR.

@KENNYSOFT
Copy link

KENNYSOFT commented Sep 23, 2021

Doesn't work on Java 17 also, with Jackson 2.12.4 (via Spring Boot 2.5.4)

Similar LambdaConversionException but little bit different message.

Stack trace

java.lang.invoke.LambdaConversionException: Invalid caller: [MASKED].XxxResponse
at java.base/java.lang.invoke.AbstractValidatingLambdaMetafactory.(AbstractValidatingLambdaMetafactory.java:123)
at java.base/java.lang.invoke.InnerClassLambdaMetafactory.(InnerClassLambdaMetafactory.java:175)
at java.base/java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:336)
at com.fasterxml.jackson.module.blackbird.ser.BBSerializerModifier.createProperty(BBSerializerModifier.java:151)
at com.fasterxml.jackson.module.blackbird.ser.BBSerializerModifier.lambda$findProperties$0(BBSerializerModifier.java:64)
at com.fasterxml.jackson.module.blackbird.util.Unchecked.lambda$runnable$0(Unchecked.java:31)
at com.fasterxml.jackson.module.blackbird.ser.BBSerializerModifier.findProperties(BBSerializerModifier.java:65)
at com.fasterxml.jackson.module.blackbird.ser.BBSerializerModifier.changeProperties(BBSerializerModifier.java:49)
at com.fasterxml.jackson.databind.ser.BeanSerializerFactory.constructBeanOrAddOnSerializer(BeanSerializerFactory.java:407)
at com.fasterxml.jackson.databind.ser.BeanSerializerFactory.findBeanOrAddOnSerializer(BeanSerializerFactory.java:290)
at com.fasterxml.jackson.databind.ser.BeanSerializerFactory._createSerializer2(BeanSerializerFactory.java:235)
at com.fasterxml.jackson.databind.ser.BeanSerializerFactory.createSerializer(BeanSerializerFactory.java:169)
at com.fasterxml.jackson.databind.SerializerProvider._createUntypedSerializer(SerializerProvider.java:1473)
at com.fasterxml.jackson.databind.SerializerProvider._createAndCacheUntypedSerializer(SerializerProvider.java:1441)
at com.fasterxml.jackson.databind.SerializerProvider.findContentValueSerializer(SerializerProvider.java:723)
at com.fasterxml.jackson.databind.ser.std.AsArraySerializerBase.createContextual(AsArraySerializerBase.java:208)
at com.fasterxml.jackson.databind.SerializerProvider.handleSecondaryContextualization(SerializerProvider.java:1089)
at com.fasterxml.jackson.databind.SerializerProvider.findValueSerializer(SerializerProvider.java:571)
at com.fasterxml.jackson.databind.SerializerProvider.findTypedValueSerializer(SerializerProvider.java:843)
at com.fasterxml.jackson.databind.ObjectWriter$Prefetch.forRootType(ObjectWriter.java:1477)
at com.fasterxml.jackson.databind.ObjectWriter.forType(ObjectWriter.java:422)
at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.writeInternal(AbstractJackson2HttpMessageConverter.java:447)
at org.springframework.http.converter.AbstractGenericHttpMessageConverter.write(AbstractGenericHttpMessageConverter.java:104)
at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:290)
at org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor.handleReturnValue(HttpEntityMethodProcessor.java:219)
at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:78)
at org.springframework.hateoas.server.mvc.RepresentationModelProcessorHandlerMethodReturnValueHandler.handleReturnValue(RepresentationModelProcessorHandlerMethodReturnValueHandler.java:108)
at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:78)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:124)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1064)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:497)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:584)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
at [MASKED].doFilter([MASKED].java:75)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:117)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.SendErrorPageHandler.handleRequest(SendErrorPageHandler.java:52)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.SessionRestoringHandler.handleRequest(SessionRestoringHandler.java:119)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:280)
at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:79)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:134)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:131)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:260)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:79)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:100)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:387)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:852)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2019)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1558)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1449)
at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1280)
at java.base/java.lang.Thread.run(Thread.java:833)

@dkubicki
Copy link

We got a similar problem (Blackbird not work for us):

  • Jackson 2.12.5
  • Java 17

l.allegro.cbs.api.cbsapi.clients.allegroLokalnie.AllegroLokalnieServiceException: An error occurred when creating request to allegro lokalnie server - Unable to make field private java.lang.String java.lang.Throwable.detailMessage accessible: module java.base does not "opens java.lang" to unnamed module @1ea0fbbc at pl.allegro.cbs.api.cbsapi.clients.allegroLokalnie.AllegroLokalnieClient.offersStatistics(AllegroLokalnieClient.kt:94) at pl.allegro.cbs.api.cbsapi.seller.resolvers.SellerDataTypeResolver.allegroLokalnieOffers$lambda-8(SellerDataTypeResolver.kt:134) at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) at org.springframework.security.concurrent.DelegatingSecurityContextRunnable.run(DelegatingSecurityContextRunnable.java:82) at pl.allegro.tech.common.andamio.request.RequestAwareRunnable.run(RequestAwareRunnable.java:17) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private java.lang.String java.lang.Throwable.detailMessage accessible: module java.base does not "opens java.lang" to unnamed module @1ea0fbbc at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178) at java.base/java.lang.reflect.Field.setAccessible(Field.java:172) at com.fasterxml.jackson.databind.util.ClassUtil.checkAndFixAccess(ClassUtil.java:987) at com.fasterxml.jackson.databind.deser.impl.FieldProperty.fixAccess(FieldProperty.java:104) at com.fasterxml.jackson.databind.deser.BeanDeserializerBuilder._fixAccess(BeanDeserializerBuilder.java:522) at com.fasterxml.jackson.databind.deser.BeanDeserializerBuilder.build(BeanDeserializerBuilder.java:373) at com.fasterxml.jackson.module.blackbird.deser.SuperSonicDeserializerBuilder.build(SuperSonicDeserializerBuilder.java:17) at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.buildThrowableDeserializer(BeanDeserializerFactory.java:456) at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:112) at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer2(DeserializerCache.java:414) at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:349) at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:264) at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:244) at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:142) at com.fasterxml.jackson.databind.DeserializationContext.findContextualValueDeserializer(DeserializationContext.java:558) at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.createContextual(CollectionDeserializer.java:188) at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.createContextual(CollectionDeserializer.java:28) at com.fasterxml.jackson.databind.DeserializationContext.handlePrimaryContextualization(DeserializationContext.java:765) at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.resolve(BeanDeserializerBase.java:550) at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:293) at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:244) at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:142) at com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:591) at com.fasterxml.jackson.databind.ObjectMapper._findRootDeserializer(ObjectMapper.java:4733) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4594) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3548) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3516) at pl.allegro.cbs.api.cbsapi.restproxy.Response.bodyToObject(Response.java:61) at pl.allegro.cbs.api.cbsapi.clients.allegroLokalnie.AllegroLokalnieClient.offersStatistics(AllegroLokalnieClient.kt:83) ... 7 common frames omitted

stevenschlansker added a commit to stevenschlansker/jackson-modules-base that referenced this issue Jan 3, 2022
stevenschlansker added a commit to stevenschlansker/jackson-modules-base that referenced this issue Jan 4, 2022
stevenschlansker added a commit to stevenschlansker/jackson-jdk11-compat-test that referenced this issue Jan 4, 2022
stevenschlansker added a commit to stevenschlansker/jackson-modules-base that referenced this issue Jan 4, 2022
stevenschlansker added a commit to stevenschlansker/jackson-modules-base that referenced this issue Jan 4, 2022
@stevenschlansker
Copy link
Contributor

@jirkapinkas @carterkozak @Quantum64 @KENNYSOFT @dkubicki , sorry this took so long to fix, but I just posted up #162 which allows the provided test case above to pass.
If you have time could you please check that this change fixes your problem? Thanks!

stevenschlansker added a commit to stevenschlansker/jackson-modules-base that referenced this issue Jan 4, 2022
@KENNYSOFT
Copy link

@stevenschlansker Cool! Just built the SNAPSHOT of #162 in my local and tested it. It works like a charm on Java 17, with Spring Boot 2.6.2.

stevenschlansker added a commit to stevenschlansker/jackson-modules-base that referenced this issue Jan 4, 2022
@cowtowncoder cowtowncoder added this to the 2.14.0 milestone Jan 9, 2022
cowtowncoder added a commit that referenced this issue Jan 9, 2022
stevenschlansker added a commit to stevenschlansker/jackson-modules-base that referenced this issue Jan 12, 2022
cowtowncoder added a commit that referenced this issue Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blackbird Issue related to Blackbird module
Projects
None yet
8 participants