遇到个很诡异的问题,困扰了我好几天,项目运行不起来导致我无法开发下去。
问题描述:这是个Spring Boot个人项目,从环境的搭建到开发这一过程还是挺顺利的,其中遇到的问题也都解决了,也做了相应的记录,具体可以翻阅我之前的博客,可能有些问题没有记录下来,望谅解。
突然发现使用springboot内嵌的服务器时,有些麻烦的地方,就是每次更改项目中的java等文件时,都要全量打包,如果要使用增量打包的话,则必须使用第三方的应用服务器(Tomcat服务器)。就在使用外部的tomcat服务器部署的时候,就遇到了jar包冲突或找不到相应的类的异常(如,ELManager)。网上也有很多此类的解决方案,可以参考网上的。接下来我所说的是另一个问题,网上很少有这个答案。
当我用IDEA启动springboot项目时,发现报了以下异常:
2019-01-01 10:42:17.407 INFO 26196 — [ main] : Starting DemoApplication on guyuanhui with PID 26196 (E:\guyuanhui\NewGraduateProject\xiaoyiduo\test1\target\classes started by guyuanhui in E:\guyuanhui\NewGraduateProject\xiaoyiduo\test1)
2019-01-01 10:42:17.411 INFO 26196 — [ main] : No active profile set, falling back to default profiles: default
2019-01-01 10:42:17.477 INFO 26196 — [ main] ConfigServletWebServerApplicationContext : Refreshing @482cd91f: startup date [Tue Jan 01 10:42:17 CST 2019]; root of context hierarchy
2019-01-01 10:42:18.664 WARN 26196 — [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: : Error creating bean with name ‘’: Invocation of init method failed; nested exception is : javax/el/Util
2019-01-01 10:42:18.673 INFO 26196 — [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
2019-01-01 10:42:18.684 ERROR 26196 — [ main] : Application run failed
: Error creating bean with name ‘’: Invocation of init method failed; nested exception is : javax/el/Util
at (:1710) ~[spring-beans-5.0.:5.0.]
at (:583) ~[spring-beans-5.0.:5.0.]
at (:502) ~[spring-beans-5.0.:5.0.]
at $doGetBean
0
(
A
b
s
t
r
a
c
t
B
e
a
n
F
a
c
t
o
r
y
.
j
a
v
a
:
312
)
[
s
p
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g
e
I
n
t
e
r
p
o
l
a
t
o
r
F
a
c
t
o
r
y
.
j
a
v
a
:
54
)
[
s
p
r
i
n
g
−
b
o
o
t
−
2.0.0.
R
E
L
E
A
S
E
.
j
a
r
:
2.0.0.
R
E
L
E
A
S
E
]
a
t
o
r
g
.
s
p
r
i
n
g
f
r
a
m
e
w
o
r
k
.
b
o
o
t
.
c
o
n
t
e
x
t
.
p
r
o
p
e
r
t
i
e
s
.
C
o
n
f
i
g
u
r
a
t
i
o
n
P
r
o
p
e
r
t
i
e
s
J
s
r
303
V
a
l
i
d
a
t
o
r
0(:312) ~[spring-beans-5.0.:5.0.] at (:228) ~[spring-beans-5.0.:5.0.] at (:310) ~[spring-beans-5.0.:5.0.] at (:205) ~[spring-beans-5.0.:5.0.] at (:205) ~[spring-context-5.0.:5.0.] at (:709) ~[spring-context-5.0.:5.0.] at (:534) ~[spring-context-5.0.:5.0.] at (:140) ~[spring-boot-2.0.:2.0.] at (:752) [spring-boot-2.0.:2.0.] at (:388) [spring-boot-2.0.:2.0.] at (:327) [spring-boot-2.0.:2.0.] at (:1246) [spring-boot-2.0.:2.0.] at (:1234) [spring-boot-2.0.:2.0.] at (:10) [classes/:na] Caused by: : javax/el/Util at (:30) ~[tomcat-embed-el-8.5.:2.] at (:88) ~[hibernate-validator-6.0.:6.0.] at .<init>(:47) ~[hibernate-validator-6.0.:6.0.] at (:461) ~[hibernate-validator-6.0.:6.0.] at (:54) ~[spring-boot-2.0.:2.0.] at .ConfigurationPropertiesJsr303Validator
0(AbstractBeanFactory.java:312) [spring−beans−5.0.4.RELEASE.jar:5.0.4.RELEASE]atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) [spring−beans−5.0.4.RELEASE.jar:5.0.4.RELEASE]atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) [spring−beans−5.0.4.RELEASE.jar:5.0.4.RELEASE]atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:205) [spring−beans−5.0.4.RELEASE.jar:5.0.4.RELEASE]atorg.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:205) [spring−context−5.0.4.RELEASE.jar:5.0.4.RELEASE]atorg.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:709) [spring−context−5.0.4.RELEASE.jar:5.0.4.RELEASE]atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:534) [spring−context−5.0.4.RELEASE.jar:5.0.4.RELEASE]atorg.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) [spring−boot−2.0.0.RELEASE.jar:2.0.0.RELEASE]atorg.springframework.boot.SpringApplication.refresh(SpringApplication.java:752)[spring−boot−2.0.0.RELEASE.jar:2.0.0.RELEASE]atorg.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388)[spring−boot−2.0.0.RELEASE.jar:2.0.0.RELEASE]atorg.springframework.boot.SpringApplication.run(SpringApplication.java:327)[spring−boot−2.0.0.RELEASE.jar:2.0.0.RELEASE]atorg.springframework.boot.SpringApplication.run(SpringApplication.java:1246)[spring−boot−2.0.0.RELEASE.jar:2.0.0.RELEASE]atorg.springframework.boot.SpringApplication.run(SpringApplication.java:1234)[spring−boot−2.0.0.RELEASE.jar:2.0.0.RELEASE]atcom.example.demo.DemoApplication.main(DemoApplication.java:10)[classes/:na]Causedby:java.lang.IllegalAccessError:javax/el/Utilatjavax.el.ELManager.getExpressionFactory(ELManager.java:30) [tomcat−embed−el−8.5.28.jar:2.2.FR]atorg.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.buildExpressionFactory(ResourceBundleMessageInterpolator.java:88) [hibernate−validator−6.0.7.Final.jar:6.0.7.Final]atorg.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.<init>(ResourceBundleMessageInterpolator.java:47) [hibernate−validator−6.0.7.Final.jar:6.0.7.Final]atorg.hibernate.validator.internal.engine.ConfigurationImpl.getDefaultMessageInterpolator(ConfigurationImpl.java:461) [hibernate−validator−6.0.7.Final.jar:6.0.7.Final]atorg.springframework.boot.validation.MessageInterpolatorFactory.getObject(MessageInterpolatorFactory.java:54) [spring−boot−2.0.0.RELEASE.jar:2.0.0.RELEASE]atorg.springframework.boot.context.properties.ConfigurationPropertiesJsr303ValidatorDelegate.(:71) ~[spring-boot-2.0.:2.0.]
at .ConfigurationPropertiesJsr303Validator.(:43) ~[spring-boot-2.0.:2.0.]
at .ConfigurationPropertiesJsr303Validator.getIfJsr303Present(:64) ~[spring-boot-2.0.:2.0.]
at .(:69) ~[spring-boot-2.0.:2.0.]
at (:78) ~[spring-boot-2.0.:2.0.]
at (:1769) ~[spring-beans-5.0.:5.0.]
at (:1706) ~[spring-beans-5.0.:5.0.]
… 16 common frames omitted
令我很诧异的是,我IDEA上的代码都没有改动过,我处理的都是外部tomcat的jar包的问题。为什么在IDEA上会突然跑不起来了呢,之前还是可以正常启动的啊!为了解决这个问题,各种方式都使用过了。暴力法:重装IDEA,更改系统变量中指定新的jdk和IDEA下的maven,重新拉取最新版本的项目,更换内嵌的Tomcat版本,再运行,还是这个异常。
问题排查:尝试在另一台电脑上运行此项目,发现可以正常跑起来!可见项目源代码是没有问题的。回到本机,创建了个springboot的demo,发现还是这个问题。所以十分肯定,问题就出在环境上。
最终解决方案。启动项目,发觉到控制台输出的第一行的jdk路径不对,还是原先的。我明明安装了新的jdk并且在系统变量也配置了啊。后来重新引入新的jdk,最后成功跑起来了。可见,问题就出现在jdk身上。
出错原因:为了解决外部tomcat部署springboot项目的问题,根据网上提供的方案,在替换相关的jar包时,可能不小心将jdk中的jar包替换了。所以导致了该异常。除了这个,我找不到其他的原因了,因为之前都是好好的。
总结:为了解决一个小问题,参考了网上的解决方案而引出了其他难以解决的bug。这时可能会考虑极端的解决方法,而在采用极端的方法时,需要检验每一步是否准确无误了,否则后面就不会再回头考虑刚才的极端方法。然而这恰恰是最好的方案。