背景
最近在搞系统安全漏洞组件修复的工作,项目是用springboot大件的,用到了很多第三方组件包,通过安全扫描软件时,报了很多组件存在安全漏洞。
于是很多组件只能硬着头皮升级,升级后,遇到了很多编译启动问题,项目启动不了了。代码编译的情况,可以修改代码,但jar包冲突引发的启动失败,只能一个一个排查。
问题1: logback和reload4j包冲突。
Exception in thread “main” java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath.
Connected to the target VM, address: ‘127.0.0.1:56951’, transport: ‘socket’
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/xx.li/.m2/repository/org/slf4j/slf4j-reload4j/1.7.36/slf4j-reload4j-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/xx.li/.m2/repository/ch/qos/logback/logback-classic/1.2.9/logback-classic-1.2.9.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Reload4jLoggerFactory]
java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.impl.Reload4jLoggerFactory loaded from file:/Users/xx.li/.m2/repository/org/slf4j/slf4j-reload4j/1.7.36/slf4j-reload4j-1.7.36.jar). If you are using WebLogic you will need to add ‘org.slf4j’ to prefer-application-packages in WEB-INF/weblogic.xml: org.slf4j.impl.Reload4jLoggerFactory
at org.springframework.util.Assert.instanceCheckFailed(Assert.java:637)
at org.springframework.util.Assert.isInstanceOf(Assert.java:537)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext(LogbackLoggingSystem.java:274)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java:99)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:191)
……
at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:137)
at cn.xx.xx.mingmou.app.biz.AppMain.main(AppMain.java:41)
Exception in thread “main” java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.impl.Reload4jLoggerFactory loaded from file:/Users/xx.li/.m2/repository/org/slf4j/slf4j-reload4j/1.7.36/slf4j-reload4j-1.7.36.jar). If you are using WebLogic you will need to add ‘org.slf4j’ to prefer-application-packages in WEB-INF/weblogic.xml: org.slf4j.impl.Reload4jLoggerFactory
at org.springframework.util.Assert.instanceCheckFailed(Assert.java:637)
at org.springframework.util.Assert.isInstanceOf(Assert.java:537)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext(LogbackLoggingSystem.java:274)
……
at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:137)
at cn.xx.xx.mingmou.app.biz.AppMain.main(AppMain.java:41)
Disconnected from the target VM, address: ‘127.0.0.1:56951’, transport: ‘socket’
Process finished with exit code 1
问题1-解决方法:排除slf4j-reload4j-1.7.36.jar 包
问题2:java.lang.NoClassDefFoundError: com/google/common/base/MoreObjects
2023-01-09 21:48:48,834 ERROR 39488 — [ main] o.springframework.boot.SpringApplication:833 : Application run failed
org.springframework.context.ApplicationContextException: Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is com.google.common.util.concurrent.ExecutionError: java.lang.NoClassDefFoundError: com/google/common/base/MoreObjects
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:184)
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:52)
问题2-解决方法:升级guava版本号到19.0版本
问题3:Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String;
问题3-解决方法:排除servlet-api:2.5 版本jar包依赖。
问题4:Caused by: java.lang.ClassNotFoundException: org.apache.tomcat.util.descriptor.tld.TldParser
2023-01-10 13:54:50,905 WARN 21794 — [localhost-startStop-1] org.apache.juli.logging.DirectJDKLog:173 : This listener must only be nested within Server elements, but is in [TomcatEmbeddedContext].
2023-01-10 13:54:50,909 INFO 21798 — [localhost-startStop-1] org.apache.juli.logging.DirectJDKLog:173 : The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [/Users/xx.li/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
2023-01-10 13:54:51,427 ERROR 22316 — [Tomcat-startStop-1] org.apache.juli.logging.DirectJDKLog:175 : A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:942)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:833)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase
S
t
a
r
t
C
h
i
l
d
.
c
a
l
l
(
C
o
n
t
a
i
n
e
r
B
a
s
e
.
j
a
v
a
:
1427
)
a
t
o
r
g
.
a
p
a
c
h
e
.
c
a
t
a
l
i
n
a
.
c
o
r
e
.
C
o
n
t
a
i
n
e
r
B
a
s
e
StartChild.call(ContainerBase.java:1427) at org.apache.catalina.core.ContainerBase
StartChild.call(ContainerBase.java:1427)atorg.apache.catalina.core.ContainerBaseStartChild.call(ContainerBase.java:1417)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
… 6 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/apache/tomcat/util/descriptor/tld/TldParser
at org.apache.jasper.servlet.TldScanner.(TldScanner.java:84)
at org.apache.jasper.servlet.JasperInitializer.newTldScanner(JasperInitializer.java:118)
at org.apache.jasper.servlet.JasperInitializer.onStartup(JasperInitializer.java:99)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5221)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
… 6 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.apache.tomcat.util.descriptor.tld.TldParser
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
… 11 common frames omitted
问题4-解决方法:添加依赖
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<version>8.5.78</version>
</dependency>
问题5:Caused by: java.lang.ClassNotFoundException: org.jboss.netty.logging.InternalLoggerFactory
Caused by: com.alibaba.dubbo.remoting.RemotingException: Failed to bind NettyServer on /10.57.241.55:20880, cause: org/jboss/netty/logging/InternalLoggerFactory
at com.alibaba.dubbo.remoting.transport.AbstractServer.(AbstractServer.java:73)
at com.alibaba.dubbo.remoting.transport.netty.NettyServer.(NettyServer.java:63)
at com.alibaba.dubbo.remoting.transport.netty.NettyTransporter.bind(NettyTransporter.java:33)
at com.alibaba.dubbo.remoting.Transporter
A
d
p
a
t
i
v
e
.
b
i
n
d
(
T
r
a
n
s
p
o
r
t
e
r
Adpative.bind(Transporter
Adpative.bind(TransporterAdpative.java)
at com.alibaba.dubbo.remoting.Transporters.bind(Transporters.java:48)
at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchanger.bind(HeaderExchanger.java:41)
at com.alibaba.dubbo.remoting.exchange.Exchangers.bind(Exchangers.java:63)
at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol.createServer(DubboProtocol.java:329)
… 29 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/jboss/netty/logging/InternalLoggerFactory
at com.alibaba.dubbo.remoting.transport.netty.NettyHelper.setNettyLoggerFactory(NettyHelper.java:31)
at com.alibaba.dubbo.remoting.transport.netty.NettyServer.doOpen(NettyServer.java:68)
at com.alibaba.dubbo.remoting.transport.AbstractServer.(AbstractServer.java:68)
… 36 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.jboss.netty.logging.InternalLoggerFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
… 39 common frames omitted
问题5-解决方法:添加io.netty:netty:3.10.0.Final 包
问题6:Exception in thread “main” java.lang.StackOverflowError
SLF4J: Found binding in [jar:file:/Users/xx.li/workspace/gitlab/xx-openapi/core/target/xx-openapi.jar!/BOOT-INF/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/xx.li/workspace/gitlab/xx-openapi/core/target/xx-openapi.jar!/BOOT-INF/lib/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Exception in thread “main” java.lang.StackOverflowError
at sun.reflect.Reflection.quickCheckMemberAccess(Reflection.java:84)
at java.lang.reflect.Method.invoke(Method.java:489)
at org.apache.logging.log4j.util.StackLocator.getCallerClass(StackLocator.java:112)
at org.apache.logging.log4j.util.StackLocator.getCallerClass(StackLocator.java:125)
at org.apache.logging.log4j.util.StackLocatorUtil.getCallerClass(StackLocatorUtil.java:55)
at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:42)
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46)
at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
问题6-解决方法:排掉log4j-to-slf4j jar包
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<exclusions>
<exclusion>
<artifactId>log4j-to-slf4j</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
</exclusions>
</dependency>
问题7:Caused by: java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath.
Caused by: java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.apache.logging.slf4j.Log4jLoggerFactory loaded from jar:file:/Users/xxx.li/workspace/gitlab/xxx-openapi/core/target/xxx-openapi.jar!/BOOT-INF/lib/log4j-slf4j-impl-2.10.0.jar!/). If you are using WebLogic you will need to add ‘org.slf4j’ to prefer-application-packages in WEB-INF/weblogic.xml: org.apache.logging.slf4j.Log4jLoggerFactory
at org.springframework.util.Assert.instanceCheckFailed(Assert.java:637)
at org.springframework.util.Assert.isInstanceOf(Assert.java:537)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext(LogbackLoggingSystem.java:274)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java:99)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:191)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:170)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:68)
at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:48)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:137)
at cn.xx.xx.openapi.app.AppMain.main(AppMain.java:45)
问题7-解决方法:排掉log4j-core、log4j-slf4j-impl包
<exclusion>
<artifactId>log4j-core</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
<exclusion>
<artifactId>log4j-slf4j-impl</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
问题8:java.lang.NoSuchMethodError: org.springframework.data.redis.repository.configuration.RedisRepositoryConfigurationExtension.registerIfNotAlreadyRegistered(Ljava/util/function/Supplier;Lorg/springframework/beans/factory/support/BeanDefinitionRegistry;Ljava/lang/String;Ljava/lang/Object;)V
java.lang.NoSuchMethodError: org.springframework.data.redis.repository.configuration.RedisRepositoryConfigurationExtension.registerIfNotAlreadyRegistered(Ljava/util/function/Supplier;Lorg/springframework/beans/factory/support/BeanDefinitionRegistry;Ljava/lang/String;Ljava/lang/Object;)V
at org.springframework.data.redis.repository.configuration.RedisRepositoryConfigurationExtension.registerBeansForRoot(RedisRepositoryConfigurationExtension.java:95)
at org.springframework.data.repository.config.RepositoryConfigurationDelegate.registerRepositoriesIn(RepositoryConfigurationDelegate.java:114)
at org.springframework.boot.autoconfigure.data.AbstractRepositoryConfigurationSourceSupport.registerBeanDefinitions(AbstractRepositoryConfigurationSourceSupport.java:60)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.lambda$loadBeanDefinitionsFromRegistrars$0(ConfigurationClassBeanDefinitionReader.java:360)
at
问题8-解决方法:spring-data-redis 依赖版本2.3.0.RELEASE 改为 2.0.5.RELEASE
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>2.3.0.RELEASE</version>
</dependency>
问题9:com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of java.lang.String
out of START_OBJECT token
at [Source: (PushbackInputStream); line: 1, column: 1]
2023-01-11 16:58:19,670 ERROR 36645 — [localhost-startStop-1] c.t.y.o.a.h.i.CallLogPrometheusHandlerImpl:92 : 初始化prometheus出错
org.springframework.web.client.RestClientException: Error while extracting response for type [class java.lang.String] and content type [application/json]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize instance of java.lang.String
out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of java.lang.String
out of START_OBJECT token
at [Source: (PushbackInputStream); line: 1, column: 1]
at org.springframework.web.client.HttpMessageConverte
问题9-解决方法:不需要处理。
原因是Prometheus服务未配置,业务启动时调用Prometheus接口查询数据,返回值为null时,调用反序列化报的错误,此处不影响业务,不需要反序列化成对象,不需要处理。
问题10:java.lang.NoClassDefFoundError: Could not initialize class org.apache.log4j.LogManager
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘bifrostUserService’: FactoryBean threw exception on object creation; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.apache.log4j.LogManager
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:101)
……
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:318)
… 56 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.log4j.LogManager
at org.apache.log4j.Logger.getLogger(Logger.java:117)
at org.I0Itec.zkclient.ZkClient.(ZkClient.java:64)
at com.alibaba.dubbo.remoting.zookeeper.zkclient.ZkclientZookeeperClient.(ZkclientZookeeperClient.java:26)
……
at com.alibaba.dubbo.rpc.protocol.ProtocolListenerWrapper.refer(ProtocolListenerWrapper.java:63)
问题10-解决方法:添加log4j依赖即可
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
问题11:Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at org.I0Itec.zkclient.ZkClient.(ZkClient.java:64)
at com.alibaba.dubbo.remoting.zookeeper.zkclient.ZkclientZookeeperClient.(ZkclientZookeeperClient.java:26)
at com.alibaba.dubbo.remoting.zookeeper.zkclient.ZkclientZookeeperTransporter.connect(ZkclientZookeeperTransporter.java:10)
at com.alibaba.dubbo.remoting.zookeeper.ZookeeperTransporter
A
d
p
a
t
i
v
e
.
c
o
n
n
e
c
t
(
Z
o
o
k
e
e
p
e
r
T
r
a
n
s
p
o
r
t
e
r
Adpative.connect(ZookeeperTransporter
Adpative.connect(ZookeeperTransporterAdpative.java)
at com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry.(ZookeeperRegistry.java:69)
at com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistryFactory.createRegistry(ZookeeperRegistryFactory.java:37)
at com.alibaba.dubbo.registry.support.AbstractRegistryFactory.getRegistry(AbstractRegistryFactory.java:94)
at com.alibaba.dubbo.registry.RegistryFactory
A
d
p
a
t
i
v
e
.
g
e
t
R
e
g
i
s
t
r
y
(
R
e
g
i
s
t
r
y
F
a
c
t
o
r
y
Adpative.getRegistry(RegistryFactory
Adpative.getRegistry(RegistryFactoryAdpative.java)
at com.alibaba.dubbo.registry.integration.RegistryProtocol.refer(RegistryProtocol.java:240)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper.refer(ProtocolFilterWrapper.java:60)
at com.alibaba.dubbo.rpc.protocol.ProtocolListenerWrapper.refer(ProtocolListenerWrapper.java:63)
at com.alibaba.dubbo.rpc.Protocol
A
d
p
a
t
i
v
e
.
r
e
f
e
r
(
P
r
o
t
o
c
o
l
Adpative.refer(Protocol
Adpative.refer(ProtocolAdpative.java)
at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:392)
at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:300)
at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:138)
at com.alibaba.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:65)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:161)
… 67 more
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
问题11-解决方法:添加以下依赖即可
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
问题12:java.lang.NoSuchMethodError: io.netty.buffer.ByteBuf.isContiguous()Z
2023-02-03 17:09:31,486 ERROR 11252582 — [nioEventLoopGroup-3-3] c.t.y.s.c.c.s.EmbedServer$EmbedHttpServerHandler:230 : >>>>>>>>>>> xxl-job provider netty_http server caught exception
java.lang.NoSuchMethodError: io.netty.buffer.ByteBuf.isContiguous()Z
at io.netty.handler.codec.ByteToMessageDecoder
1.
c
u
m
u
l
a
t
e
(
B
y
t
e
T
o
M
e
s
s
a
g
e
D
e
c
o
d
e
r
.
j
a
v
a
:
89
)
a
t
i
o
.
n
e
t
t
y
.
h
a
n
d
l
e
r
.
c
o
d
e
c
.
B
y
t
e
T
o
M
e
s
s
a
g
e
D
e
c
o
d
e
r
.
c
h
a
n
n
e
l
R
e
a
d
(
B
y
t
e
T
o
M
e
s
s
a
g
e
D
e
c
o
d
e
r
.
j
a
v
a
:
288
)
a
t
i
o
.
n
e
t
t
y
.
c
h
a
n
n
e
l
.
C
o
m
b
i
n
e
d
C
h
a
n
n
e
l
D
u
p
l
e
x
H
a
n
d
l
e
r
.
c
h
a
n
n
e
l
R
e
a
d
(
C
o
m
b
i
n
e
d
C
h
a
n
n
e
l
D
u
p
l
e
x
H
a
n
d
l
e
r
.
j
a
v
a
:
253
)
a
t
i
o
.
n
e
t
t
y
.
c
h
a
n
n
e
l
.
A
b
s
t
r
a
c
t
C
h
a
n
n
e
l
H
a
n
d
l
e
r
C
o
n
t
e
x
t
.
i
n
v
o
k
e
C
h
a
n
n
e
l
R
e
a
d
(
A
b
s
t
r
a
c
t
C
h
a
n
n
e
l
H
a
n
d
l
e
r
C
o
n
t
e
x
t
.
j
a
v
a
:
362
)
a
t
i
o
.
n
e
t
t
y
.
c
h
a
n
n
e
l
.
A
b
s
t
r
a
c
t
C
h
a
n
n
e
l
H
a
n
d
l
e
r
C
o
n
t
e
x
t
.
i
n
v
o
k
e
C
h
a
n
n
e
l
R
e
a
d
(
A
b
s
t
r
a
c
t
C
h
a
n
n
e
l
H
a
n
d
l
e
r
C
o
n
t
e
x
t
.
j
a
v
a
:
348
)
a
t
i
o
.
n
e
t
t
y
.
c
h
a
n
n
e
l
.
A
b
s
t
r
a
c
t
C
h
a
n
n
e
l
H
a
n
d
l
e
r
C
o
n
t
e
x
t
.
f
i
r
e
C
h
a
n
n
e
l
R
e
a
d
(
A
b
s
t
r
a
c
t
C
h
a
n
n
e
l
H
a
n
d
l
e
r
C
o
n
t
e
x
t
.
j
a
v
a
:
340
)
a
t
i
o
.
n
e
t
t
y
.
h
a
n
d
l
e
r
.
t
i
m
e
o
u
t
.
I
d
l
e
S
t
a
t
e
H
a
n
d
l
e
r
.
c
h
a
n
n
e
l
R
e
a
d
(
I
d
l
e
S
t
a
t
e
H
a
n
d
l
e
r
.
j
a
v
a
:
286
)
a
t
i
o
.
n
e
t
t
y
.
c
h
a
n
n
e
l
.
A
b
s
t
r
a
c
t
C
h
a
n
n
e
l
H
a
n
d
l
e
r
C
o
n
t
e
x
t
.
i
n
v
o
k
e
C
h
a
n
n
e
l
R
e
a
d
(
A
b
s
t
r
a
c
t
C
h
a
n
n
e
l
H
a
n
d
l
e
r
C
o
n
t
e
x
t
.
j
a
v
a
:
362
)
a
t
i
o
.
n
e
t
t
y
.
c
h
a
n
n
e
l
.
A
b
s
t
r
a
c
t
C
h
a
n
n
e
l
H
a
n
d
l
e
r
C
o
n
t
e
x
t
.
i
n
v
o
k
e
C
h
a
n
n
e
l
R
e
a
d
(
A
b
s
t
r
a
c
t
C
h
a
n
n
e
l
H
a
n
d
l
e
r
C
o
n
t
e
x
t
.
j
a
v
a
:
348
)
a
t
i
o
.
n
e
t
t
y
.
c
h
a
n
n
e
l
.
A
b
s
t
r
a
c
t
C
h
a
n
n
e
l
H
a
n
d
l
e
r
C
o
n
t
e
x
t
.
f
i
r
e
C
h
a
n
n
e
l
R
e
a
d
(
A
b
s
t
r
a
c
t
C
h
a
n
n
e
l
H
a
n
d
l
e
r
C
o
n
t
e
x
t
.
j
a
v
a
:
340
)
a
t
i
o
.
n
e
t
t
y
.
c
h
a
n
n
e
l
.
D
e
f
a
u
l
t
C
h
a
n
n
e
l
P
i
p
e
l
i
n
e
1.cumulate(ByteToMessageDecoder.java:89) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:288) at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) at io.netty.channel.DefaultChannelPipeline
1.cumulate(ByteToMessageDecoder.java:89)atio.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:288)atio.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253)atio.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)atio.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)atio.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)atio.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)atio.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)atio.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)atio.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)atio.netty.channel.DefaultChannelPipelineHeadContext.channelRead(DefaultChannelPipeline.java:1414)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:945)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:146)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
问题12-解决方法:将netty-* 全部jar包版本升级到4.1.86.Final 版本
原因:有部分netty-* 包升级到4.1.86.Final版本了,有部分还是4.1.22.Final。
以下是从打好的包里解压,查看到的实际版本号。
netty-3.10.6.Final.jar
netty-all-4.1.86.Final.jar
netty-buffer-4.1.22.Final.jar
netty-codec-4.1.86.Final.jar
netty-codec-dns-4.1.22.Final.jar
netty-codec-haproxy-4.1.86.Final.jar
netty-codec-http-4.1.86.Final.jar
netty-codec-http2-4.1.86.Final.jar
netty-codec-memcache-4.1.22.Final.jar
netty-codec-mqtt-4.1.22.Final.jar
netty-codec-redis-4.1.22.Final.jar
netty-codec-smtp-4.1.22.Final.jar
netty-codec-socks-4.1.22.Final.jar
netty-codec-stomp-4.1.22.Final.jar
netty-codec-xml-4.1.22.Final.jar
netty-common-4.1.86.Final.jar
netty-handler-4.1.86.Final.jar
netty-handler-proxy-4.1.22.Final.jar
netty-handler-ssl-ocsp-4.1.86.Final.jar
netty-resolver-4.1.22.Final.jar
netty-resolver-dns-4.1.22.Final.jar
netty-resolver-dns-classes-macos-4.1.86.Final.jar
netty-resolver-dns-native-macos-4.1.86.Final-osx-aarch_64.jar
netty-resolver-dns-native-macos-4.1.86.Final-osx-x86_64.jar
netty-transport-4.1.22.Final.jar
netty-transport-classes-epoll-4.1.86.Final.jar
netty-transport-classes-kqueue-4.1.86.Final.jar
netty-transport-native-epoll-4.1.22.Final-linux-x86_64.jar
netty-transport-native-epoll-4.1.86.Final-linux-aarch_64.jar
netty-transport-native-kqueue-4.1.22.Final-osx-x86_64.jar
netty-transport-native-kqueue-4.1.86.Final-osx-aarch_64.jar
netty-transport-native-unix-common-4.1.22.Final.jar
netty-transport-rxtx-4.1.22.Final.jar
netty-transport-sctp-4.1.22.Final.jar
netty-transport-udt-4.1.22.Final.jar
问题13:springBoot应用使用idea启动不成功,总是报读取不到application.properties 中的配置项。但是将jar包放到服务器,可以成功启动。
问题13-解决方法:强制设置idea VM参数,-Dspring.config.location=/data/application.properties
第一次启动成功后,去掉该配置,再次启动,就可以一直成功了。
这个问题很奇怪,一直找不到原因。可能和idea缓存什么的有关系?不太确定。