docker部署 包含xxljob和开启了redis分布式锁的微服务问题

Blade 已结 1 2109
3395733618
3395733618 2021-03-25 10:40

一、该问题的重现步骤是什么?

1. 一个微服务,使用了xxljob、同时全局的配置开启了redis分布式锁

2. 在开发机上启动没有问题

3.到测试环境,使用docker部署的时候出现问题,详细请看日志

4.我自己搜了一下,是因为jvm不兼容

5.Dockerfile 使用的adoptopenjdk/openjdk8-openj9:alpine-slim,我个人觉得是openj9的问题。所以改为了adoptopenjdk/openjdk8:alpine-slim

然后启动就不报错了。

6.因为本人比较菜,玩不懂jvm,所以还是请大佬们看看是啥子原因,暂时换了一个jdk就可以用了。但是这样就无法使用openj9的性能优化了。


二、你期待的结果是什么?实际看到的又是什么?

期望启动时能正常启动

三、你正在使用的是什么产品,什么版本?在什么操作系统上?

2.7.2    centos7

四、请提供详细的错误堆栈信息,这很重要。

2021-03-25 02:29:23.643  WARN 1 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during 
context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'xxlJobExecutor' defined in class path resource [com/qnmeitiyun/message/queue/config/XxlJobConfig.class]: Invocation of 
init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name
 'redisLockClient' defined in class path resource [org/springblade/core/redis/lock/BladeLockAutoConfiguration.class]: Bean 
 instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to 
 instantiate [org.springblade.core.redis.lock.RedisLockClient]: Factory method 'redisLockClient' threw exception; nested exception 
 is java.lang.VerifyError: JVMCFRE090 new bytecode cannot create arrays; class=sun/reflect/
 GeneratedSerializationConstructorAccessor55, method=newInstance([Ljava/lang/Object;)Ljava/lang/Object;, pc=0
Exception Details:
  Location:
    sun/reflect/GeneratedSerializationConstructorAccessor55.newInstance([Ljava/lang/Object;)Ljava/lang/Object; @0: JBnew
  Reason:
    Error exists in the bytecode.
  Exception Handler Table:
    bci [0, 24] => handler: 28
    bci [0, 24] => handler: 28
    bci [24, 27] => handler: 40
Related cause: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name
 'configurableEnvironmentConfiguration': Requested bean is currently in creation: Is there an unresolvable circular reference?
2021-03-25 02:29:23.651  INFO 1 --- [           main] o.s.s.c.ThreadPoolTaskScheduler          : Shutting down ExecutorService 'taskScheduler'
2021-03-25 02:29:23.660  INFO 1 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
2021-03-25 02:29:27.017  INFO 1 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} closing ...
2021-03-25 02:29:27.056  INFO 1 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} closed
2021-03-25 02:29:27.365  INFO 1 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-03-25 02:29:27.401 ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxlJobExecutor' defined in class path
 resource [com/qnmeitiyun/message/queue/config/XxlJobConfig.class]: Invocation of init method failed; nested exception is
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisLockClient' defined in class path 
  resource [org/springblade/core/redis/lock/BladeLockAutoConfiguration.class]: Bean instantiation via factory method failed; nested 
  exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springblade.core.redis.lock
  .RedisLockClient]: Factory method 'redisLockClient' threw exception; nested exception is java.lang.VerifyError: JVMCFRE090 
  new bytecode cannot create arrays; class=sun/reflect/GeneratedSerializationConstructorAccessor55, method=newInstance
  ([Ljava/lang/Object;)Ljava/lang/Object;, pc=0
Exception Details:
  Location:
    sun/reflect/GeneratedSerializationConstructorAccessor55.newInstance([Ljava/lang/Object;)Ljava/lang/Object; @0: JBnew
  Reason:
    Error exists in the bytecode.
  Exception Handler Table:
    bci [0, 24] => handler: 28
    bci [0, 24] => handler: 28
    bci [24, 27] => handler: 40
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1794)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
	at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$175/0x00000000006c84c0.getObject(Unknown Source)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:405)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
	at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140)
	at org.springblade.core.launch.BladeApplication.run(BladeApplication.java:50)
	at com.qnmeitiyun.message.queue.MessageQueueApplication.main(MessageQueueApplication.java:19)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:51)
	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisLockClient' defined in class path resource [org/springblade/core/redis/lock/BladeLockAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springblade.core.redis.lock.RedisLockClient]: Factory method 'redisLockClient' threw exception; nested exception is java.lang.VerifyError: JVMCFRE090 new bytecode cannot create arrays; class=sun/reflect/GeneratedSerializationConstructorAccessor55, method=newInstance([Ljava/lang/Object;)Ljava/lang/Object;, pc=0
Exception Details:
  Location:
    sun/reflect/GeneratedSerializationConstructorAccessor55.newInstance([Ljava/lang/Object;)Ljava/lang/Object; @0: JBnew
  Reason:
    Error exists in the bytecode.
  Exception Handler Table:
    bci [0, 24] => handler: 28
    bci [0, 24] => handler: 28
    bci [24, 27] => handler: 40
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:657)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:637)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1176)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
	at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$175/0x00000000006c84c0.getObject(Unknown Source)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1109)
	at com.xxl.job.core.executor.impl.XxlJobSpringExecutor.initJobHandlerMethodRepository(XxlJobSpringExecutor.java:82)
	at com.xxl.job.core.executor.impl.XxlJobSpringExecutor.afterPropertiesSet(XxlJobSpringExecutor.java:36)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1853)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1790)
	... 25 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springblade.core.redis.lock.RedisLockClient]: Factory method 'redisLockClient' threw exception; nested exception is java.lang.VerifyError: JVMCFRE090 new bytecode cannot create arrays; class=sun/reflect/GeneratedSerializationConstructorAccessor55, method=newInstance([Ljava/lang/Object;)Ljava/lang/Object;, pc=0
Exception Details:
  Location:
    sun/reflect/GeneratedSerializationConstructorAccessor55.newInstance([Ljava/lang/Object;)Ljava/lang/Object; @0: JBnew
  Reason:
    Error exists in the bytecode.
  Exception Handler Table:
    bci [0, 24] => handler: 28
    bci [0, 24] => handler: 28
    bci [24, 27] => handler: 40
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:652)
	... 40 common frames omitted
Caused by: java.lang.VerifyError: JVMCFRE090 new bytecode cannot create arrays; class=sun/reflect/GeneratedSerializationConstructorAccessor55, method=newInstance([Ljava/lang/Object;)Ljava/lang/Object;, pc=0
Exception Details:
  Location:
    sun/reflect/GeneratedSerializationConstructorAccessor55.newInstance([Ljava/lang/Object;)Ljava/lang/Object; @0: JBnew
  Reason:
    Error exists in the bytecode.
  Exception Handler Table:
    bci [0, 24] => handler: 28
    bci [0, 24] => handler: 28
    bci [24, 27] => handler: 40
	at sun.reflect.ClassDefiner.defineClass(Unknown Source)
	at sun.reflect.MethodAccessorGenerator$1.run(Unknown Source)
	at sun.reflect.MethodAccessorGenerator$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Unknown Source)
	at sun.reflect.MethodAccessorGenerator.generate(Unknown Source)
	at sun.reflect.MethodAccessorGenerator.generateSerializationConstructor(Unknown Source)
	at sun.reflect.ReflectionFactory.generateConstructor(Unknown Source)
	at sun.reflect.ReflectionFactory.newConstructorForSerialization(Unknown Source)
	at org.nustaq.serialization.FSTDefaultClassInstantiator.findConstructorForSerializable(FSTDefaultClassInstantiator.java:107)
	at org.nustaq.serialization.FSTClazzInfo.(FSTClazzInfo.java:137)
	at org.nustaq.serialization.FSTClazzInfoRegistry.getCLInfo(FSTClazzInfoRegistry.java:129)
	at org.nustaq.serialization.FSTClazzNameRegistry.addClassMapping(FSTClazzNameRegistry.java:98)
	at org.nustaq.serialization.FSTClazzNameRegistry.registerClassNoLookup(FSTClazzNameRegistry.java:85)
	at org.nustaq.serialization.FSTClazzNameRegistry.registerClass(FSTClazzNameRegistry.java:81)
	at org.nustaq.serialization.FSTConfiguration.addDefaultClazzes(FSTConfiguration.java:839)
	at org.nustaq.serialization.FSTConfiguration.initDefaultFstConfigurationInternal(FSTConfiguration.java:477)
	at org.nustaq.serialization.FSTConfiguration.createDefaultConfiguration(FSTConfiguration.java:472)
	at org.nustaq.serialization.FSTConfiguration.createDefaultConfiguration(FSTConfiguration.java:464)
	at org.redisson.codec.FstCodec.(FstCodec.java:182)
	at org.redisson.config.Config.(Config.java:102)
	at org.redisson.Redisson.(Redisson.java:118)
	at org.redisson.Redisson.create(Redisson.java:160)
	at org.springblade.core.redis.lock.BladeLockAutoConfiguration.redissonClient(BladeLockAutoConfiguration.java:149)
	at org.springblade.core.redis.lock.BladeLockAutoConfiguration.redisLockClient(BladeLockAutoConfiguration.java:120)
	at org.springblade.core.redis.lock.BladeLockAutoConfiguration$$EnhancerBySpringCGLIB$$630ebb6f.CGLIB$redisLockClient$0()
	at org.springblade.core.redis.lock.BladeLockAutoConfiguration$$EnhancerBySpringCGLIB$$630ebb6f$$FastClassBySpringCGLIB$$9a0198c9.invoke()
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
	at org.springblade.core.redis.lock.BladeLockAutoConfiguration$$EnhancerBySpringCGLIB$$630ebb6f.redisLockClient()
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
	... 41 common frames omitted

五、若有更多详细信息,请在下面提供。

1条回答
  •  admin
    admin (楼主)
    2021-03-25 11:20

    adoptopenjdk/openjdk8-openj9:alpine-slim 这个镜像相当于是官方最新的镜像,会实时更新,有点类似于其他的lastest版本,有时候官方也会有出问题,这个不管是jvm的报错,还是字体缺失后奔溃都有人反馈。

    如果部署时遇到问题,也许就是当时那个版本的 adoptopenjdk/openjdk8-openj9:alpine-slim 本身有问题,那我们就可以指定tag来固定使用某个稳定的版本,比如 adoptopenjdk/openjdk8-openj9:jdk8u275-b01_openj9-0.23.0-alpine-slim

    具体的tag列表可以看:https://hub.docker.com/r/adoptopenjdk/openjdk8-openj9/tags?page=1&ordering=last_updated&name=alpine-slim

    出问题的时候从里面挑选最近的几个镜像进行测试就OK了。

    另外bladex也提供了一个测试无误的版本固化,可以试一试:bladex/alpine-java:openjdk8-openj9_cn_slim

    作者追问:2021-03-25 11:20

    谢谢 ,试了4-5个,最后使用adoptopenjdk/openjdk8-openj9:jdk8u262-b10_openj9-0.21.0-alpine-slim这个镜像可以正常启动。

    0 讨论(1)
提交回复