nbcio-boot项目把springboot从2.3.5.RELEASE升级到2.7.10和mybatis-plus升级到最新的3.5.3.1的问题解决记录

       考虑到原先版本比较老,今天把springboot从2.3.5.RELEASE升级到2.6.6和mybatis-plus升级到最新的3.5.3.1。

     编译出现下面的问题

nbcio-boot项目把springboot从2.3.5.RELEASE升级到2.7.10和mybatis-plus升级到最新的3.5.3.1的问题解决记录_第1张图片

用参数 -e -X clean package后打印出更多的出错日志信息

nbcio-boot项目把springboot从2.3.5.RELEASE升级到2.7.10和mybatis-plus升级到最新的3.5.3.1的问题解决记录_第2张图片

    at org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering.filterResources (DefaultMavenResourcesFiltering.java:262)
    at org.apache.maven.plugins.resources.ResourcesMojo.execute (ResourcesMojo.java:356)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.nio.charset.MalformedInputException: Input length = 1
    at java.nio.charset.CoderResult.throwException (CoderResult.java:281)
    at sun.nio.cs.StreamDecoder.implRead (StreamDecoder.java:339)
    at sun.nio.cs.StreamDecoder.read (StreamDecoder.java:178)
    at java.io.InputStreamReader.read (InputStreamReader.java:184)
    at java.io.BufferedReader.read1 (BufferedReader.java:210)
    at java.io.BufferedReader.read (BufferedReader.java:286)
    at java.io.BufferedReader.fill (BufferedReader.java:161)
    at java.io.BufferedReader.read (BufferedReader.java:182)
    at org.apache.maven.shared.filtering.BoundedReader.read (BoundedReader.java:85)
    at org.apache.maven.shared.filtering.MultiDelimiterInterpolatorFilterReaderLineEnding.read (MultiDelimiterInterpolatorFilterReaderLineEnding.java:235)
    at org.apache.maven.shared.filtering.MultiDelimiterInterpolatorFilterReaderLineEnding.read (MultiDelimiterInterpolatorFilterReaderLineEnding.java:197)
    at java.io.Reader.read (Reader.java:140)
    at org.apache.maven.shared.utils.io.IOUtil.copy (IOUtil.java:199)
    at org.apache.maven.shared.utils.io.IOUtil.copy (IOUtil.java:181)
    at org.apache.maven.shared.utils.io.FileUtils.copyFile (FileUtils.java:1908)
    at org.apache.maven.shared.filtering.DefaultMavenFileFilter.copyFile (DefaultMavenFileFilter.java:98)
    at org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering.filterResources (DefaultMavenResourcesFiltering.java:262)
    at org.apache.maven.plugins.resources.ResourcesMojo.execute (ResourcesMojo.java:356)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

 后来用maven3.9.3版本来编译也是一样的问题

nbcio-boot项目把springboot从2.3.5.RELEASE升级到2.7.10和mybatis-plus升级到最新的3.5.3.1的问题解决记录_第3张图片

从上面看应该是几个文件utf-8格式问题吧,应该还是org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources这个版本问题,那还是退回到3.1.0应该就可以了,果然parent下面的pom.xml里增加下面版本,强制用3.1就正常了

nbcio-boot项目把springboot从2.3.5.RELEASE升级到2.7.10和mybatis-plus升级到最新的3.5.3.1的问题解决记录_第4张图片

 

 之后出现一些mybatis-plus跟之前版本不兼容的情况

nbcio-boot项目把springboot从2.3.5.RELEASE升级到2.7.10和mybatis-plus升级到最新的3.5.3.1的问题解决记录_第5张图片

又出现一堆test模块的问题

nbcio-boot项目把springboot从2.3.5.RELEASE升级到2.7.10和mybatis-plus升级到最新的3.5.3.1的问题解决记录_第6张图片

 处理删除或注释掉相关代码后又出现下面问题

主要应该是这个错误信息,应该是有一个jar包需要61的java版本


Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.1.0:repackage (repackage) on project nbcio-boot-module-system: 
Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:3.1.0:repackage failed: Unable to load the mojo 'repackage' in 
the plugin 'org.springframework.boot:spring-boot-maven-plugin:3.1.0' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: 
org/springframework/boot/maven/RepackageMojo has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime 
only recognizes class file versions up to 52.0

nbcio-boot项目把springboot从2.3.5.RELEASE升级到2.7.10和mybatis-plus升级到最新的3.5.3.1的问题解决记录_第7张图片

Java编译器和版本对应关系:
Java类文件版本号与Java编译器版本存在一定的对应关系。不同的Java编译器版本会生成不同版本的类文件。

  • Java SE 1.1:版本号 45.0
  • Java SE 1.2:版本号 46.0
  • Java SE 1.3:版本号 47.0
  • Java SE 1.4:版本号 48.0
  • Java SE 5:版本号 49.0
  • Java SE 6:版本号 50.0
  • Java SE 7:版本号 51.0
  • Java SE 8:版本号 52.0
  • Java SE 9:版本号 53.0
  • Java SE 10:版本号 54.0
  • Java SE 11:版本号 55.0
  • Java SE 12:版本号 56.0
  • Java SE 13:版本号 57.0
  • Java SE 14:版本号 58.0
  • Java SE 15:版本号 59.0
  • Java SE 16:版本号 60.0
  • Java SE 17:版本号 61.0

后来发现有个jar包升级到最新需要java17,那只能降下来了

编译通过运行出现下面问题

Description:

The dependencies of some of the beans in the application context form a cycle:

jimuReportTokenService (field private org.jeecg.common.system.api.ISysBaseAPI org.jeecg.config.jimureport.JimuReportTokenService.sysBaseAPI)

| sysBaseApiImpl (field private org.jeecg.modules.system.service.ISysUserDepartService org.jeecg.modules.system.service.impl.SysBaseApiImpl.sysUserDepartService)

| sysUserDepartServiceImpl (field private org.jeecg.modules.system.service.ISysUserService org.jeecg.modules.system.service.impl.SysUserDepartServiceImpl.sysUserService)

| sysUserServiceImpl (field private org.jeecg.common.system.api.ISysBaseAPI org.jeecg.modules.system.service.impl.SysUserServiceImpl.sysBaseAPI)

Action:

Relying upon circular references is discouraged and they are prohibited by default. Update your application to remove the dependency cycle between beans. As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true.

主要是一些类实现循环引起的问题,看来2.7.10(好像2.6后应该都这样了)都禁止这样的编程了

修改好上面的这些问题后,运行出现下面问题

 

nbcio-boot项目把springboot从2.3.5.RELEASE升级到2.7.10和mybatis-plus升级到最新的3.5.3.1的问题解决记录_第8张图片

启动里去掉这个类,除非你使用mongodb

/**
* 单体启动类(采用此类启动为单体模式)
*/
@Slf4j
@SpringBootApplication(scanBasePackages = {"org.jeecg","com.nbcio"})
@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class,MongoMetricsAutoConfiguration.class})
@MapperScan("com.nbcio.modules.**.mapper")

又出现下面的错误

Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: net.sf.jsqlparser.statement.select.Join.getOnExpressions()Ljava/util/Collection;
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: net.sf.jsqlparser.statement.select.Join.getOnExpressions()Ljava/util/Collection;
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1082)
    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)

这个应该是跟mybatis-plus相关,根据system模块下的jsqlparser版本不对,所以在system模块的pom.xml增加下面的jsqlparser 4.4版本


		
		
			org.apache.logging.log4j
			log4j-api
			2.17.1
		
		
			org.apache.logging.log4j
			log4j-to-slf4j
			2.16.0
		
		
			com.github.jsqlparser
			jsqlparser
			4.4
		
		
			com.nbcio.boot
			
				nbcio-system-local-api
		

总算本地运行正常了,发布到演示系统出现下面错误:

cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ndRecoveryfileServiceImpl': 
Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with 
name 'fileDealComp': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class 
[com.nbcio.modules.estar.nd.component.FileDealComp] from ClassLoader [org.springframework.boot.loader.LaunchedURLClassLoader@21b8d17c]
2023-07-28 19:33:38.125 [main] INFO  o.s.scheduling.quartz.SchedulerFactoryBean:847 - Shutting down Quartz Scheduler

为了运行正常与安全起见,job延时3s,同时FileDealComp 进行@Lazy 延时加载,这样发布到演示系统后正常了。

但flowable流程异步任务启动好像也出下面问题:

2023-07-28 20:45:27.535 [main] INFO  o.s.boot.web.embedded.tomcat.TomcatWebServer:220 - Tomcat started on port(s): 9080 (http) with context path '/nbcio-boot'
2023-07-28 20:45:27.599 [main] WARN  o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext:591 - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException
2023-07-28 20:45:27.726 [main] INFO  o.f.j.s.impl.asyncexecutor.AbstractAsyncExecutor:165 - Shutting down the async job executor [org.flowable.spring.job.service.SpringAsyncExecutor] for engine bpmn
2023-07-28 20:45:27.727 [flowable-bpmn-acquire-timer-jobs] INFO  o.f.j.s.i.asyncexecutor.AcquireTimerJobsRunnable:131 - stopped async job due acquisition for engine bpmn
2023-07-28 20:45:27.730 [flowable-bpmn-acquire-async-jobs] INFO  o.f.j.s.i.a.AcquireAsyncJobsDueRunnable:143 - stopped async job due acquisition for engine bpmn
2023-07-28 20:45:27.731 [flowable-bpmn-reset-expired-jobs] INFO  o.f.j.s.i.asyncexecutor.ResetExpiredJobsRunnable:90 - stopped resetting expired jobs for engine bpmn
2023-07-28 20:45:27.860 [main] INFO  o.s.scheduling.quartz.SchedulerFactoryBean:847 - Shutting down Quartz Scheduler
2023-07-28 20:45:27.860 [main] INFO  org.quartz.core.QuartzScheduler:666 - Scheduler MyScheduler_$_localhost.localdomain1690548278225 shutting down.
2023-07-28 20:45:27.861 [main] INFO  org.quartz.core.QuartzScheduler:585 - Scheduler MyScheduler_$_localhost.localdomain1690548278225 paused.
2023-07-28 20:45:27.864 [main] INFO  org.quartz.core.QuartzScheduler:740 - Scheduler MyScheduler_$_localhost.localdomain1690548278225 shutdown complete.
2023-07-28 20:45:27.890 [http-nio-9080-exec-1] INFO  o.a.c.c.C.[Tomcat].[localhost].[/nbcio-boot]:173 - Initializing Spring DispatcherServlet 'dispatcherServlet'
2023-07-28 20:45:27.891 [http-nio-9080-exec-1] INFO  org.springframework.web.servlet.DispatcherServlet:525 - Initializing Servlet 'dispatcherServlet'
2023-07-28 20:45:27.908 [http-nio-9080-exec-1] ERROR org.springframework.web.servlet.DispatcherServlet:534 - Context initialization failed
org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'welcomePageHandlerMapping': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:673)
    at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1310)
    at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:378)
    at org.springframework.web.servlet.DispatcherServlet.initHandlerMappings(DispatcherServlet.java:595)
    at org.springframework.web.servlet.DispatcherServlet.initStrategies(DispatcherServlet.java:502)

       但本地编译好后上传到演示系统可以正常使用,说明跟编译相关了,删除服务器原来的文件重新编译也还是一样。

     不过后来看上面应该是跟swagger相关,在进行比较原来这部分忘记更新了,更新后正常启动了,后续有问题再修改了。

 

 

你可能感兴趣的:(java开发,jeecg-boot,nbcio-boot,spring,boot,后端,java,nbcio-boot)