13章成功打包后,java -jar运行发生错误

来源:14-1 打包配置

慕仰0274710

2020-06-07

13章打包完毕运行失败

周老师我13章springboot server的打包并没有看到明显的失败也产生了足够大小的jar包

06/06/2020 08:08 AM 26,381,476 Chapter13-1.0-SNAPSHOT.jar

但是一运行缺失败了下面是启动失败的提示请指教该如何排查问题

C:GitworkspacemukeAutoTestChapter13 arget>java -jar Chapter13-1.0-SNAPSHOT.jar

. ____ _ __ _ _
/\ / __ _ () __ __ _ \n( ( )__ | '_ | '| | ’ / ` | \n / )| |)| | | | | || (| | ) ) ) )
’ |
| .__|| ||| |__, | / / / /
=|_|======|/=////
:: Spring Boot :: (v2.0.0.RELEASE)

2020-06-06 08:10:43.541 [main] INFO com.course.Application - Starting Application v1.0-SNAPSHOT on DESKTOP-7O1BJ32 with PID 11788 (
C:GitworkspacemukeAutoTestChapter13 argetChapter13-1.0-SNAPSHOT.jar started by guy52 in C:GitworkspacemukeAutoTestChapte
r13 arget)
2020-06-06 08:10:43.550 [main] INFO com.course.Application - No active profile set, falling back to default profiles: default
2020-06-06 08:10:43.612 [main] INFO o.s.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext - Refreshing or
g.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6283d8b8: startup date [Sat Jun 06 08:
10:43 EDT 2020]; root of context hierarchy
2020-06-06 08:10:44.648 [main] WARN org.mybatis.spring.mapper.ClassPathMapperScanner - No MyBatis mapper was found in ‘[com.course]
’ package. Please check your configuration.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (jar:file:/C:/Git/workspace/muke/AutoTest/Chapte
r13/target/Chapter13-1.0-SNAPSHOT.jar!/BOOT-INF/lib/spring-core-5.0.4.RELEASE.jar!/) to method java.lang.ClassLoader.defineClass(jav
a.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils1WARNING:Use−−illegal−access=warntoenablewarningsoffurtherillegalreflectiveaccessoperationsWARNING:Allillegalaccessoperationswillbedeniedinafuturerelease2020−06−0608:10:45.085[main]INFOo.s.context.support.PostProcessorRegistrationDelegate1 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release 2020-06-06 08:10:45.085 [main] INFO o.s.context.support.PostProcessorRegistrationDelegate1WARNING:Useillegalaccess=warntoenablewarningsoffurtherillegalreflectiveaccessoperationsWARNING:Allillegalaccessoperationswillbedeniedinafuturerelease2020060608:10:45.085[main]INFOo.s.context.support.PostProcessorRegistrationDelegateBeanPostProcessorChecker - Bean ‘org.spri
ngframework.transaction.annotation.ProxyTransactionManagementConfiguration’ of type [org.springframework.transaction.annotation.Prox
yTransactionManagementConfigurationEnhancerBySpringCGLIBEnhancerBySpringCGLIBEnhancerBySpringCGLIB4633aa36] is not eligible for getting processed by all BeanPostProcessor
s (for example: not eligible for auto-proxying)
2020-06-06 08:10:45.664 [main] INFO org.springframework.boot.web.embedded.tomcat.TomcatWebServer - Tomcat initialized with port(s):
8888 (http)
2020-06-06 08:10:45.698 [main] INFO org.apache.catalina.core.StandardService - Starting service [Tomcat]
2020-06-06 08:10:45.699 [main] INFO org.apache.catalina.core.StandardEngine - Starting Servlet Engine: Apache Tomcat/8.5.28
2020-06-06 08:10:45.709 [localhost-startStop-1] INFO org.apache.catalina.core.AprLifecycleListener - The APR based Apache Tomcat Na
tive library which allows optimal performance in production environments was not found on the java.library.path: [C:Javajdk-9.0.4\nbin;C:WindowsSunJavain;C:Windowssystem32;C:Windows;C:webdrivers;C:Python37Scripts;C:Python37;C:Windowssystem32;C:Wi
ndows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShell1.0;C:WindowsSystem32OpenSSH;C:Javajdk-9.0.4in;C:Git
cmd;C:apache-maven-3.6.3-binapache-maven-3.6.3in;C:Usersguy52AppDataLocalMicrosoftWindowsApps;;C:Program FilesJetBrains
PyCharm Community Edition 2020.1in;;C:Fiddler;.]
+++++++++继续贴++++++++++++++++++++++++++++

写回答

1回答

慕仰0274710

提问者

2020-06-07

+++++++++继续贴++++++++++++++++++++++++++++

2020-06-06 08:10:45.794 [localhost-startStop-1] INFO  org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing

 Spring embedded WebApplicationContext

2020-06-06 08:10:45.795 [localhost-startStop-1] INFO  org.springframework.web.context.ContextLoader - Root WebApplicationContext: in

itialization completed in 2183 ms

2020-06-06 08:10:45.959 [localhost-startStop-1] INFO  org.springframework.boot.web.servlet.ServletRegistrationBean - Servlet dispatc

herServlet mapped to [/]

2020-06-06 08:10:45.965 [localhost-startStop-1] INFO  org.springframework.boot.web.servlet.FilterRegistrationBean - Mapping filter:

'characterEncodingFilter' to: [/*]

2020-06-06 08:10:45.965 [localhost-startStop-1] INFO  org.springframework.boot.web.servlet.FilterRegistrationBean - Mapping filter:

'hiddenHttpMethodFilter' to: [/*]

2020-06-06 08:10:45.966 [localhost-startStop-1] INFO  org.springframework.boot.web.servlet.FilterRegistrationBean - Mapping filter:

'httpPutFormContentFilter' to: [/*]

2020-06-06 08:10:45.966 [localhost-startStop-1] INFO  org.springframework.boot.web.servlet.FilterRegistrationBean - Mapping filter:

'requestContextFilter' to: [/*]

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automat

ically registered via the SPI and manual loading of the driver class is generally unnecessary.

2020-06-06 08:10:46.170 [main] WARN  o.s.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext - Exception enc

ountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyExceptio

n: Error creating bean with name 'userManager': Unsatisfied dependency expressed through field 'template'; nested exception is org.s

pringframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionTemplate' defined in class pat

h resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Unsatisfied dependency expressed through method '

sqlSessionTemplate' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean wi

th name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: B

ean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to ins

tantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java

.lang.NoSuchMethodError: org.apache.ibatis.session.Configuration.setDefaultEnumTypeHandler(Ljava/lang/Class;)V

2020-06-06 08:10:46.172 [main] WARN  org.springframework.context.annotation.CommonAnnotationBeanPostProcessor - Invocation of destro

y method failed on bean with name 'application': java.lang.NullPointerException

2020-06-06 08:10:46.174 [main] INFO  org.apache.catalina.core.StandardService - Stopping service [Tomcat]

2020-06-06 08:10:46.196 [main] INFO  o.s.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener -


Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2020-06-06 08:10:46.199 [main] ERROR org.springframework.boot.SpringApplication - Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userManager': Unsatisfied dependenc

y expressed through field 'template'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error cr

eating bean with name 'sqlSessionTemplate' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfigur

ation.class]: Unsatisfied dependency expressed through method 'sqlSessionTemplate' parameter 0; nested exception is org.springframew

ork.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybat

is/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.

springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory metho

d 'sqlSessionFactory' threw exception; nested exception is java.lang.NoSuchMethodError: org.apache.ibatis.session.Configuration.setD

efaultEnumTypeHandler(Ljava/lang/Class;)V

        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredA

nnotationBeanPostProcessor.java:587)

        at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91)

        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnno

tationBeanPostProcessor.java:373)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFact

ory.java:1344)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFact

ory.java:582)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactor

y.java:502)

        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312)

        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228

)

        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310)

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)

        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.

java:760)

        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext

.java:868)

        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)

        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContex

t.java:140)

        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752)

        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388)

        at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)

        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246)

        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1234)

        at com.course.Application.main(Application.java:18)

        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.base/java.lang.reflect.Method.invoke(Method.java:564)

        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)

        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)

        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)

        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionTemplate' defi

ned in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Unsatisfied dependency expressed

through method 'sqlSessionTemplate' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error

creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfigu

ration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationExceptio

n: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested e

xception is java.lang.NoSuchMethodError: org.apache.ibatis.session.Configuration.setDefaultEnumTypeHandler(Ljava/lang/Class;)V

        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:729)

        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:470)


        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowi

reCapableBeanFactory.java:1250)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBe

anFactory.java:1099)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFact

ory.java:545)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactor

y.java:502)

        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312)

        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228

)

        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310)

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)

        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251)

        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:

1138)

        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:10

65)

        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredA

nnotationBeanPostProcessor.java:584)

        ... 27 common frames omitted

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in cla

ss path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method faile

d; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSes

sionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NoSuchMethodError: org.apache.ibatis

.session.Configuration.setDefaultEnumTypeHandler(Ljava/lang/Class;)V

        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:587)


        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowi

reCapableBeanFactory.java:1250)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBe

anFactory.java:1099)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFact

ory.java:545)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactor

y.java:502)

        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312)

        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228

)

        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310)

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)

        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251)

        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:

1138)

        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:10

65)

        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:815)

        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:721)

        ... 40 common frames omitted

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]

: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NoSuchMethodError: org.apache.ibatis.session.Con

figuration.setDefaultEnumTypeHandler(Ljava/lang/Class;)V

        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)

        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:579)


        ... 53 common frames omitted

Caused by: java.lang.NoSuchMethodError: org.apache.ibatis.session.Configuration.setDefaultEnumTypeHandler(Ljava/lang/Class;)V

        at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:563)

        at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:490)

        at org.mybatis.spring.SqlSessionFactoryBean.getObject(SqlSessionFactoryBean.java:632)

        at org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration.sqlSessionFactory(MybatisAutoConfiguration.java:153)

        at org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration$$EnhancerBySpringCGLIB$$7907fb66.CGLIB$sqlSessionFactory$0

(<generated>)

        at org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration$$EnhancerBySpringCGLIB$$7907fb66$$FastClassBySpringCGLIB$$

3cae8a93.invoke(<generated>)

        at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)

        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhan

cer.java:361)

        at org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration$$EnhancerBySpringCGLIB$$7907fb66.sqlSessionFactory(<genera

ted>)

        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.base/java.lang.reflect.Method.invoke(Method.java:564)

        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)

        ... 54 common frames omitted


0
0

Java接口自动化测试实战,搞定理论基础+典型应用场景

打破传统测试用例设计方法,搞懂基于TestNG的接口自动化测试技术

2086 学习 · 920 问题

查看课程