报错信息java
jquery-1.11.3.min.js:2 Uncaught Error: Syntax error, unrecognized expression: #mnn').load('/view/banner.jsp')mysql
1 jquery-1.11.3.min.js:2 Uncaught Error: Syntax error, unrecognized expression: #mnn').load('/view/banner.jsp') 2 at Function.ga.error (jquery-1.11.3.min.js:2) 3 at ga.tokenize (jquery-1.11.3.min.js:2) 4 at ga.select (jquery-1.11.3.min.js:2) 5 at Function.ga [as find] (jquery-1.11.3.min.js:2) 6 at m.fn.init.find (jquery-1.11.3.min.js:2) 7 at new m.fn.init (jquery-1.11.3.min.js:2) 8 at m (jquery-1.11.3.min.js:2) 9 at HTMLAnchorElement.<anonymous> (bootstrap.min.js:6) 10 at HTMLDocument.dispatch (jquery-1.11.3.min.js:4) 11 at HTMLDocument.r.handle (jquery-1.11.3.min.js:4)
解决方案jquery
由于在href跳转的标签中出现了触发模态框,把这个删掉就能够了data-toggle="modal"web
报错信息 spring
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. sql
[WARN] 2019-08-14 23:24:24 Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bannerController': Unsatisfied dependency expressed through field 'bannerService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.baizhi.service.BannerService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} [INFO] 2019-08-14 23:24:24 Stopping service [Tomcat] [WARN] 2019-08-14 23:24:24 The web application [ROOT] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Object.wait(Native Method) java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143) com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43) [INFO] 2019-08-14 23:24:24 Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. [ERROR] 2019-08-14 23:24:24 *************************** APPLICATION FAILED TO START *************************** Description: Field bannerService in com.baizhi.controller.BannerController required a bean of type 'com.baizhi.service.BannerService' that could not be found. The injection point has the following annotations: - @org.springframework.beans.factory.annotation.Autowired(required=true) Action: Consider defining a bean of type 'com.baizhi.service.BannerService' in your configuration
解决方案数据库
resources配置问题:application.yml 或application.properties文件扫描不到,将配置文件所有放在resources文件夹下,官方文档也建议将配置文件放在此文件夹下,可是就是找不到个人数据库配置文件,具体缘由暂时还不明白。express
把application.yml 或application.properties文件放在src/main/java下 就能够了apache
报错信息bootstrap
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.web.multipart.MaxUploadSizeExceededException: Maximum upload size exceeded;
nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException:
The field cover exceeds its maximum permitted size of 1048576 bytes.] with root cause
解决方案
在yml文件中设置上传文件大小
spring: servlet: multipart: enabled: true max-file-size: 50MB max-request-size: 50MB
最近在项目中发现了一则报错:“org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only”。根据报错信息来看是springboot框架中的事务管理报错:事务回滚了,由于它被标记为回滚状态。
报错缘由
多层嵌套事务中,若是使用了默认的事务传播方式,当内层事务抛出异常,外层事务捕捉并正常执行完毕时,就会报出rollback-only异常。
解决方案
事务传播方式
事务传播方式 | 说明 |
---|---|
PROPAGATION_REQUIRED | 若是当前没有事务,就新建一个事务,若是已经存在一个事务中,加入到这个事务中。这是默认的传播方式 |
PROPAGATION_SUPPORTS | 支持当前事务,若是当前没有事务,就以非事务方式执行 |
PROPAGATION_MANDATORY | 使用当前的事务,若是当前没有事务,就抛出异常 |
PROPAGATION_REQUIRES_NEW | 新建事务,若是当前存在事务,把当前事务挂起 |
PROPAGATION_NOT_SUPPORTED | 以非事务方式执行操做,若是当前存在事务,就把当前事务挂起 |
PROPAGATION_NEVER | 以非事务方式执行,若是当前存在事务,则抛出异常 |
PROPAGATION_SUPPORTS | 支持当前事务,若是当前没有事务,就以非事务方式执行。 |
PROPAGATION_NESTED | 若是当前存在事务,则在嵌套事务内执行。若是当前没有事务,则执行与PROPAGATION_REQUIRED相似的操做。 |
报错信息
修改数据时,若是不改动文件,只改动其余数据,就会报如下错误信息
D:\Workspaces\IDEACode\project\src\main\webapp\image (拒绝访问。)
错误缘由以及解决
当上传文件为空时,不只须要在修改时判断该字段为空,为其设置一个null以免数据库修改该字段,还须要再上传的文件的upload方法中判断文件的原始文件名是否为空,若是为空就不作upload里面的修改操做,若是不作判断,当修改提交后执行aftersubmit就会进入upload方法执行修改。(这里upload主要是修改路径信息方便前台的展现)。
报错信息
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException:
错误缘由及解决
数据库字段和实体类字段 不一致