启动AuthApplication服务时报错

Blade 未结 1 1665
杨彦彬
杨彦彬 剑者 2019-11-12 14:18

一、该问题的重现步骤是什么?

  1. 启动AuthApplication服务时,报错如下:


  2. Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
    2019-11-12 13:05:01.901 ERROR 79540 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 
    
    ***************************
    APPLICATION FAILED TO START
    ***************************
    
    Description:
    
    Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
    
    Reason: Failed to determine suitable jdbc url
    
    
    Action:
    
    Consider the following:
     If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
     If you have database settings to be loaded from a particular profile you may need to activate it (the profiles dev are currently active).
    
    Disconnected from the target VM, address: '127.0.0.1:56088', transport: 'socket'
    
    Process finished with exit code 1
  3. 是我数据源没有配置对吗?但是我都配置了。

  4. 麻烦帮忙看一下,谢谢,比较着急。




1条回答
  • 2019-11-12 14:20

    用的什么版本,blade-auth的pom引入了什么新的依赖,nacos和application-dev.yml的配置是怎样的截图看看。

    你的配置呢?不给出来我咋知道,不然回答问题只能靠猜

    image.png

    作者追问:2019-11-12 14:39

    image.png


    image.png

    作者追问:2019-11-12 14:40

    没有添加任何依赖

    回答: 2019-11-12 14:40

    image.png

    作者追问:2019-11-12 14:41

    image.png



    回答: 2019-11-12 14:41

    nacos的配置也截图

    回答: 2019-11-12 14:42

    先不走nacos,把这段从nacos读取的配置改成写死的值再试试

    image.png

    作者追问:2019-11-12 14:43

    2.2.0最新的版本

    作者追问:2019-11-12 14:47

    把值写死,报下面的错误。
    2019-11-12 14:44:57.890  WARN 83144 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is java.lang.RuntimeException: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
     - with linked exception:
    [java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
    2019-11-12 14:44:57.893  INFO 83144 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
    2019-11-12 14:44:57.920  INFO 83144 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} closing ...
    2019-11-12 14:44:57.926  INFO 83144 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} closed
    2019-11-12 14:44:57.989  INFO 83144 --- [           main] ConditionEvaluationReportLoggingListener : 
    
    Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
    2019-11-12 14:44:58.013 ERROR 83144 --- [           main] o.s.boot.SpringApplication               : Application run failed
    
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is java.lang.RuntimeException: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
     - with linked exception:
    [java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
     at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:627) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE]
     at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:456) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE]
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1321) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE]
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE]
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE]
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE]
     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:307) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE]
     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:847) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE]
     at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.10.RELEASE.jar:5.1.10.RELEASE]
     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.10.RELEASE.jar:5.1.10.RELEASE]
     at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE]
     at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) ~[spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE]
     at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) ~[spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE]
     at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE]
     at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) ~[spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE]
     at org.springblade.core.launch.BladeApplication.run(BladeApplication.java:49) ~[blade-core-launch-2.2.0.RELEASE.jar:na]
     at org.springblade.auth.AuthApplication.main(AuthApplication.java:35) ~[classes/:na]
    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is java.lang.RuntimeException: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
     - with linked exception:
    [java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
     at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE]
     at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:622) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE]
     ... 21 common frames omitted
    Caused by: java.lang.RuntimeException: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
     - with linked exception:
    [java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
     at org.springframework.security.oauth2.http.converter.jaxb.AbstractJaxbMessageConverter.(AbstractJaxbMessageConverter.java:62) ~[spring-security-oauth2-2.3.5.RELEASE.jar:na]
     at org.springframework.security.oauth2.http.converter.jaxb.JaxbOAuth2ExceptionMessageConverter.(JaxbOAuth2ExceptionMessageConverter.java:21) ~[spring-security-oauth2-2.3.5.RELEASE.jar:na]
     at org.springframework.security.oauth2.provider.error.DefaultOAuth2ExceptionRenderer.geDefaultMessageConverters(DefaultOAuth2ExceptionRenderer.java:117) ~[spring-security-oauth2-2.3.5.RELEASE.jar:na]
     at org.springframework.security.oauth2.provider.error.DefaultOAuth2ExceptionRenderer.(DefaultOAuth2ExceptionRenderer.java:53) ~[spring-security-oauth2-2.3.5.RELEASE.jar:na]
     at org.springframework.security.oauth2.provider.error.AbstractOAuth2SecurityExceptionHandler.(AbstractOAuth2SecurityExceptionHandler.java:42) ~[spring-security-oauth2-2.3.5.RELEASE.jar:na]
     at org.springframework.security.oauth2.provider.error.OAuth2AccessDeniedHandler.(OAuth2AccessDeniedHandler.java:32) ~[spring-security-oauth2-2.3.5.RELEASE.jar:na]
     at org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer.(AuthorizationServerSecurityConfigurer.java:60) ~[spring-security-oauth2-2.3.5.RELEASE.jar:na]
     at org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerSecurityConfiguration.configure(AuthorizationServerSecurityConfiguration.java:74) ~[spring-security-oauth2-2.3.5.RELEASE.jar:na]
     at org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.getHttp(WebSecurityConfigurerAdapter.java:231) ~[spring-security-config-5.1.6.RELEASE.jar:5.1.6.RELEASE]
     at org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.init(WebSecurityConfigurerAdapter.java:322) ~[spring-security-config-5.1.6.RELEASE.jar:5.1.6.RELEASE]
     at org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.init(WebSecurityConfigurerAdapter.java:92) ~[spring-security-config-5.1.6.RELEASE.jar:5.1.6.RELEASE]
     at org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerSecurityConfiguration$$EnhancerBySpringCGLIB$$2a89dd96.init() ~[spring-security-oauth2-2.3.5.RELEASE.jar:na]
     at org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder.init(AbstractConfiguredSecurityBuilder.java:371) ~[spring-security-config-5.1.6.RELEASE.jar:5.1.6.RELEASE]
     at org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder.doBuild(AbstractConfiguredSecurityBuilder.java:325) ~[spring-security-config-5.1.6.RELEASE.jar:5.1.6.RELEASE]
     at org.springframework.security.config.annotation.AbstractSecurityBuilder.build(AbstractSecurityBuilder.java:41) ~[spring-security-config-5.1.6.RELEASE.jar:5.1.6.RELEASE]
     at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.springSecurityFilterChain(WebSecurityConfiguration.java:104) ~[spring-security-config-5.1.6.RELEASE.jar:5.1.6.RELEASE]
     at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$c2ad8899.CGLIB$springSecurityFilterChain$5() ~[spring-security-config-5.1.6.RELEASE.jar:5.1.6.RELEASE]
     at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$c2ad8899$$FastClassBySpringCGLIB$$fad545dd.invoke() ~[spring-security-config-5.1.6.RELEASE.jar:5.1.6.RELEASE]
     at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.1.10.RELEASE.jar:5.1.10.RELEASE]
     at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363) ~[spring-context-5.1.10.RELEASE.jar:5.1.10.RELEASE]
     at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$c2ad8899.springSecurityFilterChain() ~[spring-security-config-5.1.6.RELEASE.jar:5.1.6.RELEASE]
     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
     at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
     at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE]
     ... 22 common frames omitted
    Caused by: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
     at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:278) ~[jaxb-api-2.3.1.jar:2.3.0]
     at javax.xml.bind.ContextFinder.find(ContextFinder.java:421) ~[jaxb-api-2.3.1.jar:2.3.0]
     at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721) ~[jaxb-api-2.3.1.jar:2.3.0]
     at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662) ~[jaxb-api-2.3.1.jar:2.3.0]
     at org.springframework.security.oauth2.http.converter.jaxb.AbstractJaxbMessageConverter.(AbstractJaxbMessageConverter.java:59) ~[spring-security-oauth2-2.3.5.RELEASE.jar:na]
     ... 47 common frames omitted
    Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory
     at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) ~[na:na]
     at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
     at javax.xml.bind.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:122) ~[jaxb-api-2.3.1.jar:2.3.0]
     at javax.xml.bind.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:155) ~[jaxb-api-2.3.1.jar:2.3.0]
     at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:276) ~[jaxb-api-2.3.1.jar:2.3.0]
     ... 51 common frames omitted


    作者追问:2019-11-12 15:06

    image.png

    回答: 2019-11-12 15:09

    java11?

    作者追问:2019-11-12 15:12

    java8

    image.png

    回答: 2019-11-12 15:21

    主要问题是这个:

    Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory


    现在删掉 .m2 下面的maven依赖,然后重新导入bladex,再下载依赖。下完后执行mvn clean compile,再启动试试

    作者追问:2019-11-12 16:30

    image.png


    按照上述操作,

    删除m2仓库的jar,然后重新导入项目,执行 mvn clean compile

    就提示上面的错误。麻烦帮忙解决下,谢谢

    作者追问:2019-11-12 16:34

    image.png

    报错,缺少依赖jar

    回答: 2019-11-12 16:51

    看来maven缓存问题挺多的

    去git私服下载BladeX-Tool,本地执行mvn clean install。然后再刷新BladeX,这样依赖应该就有了

    0 讨论(0)
提交回复