求解:springboot项目打包至外部tomcat部署时启动报错(直接运行war文件没问题)

liuzhen12580 程序员  2019-05-07 10:47:42
 .   ____          _            __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.0.BUILD-SNAPSHOT)

2019-05-07 22:35:09.874 INFO 7460 --- [ost-startStop-1] c.g.excelimport.ExcelImportApplication : Starting ExcelImportApplication v0.0.1-SNAPSHOT on PC-201905010031 with PID 7460 (D:\Tomcat\apache-tomcat-8.5.29\webapps\ExcelImport-0.0.1-SNAPSHOT\WEB-INF\classes started by Administrator in D:\Tomcat\apache-tomcat-8.5.29\bin)
2019-05-07 22:35:09.880 INFO 7460 --- [ost-startStop-1] c.g.excelimport.ExcelImportApplication : No active profile set, falling back to default profiles: default
2019-05-07 22:35:09.926 INFO 7460 --- [ost-startStop-1] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2019-05-07 22:35:10.655 WARN 7460 --- [ost-startStop-1] o.m.s.mapper.ClassPathMapperScanner : No MyBatis mapper was found in '[com.glaway.excelimport.dao.mapper]' package. Please check your configuration.
2019-05-07 22:35:11.339 INFO 7460 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1413 ms
2019-05-07 22:35:11.683 WARN 7460 --- [ost-startStop-1] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'excelImportController': Unsatisfied dependency expressed through field 'excelImportService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'excelImportServiceImpl': Unsatisfied dependency expressed through field 'tableMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysTableMapper' defined in file [D:\Tomcat\apache-tomcat-8.5.29\webapps\ExcelImport-0.0.1-SNAPSHOT\WEB-INF\classes\com\glaway\excelimport\dao\SysTableMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'mybatis-org.mybatis.spring.boot.autoconfigure.MybatisProperties': Could not bind properties to 'MybatisProperties' : prefix=mybatis, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'mybatis.configuration.incomplete-result-maps[0].arg0' to org.apache.ibatis.builder.MapperBuilderAssistant
2019-05-07 22:35:11.702 INFO 7460 --- [ost-startStop-1] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-05-07 22:35:11.708 ERROR 7460 --- [ost-startStop-1] o.s.b.d.LoggingFailureAnalysisReporter :

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to bind properties under 'mybatis.configuration.incomplete-result-maps[0].arg0' to org.apache.ibatis.builder.MapperBuilderAssistant:

Reason: Failed to bind properties under 'mybatis.configuration.incomplete-result-maps[0].arg0' to org.apache.ibatis.builder.MapperBuilderAssistant

Action:

Update your application's configuration

07-May-2019 22:35:11.709 严重 [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ExcelImport-0.0.1-SNAPSHOT]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:986)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
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.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'excelImportController': Unsatisfied dependency expressed through field 'excelImportService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'excelImportServiceImpl': Unsatisfied dependency expressed through field 'tableMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysTableMapper' defined in file [D:\Tomcat\apache-tomcat-8.5.29\webapps\ExcelImport-0.0.1-SNAPSHOT\WEB-INF\classes\com\glaway\excelimport\dao\SysTableMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'mybatis-org.mybatis.spring.boot.autoconfigure.MybatisProperties': Could not bind properties to 'MybatisProperties' : prefix=mybatis, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'mybatis.configuration.incomplete-result-maps[0].arg0' to org.apache.ibatis.builder.MapperBuilderAssistant
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:626)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:116)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:385)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1416)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:868)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:782)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:404)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:319)
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:159)
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:139)
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:92)
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:171)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5204)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 10 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'excelImportServiceImpl': Unsatisfied dependency expressed through field 'tableMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysTableMapper' defined in file [D:\Tomcat\apache-tomcat-8.5.29\webapps\ExcelImport-0.0.1-SNAPSHOT\WEB-INF\classes\com\glaway\excelimport\dao\SysTableMapper.class]: Unsatisfied depende
...全文
57 点赞 收藏 6
写回复
6 条回复
liuzhen12580 2019年05月08日
引用 1 楼 getdate的回复:
这个是不是由于资源文件的位置问题?
那请问资源文件目录需要注意哪些?
回复 点赞
getdate 2019年05月08日
引用 2 楼 liuzhen12580 的回复:
[quote=引用 1 楼 getdate的回复:]这个是不是由于资源文件的位置问题?
应该不会,同一个war包使用java -jar命令运行没有问题。[/quote] 你描述的应该是有误的. 首先你确定Java -jar 后面跟的是 war包? 那应该是jar; 其次,你想把springboot 发布到另外的Tomcat的时候,所以修改jar 为 war 了对吧? 这个时候,就应该看资源文件的路径了.
回复 点赞
liuzhen12580 2019年05月08日
引用 1 楼 getdate的回复:
这个是不是由于资源文件的位置问题?
应该不会,同一个war包使用java -jar命令运行没有问题。
回复 点赞
getdate 2019年05月08日
这个是不是由于资源文件的位置问题?
回复 点赞
吃饭睡觉不准打豆豆 2019年05月08日
尝试下手动注入数据库相关的配置的bean,感觉自动配置好像出了问题
回复 点赞
吃饭睡觉不准打豆豆 2019年05月08日
尝试下手动注入数据库相关的配置的bean,感觉自动配置好像出了问题
回复 点赞
发动态
发帖子
Web 开发
创建于2007-09-28

5.2w+

社区成员

34.1w+

社区内容

Java Web 开发
社区公告
暂无公告