springboot启动不能加载数据库驱动Failedtodetermineasuitab。。。
1 SLF4J: Class path contains multiple SLF4J bindings.
2 SLF4J: Found binding in [jar:file:/G:/sharp/repo/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
3 SLF4J: Found binding in [jar:file:/G:/sharp/repo/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
4 SLF4J: See /codes.html#multiple_bindings for an explanation.
5 SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
6
7 . ____ _ __ _ _
8 /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
9 ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
10 \\/ ___)| |_)| | | | | || (_| | ) ) ) )
11 ' |____| .__|_| |_|_| |_\__, | / / / /
12 =========|_|==============|___/=/_/_/_/
13 :: Spring Boot :: (v2.1.0.RELEASE)
14
15 2019-01-09 15:32:12.690 INFO 5044 --- [ main] c.sharp.forward.SharpServiceApplication : Starting SharpServiceApplication on hh-PC with PID 5044 (G:\worksheet\sharp-service\target\classes started by Administrator in G:\worksheet\
16 2019-01-09 15:32:12.696 INFO 5044 --- [ main] c.sharp.forward.SharpServiceApplication : No active profile set, falling back to default profiles: default
17 log4j:WARN No appenders could be found for logger (com.alibaba.dubbomon.logger.LoggerFactory).
18 log4j:WARN Please initialize the log4j system properly.
19 log4j:WARN See /log4j/1.2/faq.html#noconfig for more info.
20 2019-01-09 15:32:14.095 INFO 5044 --- [ main] o.s.at.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
21 2019-01-09 15:32:14.113 INFO 5044 --- [ main] o.StandardService : Starting service [Tomcat]
22 2019-01-09 15:32:14.113 INFO 5044 --- [ main] org.StandardEngine : Starting Servlet Engine: Apache Tomcat/9.0.12
23 2019-01-09 15:32:14.121 INFO 5044 --- [ main] o.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.pat
24 2019-01-09 15:32:14.217 INFO 5044 --- [ main] C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
25 2019-01-09 15:32:14.218 INFO 5044 --- [ main] o.t.ContextLoader : Root WebApplicationContext: initialization completed in 1465 ms
26 2019-01-09 15:32:14.241 INFO 5044 --- [ main] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
27 2019-01-09 15:32:14.245 INFO 5044 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
28 2019-01-09 15:32:14.246 INFO 5044 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
29 2019-01-09 15:32:14.246 INFO 5044 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'formContentFilter' to: [/*]
30 2019-01-09 15:32:14.246 INFO 5044 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
31 2019-01-09 15:32:14.288 WARN 5044 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyE
32 2019-01-09 15:32:14.289 INFO 5044 --- [ main] o.StandardService : St
opping service [Tomcat]
33 2019-01-09 15:32:14.372 INFO 5044 --- [ main] ConditionEvaluationReportLoggingListener :
34
35 Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
36 2019-01-09 15:32:14.374 ERROR 5044 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
37
38 ***************************
log4j2xml配置39 APPLICATION FAILED TO START
40 ***************************
41
42 Description:
43
44 Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
45
46 Reason: Failed to determine a suitable driver class
47
48
49 Action:
50
51 Consider the following:
52 If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
53 If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
最终发现问题出在了没有将配置⽂件扫描进去,我把它排除了,我的l中资源的配置如下:
1<resources>
2<resource>
3<directory>src/main/java</directory>
4<includes>
5<include>**/*.yml</include>
6<include>**/*.properties</include>
7<include>**/*.xml</include>
8</includes>
9<filtering>false</filtering>
10</resource>
11<resource>
12<directory>${basedir}/src/main/resources</directory>
13<excludes>
14<!-- <exclude>*.properties</exclude> -->
15<!-- <exclude>application-dev.properties</exclude> -->
16</excludes>
17<includes>
18<include>**/*.yml</include>
19<include>application.properties</include>
20<include>application-${profile.active}.properties</include>
21<include>**/*.xml</include>
22</includes>
23<filtering>false</filtering>
24</resource>
25</resources>
<include>与<exclude>是⽤来圈定和排除某⼀⽂件⽬录下的⽂件是否是⼯程资源的。如果<include>与<exclude>划定的范围存在冲突时,以<exclude>划定的范围为准。⼤多数
情况下,⼈们使⽤<include>和<exclude>是为了配合<filtering>实现过滤特定⽂件的需要。例如,在⼀个⼯程中,src/main/resources⽬录下都是⼯程的资源⽂件,并不需要
<include>和<exclude>再进⾏划定。但如果我们需要对且仅对其中的jdbc.properties和mail.properties两个⽂件进⾏过滤的话,则需要借助<include>和<exclude>进⾏如下的配
置:
1<resources>
2<!-- Filter jdbc.properties & mail.properties. NOTE: We don't l,
3 let it go with spring's resource process mechanism. -->
4<resource>
5<directory>src/main/resources</directory>
6<filtering>true</filtering>
7<includes>
8<include>jdbc.properties</include>
9<include>mail.properties</include>
10</includes>
11</resource>
12<!-- Include other files as resources files. -->
13<resource>
14<directory>src/main/resources</directory>
15<filtering>false</filtering>
16<excludes>
17<exclude>jdbc.properties</exclude>
18<exclude>mail.properties</exclude>
19</excludes>
20</resource>
21</resources>
其中第⼀段<resource>配置声明:在src/main/resources⽬录下,仅jdbc.properties和mail.properties两个⽂件是资源⽂件,然后,这两个⽂件需要被过滤。⽽第⼆段<resource>配
置声明:同样在src/main/resources⽬录下,除jdbc.properties和mail.properties两个⽂件外的其他⽂件也是资源⽂件,但是它们不会被过滤。
注释掉以后,可以加载属性⽂件,就可以启动了
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论