1:Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
由於使用的mysql版本過高,換成低版本的
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.0.4</version>
</dependency>
2:十二月 15, 2017 6:39:05 下午 org.apache.catalina.core.StandardWrapperValve invoke
嚴重: Servlet.service() for servlet [springDispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.AbstractMethodError: com.mysql.jdbc.Connection.isValid(I)Z] with root cause
java.lang.AbstractMethodError: com.mysql.jdbc.Connection.isValid(I)Z
at org.apache.commons.dbcp2.DelegatingConnection.isValid(DelegatingConnection.java:918)
at org.apache.commons.dbcp2.PoolableConnection.validate(PoolableConnection.java:283)《數據庫連接池》
at org.apache.commons.dbcp2.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:357)
at org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2307) 《數據源》
at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2290)
at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2039)
數據庫連接池和數據源配置的不對。應該選擇正確的數據庫連接池和數據源配置。不同的數據庫連接池對數據源的配置要求不同。
3:執行mysql提示:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--college
create table liyafei(name varchar(39) not null)' at line 1
因為創建表時數據庫有--college阻塞,去掉即可
4: 項目打成war,發布到tomcat,提示:FAIL - Application at context path /sp could not be started
5: unsupported major.minor varsion 52.0
需要用jdk8進行部署,高版本jdk編譯的class不能在低版本下面運行
6:tomcat關閉錯誤提示
一月 21, 2018 9:17:44 上午 org.apache.catalina.startup.Catalina stopServer
嚴重: Could not contact localhost:8005. Tomcat may not be running.
一月 21, 2018 9:17:44 上午 org.apache.catalina.startup.Catalina stopServer
嚴重: Catalina.stop:
java.net.ConnectException: 拒絕連接 (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:580)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.<init>(Socket.java:429)
at java.net.Socket.<init>(Socket.java:209)
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:499)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:343)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:430)
是因為tomcat里面有錯誤的war包,導致關閉異常。
7:List每次只能添加一個元素,中間不能隔空元素。例如:如果一個空List添加 list.add(1,"li"); ,將會拋出異常
HTTP Status 500 - Request processing failed; nested exception is java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
8:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--COMMONT ????
sql文件里面加注解時,前面兩個--要空一格才能加注解,否則提示錯誤
-- ----------------------------
-- Table structure for tb_settle_wallet
-- COMMONT 備注說明
-- ----------------------------
9:WEB-INF下面的東西在瀏覽器是不能訪問的,需要通過映射才能訪問到,WEB-INF是Java的WEB應用的安全目錄。所謂安全就是客戶端無法訪問,只有服務端可以訪問的目錄。如果想在頁面中直接訪問其中的文件,必須通過web.xml文件對要訪問的文件進行相應映射才能訪問。例如: /html/** /WEB-INF/html/
10:問題描述:打包出現,非法字符:'\ufeff" 錯誤。
解決方案:
利用notePad++打開出現錯誤的頁面,
選擇標題欄的格式—-將以UTF-8格式編碼修改成將以UTF-8 無BOM 格式編碼。
至此,問題解決。
11;提示
[ERROR] /D:/Android/workspace1/ssmFrameworkIntergrate/src/main/java/vertxTest/SpringVerticle.java:[25,30] -source 1.7 中不支持 lambda 表達式
(請使用 -source 8 或更高版本以啟用 lambda 表達式)
jdk版本過低,在pom.xml和properties>compile level中修改source為更高版本
12:創建vertx工程時,需要創建war工程,否則創建Router實例時,會提示 cannot access router, need static
13:如果有多個工程進行打包時,需要先將被依賴的工程變異maven install,將聚合工程中不需要的模塊移除。一層一層打包才行,否則會提示 compile 錯誤,pay-java-common工程can't fount
14: gradle使用build構建工程時,提示
16:22:16: Executing task 'build'...
Cause: error in opening zip file
16:22:16: Task execution finished 'build'.
是因為zip文件被損壞,下載過程中終止等。到gradle.properties 中查看引入的zip包
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
下載放入到C:\Users\lenovo\.gradle\wrapper\dists\gradle-4.0-bin\3p92xsbhik5vmig8i90n16yxc 文件中即可。
15:錯誤: 編碼GBK的不可映射字符 ,解決方法,向出現錯誤提示的模塊的build.gradle中添加
//tasks.withType(JavaCompile) {
// options.encoding = "UTF-8"
//}
或者
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
即可
16:一行末尾有多余的空格時,gradle build時會提示 u/300錯誤
17:執行
insert into 'T_PERMISSION' values (2,'pem1','a','pemission1'); 提示
Error executing INSERT statement. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''T_PERMISSION' values (2,'pem1','a','pemission1')' at line 1 - Connection: Connection: 1ms
是因為插入表時,表名不應該用' '引住。
改為
insert into T_PERMISSION values (2,'pem1','a','pemission1');
18: 執行數據庫 db.sql文件時,是從光標所在的位置開始執行。
19: 進行查詢時:http://localhost:9002/crm/services/customerService/customer/login?telephone=18888888888&password=123456 提示:
No message body writer has been found for class top.kylewang.crm.domain.Customer, ContentType: text/html
其實已經查詢到數據,但是返回內容類型不對
需要在service中修改注解@Consumes為@Produces http://www.cnblogs.com/liyafei/p/8515319.html
20: 使用Java api 連接elasticsearch集群時提示: https://elasticsearch.cn/question/1203
org.elasticsearch.client.transport.TransportClientNodesService$SimpleNodeSampler doSample
信息: [Quincy Harker] failed to get node info for {#transport#-1}{127.0.0.1}{127.0.0.1:9300}, disconnecting...
NodeDisconnectedException[[][127.0.0.1:9300][cluster:monitor/nodes/liveness] disconnected]
本次錯誤是因為 工程中引入的maven elasticsearch依賴和 安裝的elasticsearch版本不一致導致的。
21: elasticsearch 進行更新操作時提示:
java.util.concurrent.ExecutionException: RemoteTransportException[[node-1][127.0.0.1:9300][indices:data/write/update]]; nested: RemoteTransportException[[node-3][127.0.0.1:9302][indices:data/write/update[s]]]; nested: DocumentMissingException[[type][3]: document missing];
是因為更新的文檔不存在,也就是前面的index,type,id都存在時,才能更新,否則只能創建。
22: service 發布服務,
@Path("/DetailDisplayService") public interface DetailDisplayService { /** * 查詢商品根據Uid * @return */ @Path("/selectProductAndRecByUid") @GET @Produces({"application/xml", "application/json"}) //返回void用consumes List<Product> selectProductAndRecByUid(@QueryParam("uid") String uid); }
提示:
No message body writer has been found for class java.util.ArrayList, ContentType: application/xml
是因為List中的Product解析不成為xml 文件。需要在Product類上加上注解
@XmlRootElement(name="product")
提示:Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
excel.pojo.Product沒有無參數默認構造器。
需要在Product中加入無參構造函數。成功。
23:搭建elasticsearch集群報錯 。http://blog.csdn.net/qq_24879495/article/details/77718032
[2018-03-12T20:38:27,032][INFO ][o.e.d.z.ZenDiscovery ] [node-2] failed to send join request to master [{node-1}{jhJ9LI7FTES64sR9CHbl2Q}{JiV5qs3tQWmI4WfvVMEIyw}{127.0.0.1}{127.0.0.1:9300}], reason [RemoteTransportException[[node-1][127.0.0.1:9300][internal:discovery/zen/join]]; nested: IllegalArgumentException[can't add node {node-2}{jhJ9LI7FTES64sR9CHbl2Q}{S_VSvtdJRNCcGCmVOZyXTQ}{127.0.0.1}{127.0.0.1:9301}, found existing node {node-1}{jhJ9LI7FTES64sR9CHbl2Q}{JiV5qs3tQWmI4WfvVMEIyw}{127.0.0.1}{127.0.0.1:9300} with the same id but is a different node instance]; ]
復制elasticsearch之前,已經在data中產生數據,刪除即可。
24 gradle build 時提示:
Could not set unknown property 'mainClassName' for project ':shop_background' of type org.gradle.api.Project.
解決:需要添加插件。
apply plugin: 'application'
然后提示
mainClassName no value. 為應用指定一個主類
mainClassName = "com.background.SpringBootBackgrouondMainClass"
25: 控制台提示: ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
是因為 log4j的版本不對,將版本2.7 改為 2.10.0
'org.apache.logging.log4j:log4j-core:2.10.0'
錯誤消失
26:No message body writer has been found for class com.alibaba.fastjson.JSONObject, ContentType: */*
是因為通過service發布的服務,
cxf:
path: /services
servlet.init:
service-list-path: /info
jaxrs:
component-scan: true
cxf 不支持將對象直接解析
27: 提示:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
是因為發送的url又映射到了原來的路徑上。后台
@RequestMapping("/public") public String test3() { return "public"; }
28:
#{user.username} 但是從Mapper.java中傳遞的對象沒有標明為user
在Mapper.java中參數標明user即可
int save(@Param("user") User user);
34: 在做數據庫連接時要指定編碼格式,否則會提示亂碼。
spring.datasource.url = jdbc:mysql://localhost:3306/forum?useSSL=false&useUnicode=true&characterEncoding=UTF-8
35:idea打開maven工程,依賴包不添加,需要在右側的maven中點擊+ 添加工程pom.xml
36:idea中maven工程打包springboot項目,智能有一個springboot注解,要把test中的springboottest注解給去掉,才能打包成功。點擊maven工程右邊的install即可打包。
37:上傳文件出現提示 org.springframework.web.multipart.MultipartException: Current request is not a multipart request
需要在body上傳類型中選擇 form-data,key選擇File, value選擇文件
向后台傳輸數據,可以在header中添加數據。后台通過request接收
38 啟動項目提示:
Caused by: java.lang.IllegalArgumentException: 'script' must not be null or empty
因為項目啟動時,sql腳本自動執行,需要將其注釋掉。不能用--來注釋。需要用
/*
*/
來注釋
39: filezilla鏈接ftp服務器時提示:500 OOPS: vsftpd: refusing to run with writable root inside chroot ()錯誤的解決方法
當我們限定了用戶不能跳出其主目錄之后,使用該用戶登錄FTP時往往會遇到這個錯誤:
- 500 OOPS: vsftpd: refusing to run with writable root inside chroot ()
這個問題發生在最新的這是由於下面的更新造成的:
- - Add stronger checks for the configuration error of running with a writeable root directory inside a chroot(). This may bite people who carelessly turned on chroot_local_user but such is life.
從2.3.5之后,vsftpd增強了安全檢查,如果用戶被限定在了其主目錄下,則該用戶的主目錄不能再具有寫權限了!如果檢查發現還有寫權限,就會報該錯誤。
要修復這個錯誤,可以用命令chmod a-w /home/user去除用戶主目錄的寫權限,注意把目錄替換成你自己的。或者你可以在vsftpd的配置文件中增加下列兩項中的一項:
allow_writeable_chroot=YES
#{page}*10,10 逗號不能少
select <include refid="Base_Column_List" /> from (select * from FtpPrivateFile where uploaduser=#{username})t1 limit #{page}*10,10
org.springframework.jdbc.BadSqlGrammarException:
### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-10 10' at line 1
### The error may exist in file [D:\software\github\github下載\laboratoryWeb\labWeb\out\production\resources\mybatis\mapper\FtpFileMapper.xml]
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: select * from FtpPublicFile limit ? 10
應該將這種運算,交到servcie層
admin@iZwz92c0zpe8t65qe996ckZ:~$ service pure-ftpd start
Failed to start pure-ftpd.service: The name org.freedesktop.PolicyKit1 was notprovided by any .service files
See system logs and 'systemctl status pure-ftpd.service' for details.
admin@iZwz92c0zpe8t65qe996ckZ:~$ sudo service pure-ftpd start
sudo: unable to resolve host iZwz92c0zpe8t65qe996ckZ
43:下載的mysql插件版本號與電腦裝的版本號不一致,將會提示 連接異常。
44:Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience
因為ajax請求設置為同步了,同步已經廢棄,需要將
async: true, 設為true
45: 一些js腳本,某些瀏覽器不支持,所以執行不了。 例如:實驗室網站,添加分類,刪除分類功能,Google支持,Firefox不支持。
46:ckeditor 限制圖片大小
已解決,
把ckeditor/plugins/image/dialogs/image.js中的
this.imageElement.getAttribute("style") || this.imageElement.removeAttribute("style");
改為
this.imageElement.setAttribute("style")&&this.imageElement.removeAttribute("style");
47:
select * from FtpPublicFile limit #{page},10 order by date_created DESC //出錯,先后順序不對
select * from FtpPublicFile order by date_created DESC limit #{page},10
48: ckeditor支持直接復制word文件。
//word格式
config.pasteFromWordRemoveFontStyles = false;
config.pasteFromWordRemoveStyles = false;
config.forcePasteAsPlainText =false;
config.pasteFromWordKeepsStructure = false;
config.pasteFromWordIgnoreFontFace = false;
config.pasteFilter=null; //粘貼過濾器設置為null 即可
48: ftp上傳下載文件時,如果是zip文件,要用二進制流的形式,默認的是ascll碼。
上傳下載都要設置為二進制流, 否則提示文件錯誤,打不開。
FTPClient ftp = new FTPClient(); ftp.connect(host, port); // 如果采用默認端口,可以使用ftp.connect(host)的方式直接連接FTP服務器 ftp.login(username, password);// 登錄 ftp.setFileType(FTPClient.BINARY_FILE_TYPE); //設置為二進制傳輸形式
49: 通過文件路徑,去獲取jar包下面resource/image下面的圖片時。 因為打成jar包,不能通過文件路徑獲取了,只能通過流的方法 Inputstream 去獲取文件。
ClassPathResource cpr = new ClassPathResource("./static/img/"+filename); String path1 = cpr.getPath(); System.out.println(path1); File file = cpr.getFile(); String path = file.getAbsolutePath(); //這種不行 FileInputStream fileInputStream = new FileInputStream(file); InputStream inputStream = cpr.getInputStream(); //通過這種方式。
錯誤提示:
cannot be resolved to absolute file path because it does not reside in the file system
50:開啟緩存提示錯誤
.297 ERROR 17026 --- [ main] net.sf.ehcache.Cache : Unable to set localhost. This prevents creation of a GUID. Cause was: iZwz92c0zpe8t65qe996ckZ: iZwz92c0zpe8t65qe996ckZ: Name or servicenot known
java.net.UnknownHostException: iZwz92c0zpe8t65qe996ckZ: iZwz92c0zpe8t65qe996ckZ: Name or service not known
是因為localhost解析異常,將localhost的位置置換為不能解析的名字即可
編輯vi /etc/hosts
將127.0.0.1 localhost 改為:
127.0.0.1 iZwz92c0zpe8t65qe996ckZ