我们决定开始从Spring 2.7.0升级到Spring 3.x。首先,我升级到了Spring 3.0.x,但是由于spring bug,bean没有初始化,所以我切换到了3.1.0。我修复了所有的编译错误,将javax改为jakarta,升级了spring-security配置等等。现在,应用程序启动,但在初始化时崩溃。这是一个日志片段。
[background-preinit] Version.<clinit>:21 - HV000001: Hibernate Validator 8.0.0.Final
[main] StartupInfoLogger.logStarting:51 - Starting ContentApplication using Java 17.0.2 with PID 3564
[main] SpringApplication.logStartupProfileInfo:639 - The following 1 profile is active: "local"
[main] RepositoryConfigurationDelegate.registerRepositoriesIn:138 - Bootstrapping Spring Data JPA repositories in DEFAULT mode.
[main] RepositoryConfigurationDelegate.registerRepositoriesIn:208 - Finished Spring Data repository scanning in 550 ms. Found 37 JPA repository interfaces.
[main] TomcatWebServer.initialize:108 - Tomcat initialized with port(s): 8080 (http)
[main] ServletWebServerApplicationContext.prepareWebApplicationContext:291 - Root WebApplicationContext: initialization completed in 5214 ms
[main] Version.logVersion:44 - HHH000412: Hibernate ORM core version 6.2.2.Final
[main] Environment.<clinit>:191 - HHH000406: Using bytecode reflection optimizer
[main] BytecodeProviderInitiator.buildBytecodeProvider:53 - HHH000021: Bytecode provider name : bytebuddy
[main] DialectFactoryImpl.logSelectedDialect:93 - HHH035001: Using dialect: org.hibernate.dialect.SQLServerDialect, version: 12.0
[main] QueryEnhancerFactory.<clinit>:47 - Hibernate is in classpath; If applicable, HQL parser will be used.
ANTLR Tool version 4.10.1 used for code generation does not match the current runtime version 4.9.3
ANTLR Runtime version 4.10.1 used for parser compilation does not match the current runtime version 4.9.3
[main] TomcatStarter.onStartup:60 - Error starting Tomcat context.
错误如下
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository' defined in packagename.UserRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: null
Caused by: java.lang.ExceptionInInitializerError: null
at org.springframework.data.jpa.repository.query.HqlQueryParser.parseQuery(HqlQueryParser.java:48)
at org.springframework.data.jpa.repository.query.HqlQueryParser.parse(HqlQueryParser.java:63)
at org.springframework.data.jpa.repository.query.JpaQueryParserSupport$ParseState.lambda$new$0(JpaQueryParserSupport.java:182)
--------------------------------------------------------------------------------------------------------------------------------------
Caused by: java.lang.UnsupportedOperationException: java.io.InvalidClassException: org.antlr.v4.runtime.atn.ATN; Could not deserialize ATN with version 4 (expected 3).
at org.antlr.v4.runtime.atn.ATNDeserializer.deserialize(ATNDeserializer.java:187)
at org.springframework.data.jpa.repository.query.HqlLexer.<clinit>(HqlLexer.java:1314)
... 222 common frames omitted
Caused by: java.io.InvalidClassException: org.antlr.v4.runtime.atn.ATN; Could not deserialize ATN with version 4 (expected 3).
... 224 common frames omitted
1条答案
按热度按时间hjzp0vay1#
总是在错误日志中查找Caused by:,看起来像是需要将antlr 4-runtime jar升级到最新版本。使用mvn dependency:树检查版本,如果不是更新到最新版本