如何通过类加载器运行springboot jar

时间:2017-07-21 02:22:42

标签: java spring maven spring-boot jar

我用“mvn clean package”和“spring-boot-maven-plugin”生成了一个jar文件,
我想在其他应用程序中运行这个jar 这是我的代码:

String jarFile = "file:/Users/gavin/jars/jobdemo-0.0.1-SNAPSHOT.jar";

URL jarurl = new URL(jarFile);
URL[] urls = { jarurl };
URLClassLoader loader = new URLClassLoader(urls, Thread.currentThread().getContextClassLoader());

Class<?> main = Class.forName("org.springframework.boot.loader.JarLauncher", true, loader);
Object obj = main.newInstance();
Method mainMethod = main.getDeclaredMethod("main", new Class[] { String[].class });
String[] args = new String[0];
mainMethod.invoke(obj, new Object[] { args });

现在似乎无法在“BOOT-INF / lib”

中加载jar

以下是例外:

2017-07-21 09:54:05.987 [main] WARN  com.netflix.discovery.util.DiscoveryBuildInfo - Cannot load eureka-client manifest file; no build meta data are available
java.io.FileNotFoundException: JAR entry BOOT-INF/lib/eureka-client-1.4.11.jar!/META-INF/MANIFEST.MF not found in /Users/gavin/jars/jobdemo-0.0.1-SNAPSHOT.jar
    at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:142) ~[?:1.8.0_112]
    at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:150) ~[?:1.8.0_112]
    at java.net.URL.openStream(URL.java:1045) ~[?:1.8.0_112]
    at com.netflix.discovery.util.DiscoveryBuildInfo.loadManifest(DiscoveryBuildInfo.java:55) ~[    eureka-client-1.4.11.jar!/:1.4.11]
    at com.netflix.discovery.util.DiscoveryBuildInfo.<init>(DiscoveryBuildInfo.java:29) [    eureka-client-1.4.11.jar!/:1.4.11]
    at com.netflix.discovery.util.DiscoveryBuildInfo.<clinit>(DiscoveryBuildInfo.java:20) [    eureka-client-1.4.11.jar!/:1.4.11]
    at com.netflix.discovery.shared.transport.jersey.EurekaJerseyClientImpl$EurekaJerseyClientBuilder$MyDefaultApac    heHttpClient4Config.<init>(EurekaJerseyClientImpl.java:198) [eureka-client-1.4.11.jar!/:1.4.11]
    at com.netflix.discovery.shared.transport.jersey.EurekaJerseyClientImpl$EurekaJerseyClientBuilder.build(    EurekaJerseyClientImpl.java:166) [eureka-client-1.4.11.jar!/:1.4.11]
    at com.netflix.discovery.shared.transport.jersey.JerseyEurekaHttpClientFactory$JerseyEurekaHttpClientFactoryBui    lder.buildLegacy(JerseyEurekaHttpClientFactory.java:205) [eureka-client-1.4.11.jar!/:1.4.11]
    at com.netflix.discovery.shared.transport.jersey.JerseyEurekaHttpClientFactory$JerseyEurekaHttpClientFactoryBui    lder.build(JerseyEurekaHttpClientFactory.java:186) [eureka-client-1.4.11.jar!/:1.4.11]
    at com.netflix.discovery.shared.transport.jersey.JerseyEurekaHttpClientFactory.create(    JerseyEurekaHttpClientFactory.java:143) [eureka-client-1.4.11.jar!/:1.4.11]
    at com.netflix.discovery.shared.transport.jersey.TransportClientFactories.newTransportClientFactory(    TransportClientFactories.java:49) [eureka-client-1.4.11.jar!/:1.4.11]
    at com.netflix.discovery.DiscoveryClient.scheduleServerEndpointTask(DiscoveryClient.java:477) [    eureka-client-1.4.11.jar!/:1.4.11]
    at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:428) [eureka-client-1.4.11.jar!/:1.4.11]
    at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:304) [eureka-client-1.4.11.jar!/:1.4.11]
    at org.springframework.cloud.netflix.eureka.CloudEurekaClient.<init>(CloudEurekaClient.java:51) [    spring-cloud-netflix-eureka-client-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    at     org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$EurekaClientConfiguration.eurekaClient(    EurekaClientAutoConfiguration.java:160) [spring-cloud-netflix-eureka-client-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$EurekaClientConfiguration$$EnhancerBy    SpringCGLIB$$4845ca54.CGLIB$eurekaClient$0(<generated>) [    spring-cloud-netflix-eureka-client-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$EurekaClientConfiguration$$EnhancerBy    SpringCGLIB$$4845ca54$$FastClassBySpringCGLIB$$50dbc0a3.invoke(<generated>) [    spring-cloud-netflix-eureka-client-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) [    spring-core-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(    ConfigurationClassEnhancer.java:358) [spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$EurekaClientConfiguration$$EnhancerBy    SpringCGLIB$$4845ca54.eurekaClient(<generated>) [    spring-cloud-netflix-eureka-client-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_112]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_112]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_112]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_112]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(    SimpleInstantiationStrategy.java:162) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(    ConstructorResolver.java:588) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(    AbstractAutowireCapableBeanFactory.java:1173) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(    AbstractAutowireCapableBeanFactory.java:1067) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(    AbstractAutowireCapableBeanFactory.java:513) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(    AbstractAutowireCapableBeanFactory.java:483) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) [    spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(    DefaultSingletonBeanRegistry.java:230) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) [    spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) [    spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(    DependencyDescriptor.java:208) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(    DefaultListableBeanFactory.java:1138) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(    DefaultListableBeanFactory.java:1066) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(    ConstructorResolver.java:835) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(    ConstructorResolver.java:741) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(    ConstructorResolver.java:467) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(    AbstractAutowireCapableBeanFactory.java:1173) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(    AbstractAutowireCapableBeanFactory.java:1067) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(    AbstractAutowireCapableBeanFactory.java:513) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(    AbstractAutowireCapableBeanFactory.java:483) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) [    spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(    DefaultSingletonBeanRegistry.java:230) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) [    spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) [    spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(    DependencyDescriptor.java:208) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(    DefaultListableBeanFactory.java:1138) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(    DefaultListableBeanFactory.java:1066) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at     org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(    AutowiredAnnotationBeanPostProcessor.java:585) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) [    spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(    AutowiredAnnotationBeanPostProcessor.java:366) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(    AbstractAutowireCapableBeanFactory.java:1264) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(    AbstractAutowireCapableBeanFactory.java:553) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
...

和另一个例外:

2017-07-21 09:54:27.797 [main] WARN  org.springframework.context.annotation.AnnotationConfigApplicationContext -     Exception encountered during context initialization - cancelling refresh attempt:     org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for     configuration class [com.yyxk.executor.Excutor]; nested exception is java.lang.IllegalStateException: Could not     evaluate condition on     org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$EmbeddedDatabaseConfiguration due to org/    springframework/dao/DataAccessException not found. Make sure your own configuration does not rely on that class.     This can also happen if you are @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in     the default package by mistake)
2017-07-21 09:54:27.798 [main] ERROR org.springframework.beans.factory.support.DefaultListableBeanFactory -     Destroy method on bean with name 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory'     threw an exception
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting     events via the context: org.springframework.context.annotation.AnnotationConfigApplicationContext@cb0f763: startup     date [Fri Jul 21 09:54:27 CST 2017]; parent:     org.springframework.context.annotation.AnnotationConfigApplicationContext@43f02ef2
    at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(    AbstractApplicationContext.java:404) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(    ApplicationListenerDetector.java:97) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253) ~[    spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(    DefaultSingletonBeanRegistry.java:578) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(    DefaultSingletonBeanRegistry.java:554) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(    DefaultListableBeanFactory.java:961) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(    DefaultSingletonBeanRegistry.java:523) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(    DefaultListableBeanFactory.java:968) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.destroyBeans(    AbstractApplicationContext.java:1033) [spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:555)     [spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762) [    spring-boot-1.4.5.RELEASE.jar:1.4.5.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:372) [    spring-boot-1.4.5.RELEASE.jar:1.4.5.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [    spring-boot-1.4.5.RELEASE.jar:1.4.5.RELEASE]
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134) [    spring-boot-1.4.5.RELEASE.jar:1.4.5.RELEASE]
    at com.yyxk.jobdemo.App.main(App.java:17) [classes!/:0.0.1-SNAPSHOT]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_112]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_112]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_112]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_112]
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [    jobdemo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [    jobdemo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [    jobdemo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [    jobdemo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_112]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_112]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_112]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_112]
    at com.yyxk.executor.Excutor.boot(Excutor.java:82) [classes/:?]
    at com.yyxk.executor.Excutor.main(Excutor.java:29) [classes/:?]
2017-07-21 09:54:27.811 [main] ERROR org.springframework.boot.SpringApplication - Application startup failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for     configuration class [com.yyxk.executor.Excutor]; nested exception is java.lang.IllegalStateException: Could not     evaluate condition on     org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$EmbeddedDatabaseConfiguration due to org/    springframework/dao/DataAccessException not found. Make sure your own configuration does not rely on that class.     This can also happen if you are @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in     the default package by mistake)
    at org.springframework.context.annotation.ConfigurationClassParser.processImports(    ConfigurationClassParser.java:604) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(    ConfigurationClassParser.java:538) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:184) ~[    spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(    ConfigurationClassPostProcessor.java:308) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(    ConfigurationClassPostProcessor.java:228) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProces    sors(PostProcessorRegistrationDelegate.java:270) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(    PostProcessorRegistrationDelegate.java:93) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(    AbstractApplicationContext.java:686) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524)     ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762) [    spring-boot-1.4.5.RELEASE.jar:1.4.5.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:372) [    spring-boot-1.4.5.RELEASE.jar:1.4.5.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [    spring-boot-1.4.5.RELEASE.jar:1.4.5.RELEASE]
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134) [    spring-boot-1.4.5.RELEASE.jar:1.4.5.RELEASE]
    at com.yyxk.jobdemo.App.main(App.java:17) [classes!/:0.0.1-SNAPSHOT]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_112]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_112]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_112]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_112]
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [    jobdemo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [    jobdemo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [    jobdemo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [    jobdemo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_112]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_112]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_112]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_112]
    at com.yyxk.executor.Excutor.boot(Excutor.java:82) [classes/:?]
    at com.yyxk.executor.Excutor.main(Excutor.java:29) [classes/:?]
Caused by: java.lang.IllegalStateException: Could not evaluate condition on     org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$EmbeddedDatabaseConfiguration due to org/    springframework/dao/DataAccessException not found. Make sure your own configuration does not rely on that class.     This can also happen if you are @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in     the default package by mistake)
    at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:55) ~[    spring-boot-autoconfigure-1.4.5.RELEASE.jar:1.4.5.RELEASE]
    at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:102) ~[    spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(    ConfigurationClassParser.java:216) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processMemberClasses(    ConfigurationClassParser.java:343) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(    ConfigurationClassParser.java:261) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(    ConfigurationClassParser.java:244) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processImports(    ConfigurationClassParser.java:595) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    ... 27 more
Caused by: java.lang.NoClassDefFoundError: org/springframework/dao/DataAccessException
    at org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$EmbeddedDatabaseCondition.getMatchOu    tcome(DataSourceAutoConfiguration.java:206) ~[spring-boot-autoconfigure-1.4.5.RELEASE.jar:1.4.5.RELEASE]
    at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47) ~[    spring-boot-autoconfigure-1.4.5.RELEASE.jar:1.4.5.RELEASE]
    at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:102) ~[    spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(    ConfigurationClassParser.java:216) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processMemberClasses(    ConfigurationClassParser.java:343) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(    ConfigurationClassParser.java:261) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(    ConfigurationClassParser.java:244) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processImports(    ConfigurationClassParser.java:595) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    ... 27 more
Caused by: java.lang.ClassNotFoundException: org.springframework.dao.DataAccessException
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[?:1.8.0_112]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_112]
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[?:1.8.0_112]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_112]
    at org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$EmbeddedDatabaseCondition.getMatchOu    tcome(DataSourceAutoConfiguration.java:206) ~[spring-boot-autoconfigure-1.4.5.RELEASE.jar:1.4.5.RELEASE]
    at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47) ~[    spring-boot-autoconfigure-1.4.5.RELEASE.jar:1.4.5.RELEASE]
    at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:102) ~[    spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(    ConfigurationClassParser.java:216) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processMemberClasses(    ConfigurationClassParser.java:343) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(    ConfigurationClassParser.java:261) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(    ConfigurationClassParser.java:244) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processImports(    ConfigurationClassParser.java:595) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    ... 27 more    

我真的在BOOT-INF / lib / spring-tx-4.3.7.RELEASE.jar中有org.springframework.dao.DataAccessException

有什么建议吗?

0 个答案:

没有答案