報錯信息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:
錯誤緣由及解決
數據庫字段和實體類字段 不一致