关于SpringBoot启动失败问题
来源:4-2 UserProductDao的开发与测试
Robot大冰
2020-05-01 11:14:15
老师,我把V2的源码直接导入了STS,修改了所有的包名,现在是com.hbut.xxx,代码里面也全都替换了,所有的XML文件里面也都替换了,运行项目一直提示productSellDailyDao这个找不到,但我核对了确实没问题,下面是console所有的信息,你看看:
2020-05-01 11:05:25.077 [main] INFO com.hbut.o2o.O2oApplication - Starting O2oApplication on PauperGuy的Lenovo with PID 10884 (E:\o2o\target\classes started by huang in E:\o2o) 2020-05-01 11:05:25.080 [main] DEBUG com.hbut.o2o.O2oApplication - Running with Spring Boot v1.5.8.RELEASE, Spring v4.3.12.RELEASE 2020-05-01 11:05:25.081 [main] INFO com.hbut.o2o.O2oApplication - No active profile set, falling back to default profiles: default 2020-05-01 11:05:25.134 [main] INFO o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext - Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6156496: startup date [Fri May 01 11:05:25 CST 2020]; root of context hierarchy 2020-05-01 11:05:25.414 [background-preinit] INFO org.hibernate.validator.internal.util.Version - HV000001: Hibernate Validator 5.3.5.Final 2020-05-01 11:05:25.985 [main] WARN org.mybatis.spring.mapper.ClassPathMapperScanner - No MyBatis mapper was found in '[com.imooc.o2o.dao]' package. Please check your configuration. 2020-05-01 11:05:26.226 [main] WARN org.mybatis.spring.mapper.ClassPathMapperScanner - No MyBatis mapper was found in '[com.hbut.o2o]' package. Please check your configuration. 2020-05-01 11:05:26.650 [MLog-Init-Reporter] INFO com.mchange.v2.log.MLog - MLog clients using slf4j logging. 2020-05-01 11:05:27.253 [main] INFO com.mchange.v2.c3p0.C3P0Registry - Initializing c3p0-0.9.5.2 [built 08-December-2015 22:06:04 -0800; debug? true; trace: 10] 2020-05-01 11:05:28.620 [main] INFO o.s.b.c.e.tomcat.TomcatEmbeddedServletContainer - Tomcat initialized with port(s): 8081 (http) 2020-05-01 11:05:28.634 [main] INFO org.apache.catalina.core.StandardService - Starting service [Tomcat] 2020-05-01 11:05:28.635 [main] INFO org.apache.catalina.core.StandardEngine - Starting Servlet Engine: Apache Tomcat/8.5.23 2020-05-01 11:05:28.807 [localhost-startStop-1] INFO o.a.c.c.ContainerBase.[Tomcat].[localhost].[/o2o] - Initializing Spring embedded WebApplicationContext 2020-05-01 11:05:28.808 [localhost-startStop-1] INFO org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 3674 ms 2020-05-01 11:05:28.971 [localhost-startStop-1] INFO o.s.boot.web.servlet.ServletRegistrationBean - Mapping servlet: 'kaptchaServlet' to [/Kaptcha] 2020-05-01 11:05:28.973 [localhost-startStop-1] INFO o.s.boot.web.servlet.ServletRegistrationBean - Mapping servlet: 'dispatcherServlet' to [/] 2020-05-01 11:05:28.977 [localhost-startStop-1] INFO o.s.boot.web.servlet.FilterRegistrationBean - Mapping filter: 'characterEncodingFilter' to: [/*] 2020-05-01 11:05:29.032 [main] WARN o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'quartzConfiguration': Unsatisfied dependency expressed through field 'productSellDailyService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'productSellDailyServiceImpl': Unsatisfied dependency expressed through field 'productSellDailyDao'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.hbut.o2o.dao.ProductSellDailyDao' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} 2020-05-01 11:05:29.035 [main] INFO org.apache.catalina.core.StandardService - Stopping service [Tomcat] 2020-05-01 11:05:29.049 [main] INFO o.s.b.a.l.AutoConfigurationReportLoggingInitializer - Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 2020-05-01 11:05:29.151 [main] ERROR o.s.b.diagnostics.LoggingFailureAnalysisReporter - *************************** APPLICATION FAILED TO START *************************** Description: Field productSellDailyDao in com.hbut.o2o.service.impl.ProductSellDailyServiceImpl required a bean of type 'com.hbut.o2o.dao.ProductSellDailyDao' that could not be found. Action: Consider defining a bean of type 'com.hbut.o2o.dao.ProductSellDailyDao' in your configuration.
另外,项目的名字前面有个x,但是下面的所有文件都没错误,
麻烦帮我看看,谢谢老师
7回答
同学你好,如下报错提示是指链接mysql时的密码错误,问一下同学有修改源码中的数据库密码为自己的数据库密码吗?
如果没有修改一下再试试。
使用STS,也要修改Tomcat的server。
祝:学习愉快~
好帮手慕阿满
2020-05-06
同学你好,server.xml文件是指tomcat下的server.xml文件,如:
关于路径问题,同学可以参考如下的配置
建议同学根据配置文件调整一下,如:
超级管理员提示“请求失败”,问一下同学输入的用户名和密码是否正确。同学有使用MD5测试123456加密后的密文和数据库的密码一致吗?
建议同学检查一下。
祝:学习愉快~
好帮手慕阿满
2020-05-06
同学你好,问一下同学是否启动了redis,项目将会从缓存中读取数据,如果没有开启redis,会无法显示图片,无法加载数据等。
另外关于店家和管理员的密码应该是:123456,这里是使用MD5进行加密的。同学可以在utils包下的MD5类中测试一下,查看加密后的数据和数据库中存储的是否一样,如:
如果不一致,同学可以修改一下数据库中的数据。
如果我的回答解决了你的疑惑,请采纳。祝:学习愉快~
好帮手慕阿满
2020-05-06
同学你好,建议同学在如下的O2oApplication类中加上@MapperScan(value = "com.hbut.o2o.dao")注解试试。如:
另外同学现在还有什么错误,建议同学将错误再详细描述一下。
祝:学习愉快~
好帮手慕阿满
2020-05-05
同学你好,建议同学在启动类O2oApplication的类名上加上如下注解再试试:
@MapperScan(value = "com.hbut.o2o.dao")
如果我的回答解决了你的疑惑,请采纳。祝:学习愉快~
好帮手慕小班
2020-05-01
同学你好,根据同学的报错信息,分别是:
1、无法将动态项目修改为3.1的版本。
同学可以参考如下形式修改一下版本:
1)、 更改setting目录下的配置:
去掉勾选 .* resources ,点击OK按钮:
选择项目根目录下出现setting目录:
修改这个配置文件,将jst.web一项改为3.1:
2)、修改项目的facets
项目右键 -> Properties -> Project Facets,把Dynamic Web Module 一项修改为3.1:
3)、检查修改\WEB-INF\web.xml 为对应的3.1
4)、最后清理缓存,再来重新加载一下maven项目。项目右键 -> Maven -> Update Projects
2、java的编译器与当前项目的版本不匹配。
由于jdk的版本不匹配导致,同学可以检查一下自己的jdk配置,例如:
右击项目选择Build Path--? Configure.....
检查修改为自己对应的jdk。
3、一个或者多个约束没有被满足。这个问题也有可能是jdk版本不一致造成的,同学可以尝试修改后再看看。
如果我的回答解决了你的疑惑,请采纳,祝学习愉快~
好帮手慕小班
2020-05-01
同学你好,同学可以调出Problem窗口查看具体的报错信息,比如:
查看具体的报错信息有什么。
如果我的回答解决了你的疑惑,请采纳,祝学习愉快~
相似问题
回答 2
回答 2
回答 1
回答 1
回答 1