1. 程式人生 > >我遇到的MAVEN各種問題

我遇到的MAVEN各種問題

此貼總結各種錯誤。總結的多了之後會加以分類。

1、解決Maven專案pom.xml檔案報xxx\target\classes\META-INF\MANIFEST.MF (系統找不到指定的路徑)問題:(只需簡單地clean all projects)

http://www.cnblogs.com/zhfei/p/5286827.html

2、(1)Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project taotao-manager-web: Failed to clean project: Failed to delete \target\tomcat\logs\access_log.2016-06-21 -> [Help 1]

(點選console右上角叉號然後再點選紅色小方形terminate)

http://jingyan.baidu.com/article/b24f6c8238cea986bee5da78.html

(2)Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project taotao-manager-web: Failed to clean project: Failed to delete \target\**.jar -> [Help 1]

一般是javaSE platform binary 佔用。開啟工作管理員,把javaSE platform binary程序結束掉就行。

3、解壓時找不到歸檔的錯誤。

tar -zxvf /home/centos-lr/jdk-7u80-linux-x64.gz -C /usr/local/java/

4、class path resource [spring/] cannot be resolved to URL because it does not exist

右鍵專案---->properties--->Java Build Path--->source。可以看到classpath的目錄。

5、eclipse中tomcat配置中重要的一步。遇到use tomcat installation 無法選中的時候這麼做:

http://www.07net01.com/2015/03/769446.html

記住這裡要有-C  (建立壓縮檔案)

6、Initializing Spring FrameworkServlet 'taotao-manager-web'一直卡著不動有很多原因。我的是因為在採用dubbo時,zookeeper執行後,沒有關linux的防火牆。導致它一直卡著。

其實真正發現錯誤是從這句話得知沒有關防火牆的:

Fail to start server(url: dubbo://*.*.*.*:20880/com.*.*....

7、鎖定檔案失敗。打不開磁碟或它所依賴的某個快照磁碟。開啟模組DiskEarly的操作失敗

刪除虛擬機器目錄下面三個.lck結尾的檔案即可

8、SecureCRT的一些修改設定:

每屏顯示的行數:http://www.cnblogs.com/wangyuelang0526/archive/2013/03/07/2948044.html

9、 Maven工程中的[找不到方法]錯誤

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project taotao-manager-web: Compilation failure

[ERROR] /E:/CodeEclipse/taotao-manager-web/src/main/java/com/taotao/controller/ContentCateController.java:[43,57]找不到符號

[ERROR] 符號:   方法addNode(java.lang.Long,java.lang.String)

[ERROR] 位置:型別為com.taotao.content.service.ContentCateService的變數contentCateService

錯誤提示說是找不到com.taotao.content.service.ContentCateService類中的addNode()這個方法,所以,把com.taotao.content.service.ContentCateService這個interface類重新maven install一下就可以了

10、嚴重: StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'indexController': Injection of autowired dependencies failed; 
nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private int com.taotao.portal.controller.IndexController.AD1_HEIGHT_B; 
nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'AD1_HEIGHT_B' in string value "${AD1_HEIGHT_B}"

錯誤原因:在resource.properties檔案裡把AD1_HEIGHT_B=240寫成了AD1_HEIGHT_b=240

所以平時一定要仔細。

11、org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AuthMapper': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSession' defined in class path resource [com/lab/web/config/ApplicationContext.xml]: Cannot resolve reference to bean 'sqlSessionFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/lab/web/config/ApplicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [com/lab/web/mybatis/SqlMapConfig.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class . Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.lab.m.customer.vo.customer'.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.lab.m.customer.vo.customer


解決:重新maven install一下。

12、util.NativeCodeLoader: Unable to load native-hadoop library for your platform
問題:hadoop安裝完以後,經常會提示一下警告:WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
原因:這是32位的hadoop,安裝在了64位的linux系統上
解決辦法:(轉自:http://blog.chinaunix.net/uid-30373965-id-5156368.html)
    從下面地址下載相應版本的包 (hadoop-native-64-2.7.0.tar  我的hadoop為2.7):
    http://dl.bintray.com/sequenceiq/sequenceiq-bin/
    下載完以後,解壓到hadoop的native目錄下,覆蓋原有檔案即可。操作如下:
    tar -xvf hadoop-native-64-2.7.0.tar -C /home/sky/hadoop/lib/native    (路徑是native的全路徑)13、org.apache.hadoop.yarn.exceptions.YarnException: Unauthorized request to start container

因為namenode和datanode上的時間不一致導致的,解決辦法就是同步一下的Hadoop叢集上的時間:

1)輸入“cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime”
2)輸入“ntpdate ntp.api.bz”
中國國家授時中心:210.72.145.44NTP伺服器(上海) :ntp.api.bz美國:time.nist.gov復旦:ntp.fudan.edu.cn 
微軟公司授時主機(美國) :time.windows.com臺警大授時中心(臺灣):asia.pool.ntp.org
如果顯示 the NTP socket is in use,exiting。則:
1)service ntpd stop然後 2)ntpdate ntp.api.bz

14、  java.sql.SQLException : Access denied for user 'root'@'ncentos' (using password: YES)      SQL Error code: 1045

這種錯誤是mysql資料庫中user表中的有些使用者的密碼不對。登入進去mysql之後,use mysql; 

然後select host, user,password,password_expired from user 看下密碼。

然後再更新成新密碼:update user set password=password('your new password') where user = 'root';

(上面那句不行的話就這樣:update user set authentication_string=password('123456') where user='root' (and Host = 'localhost';))

然後flush privileges;然後再為了以防萬一再驗證下select host, user,password,password_expired from user 。(如果發現password_expired的值是Y記得修改為N)

windows下解決方案:

  1. 開啟MySQL目錄下的my.ini檔案,在檔案的最後新增一行“skip-grant-tables”,儲存並關閉檔案。(WIN7預設安裝,my.ini在C:\ProgramData\MySQL\MySQL Server 5.6)
  2. 重啟MySQL服務。
  3. 通過命令列進入MySQL的BIN目錄,輸入“mysql -u root -p”(不輸入密碼),回車即可進入資料庫。(WIN7預設安裝,BIN目錄為:C:\Program Files\MySQL\MySQL Server 5.6\bin)
  4. 執行“use mysql;”,使用mysql資料庫。
  5. 執行“update user set password=PASSWORD("123456") where user='root';”(修改root的密碼)
  6. 開啟MySQL目錄下的my.ini檔案,刪除最後一行的“skip-grant-tables”,儲存並關閉檔案。
  7. 重啟MySQL服務。
  8. 在命令列中輸入“mysql -u root -p 123456”,即可成功連線資料庫
附:mysql突然連不上,可能是mysql服務沒開啟。去[管理]—>[服務]那裡開啟就行。或者進入mysql的bin目錄。然後mysqld --install 。記得要用管理員許可權開啟cmd,要不然會報錯:install/remove denied然後再net start mysql。

15、Exiting, name server cannot be used: Temporary failure in name resolution (-3)23 Nov 17:40:16 ntp
sed: Temporary failure in name resolution (-3)

原因是沒有設定dns伺服器的地址。可以 cat /etc/resolve.conf 立馬是否有dns的地址。沒有的話就加上。echo '"8.8.8.8" > /etc/resolve.conf

16、在執行 hdfs dfs -ls hdfs:// IP(host):50070/ 的時候報錯:Operation category READ is not supported in state standby:

錯誤原因是:在hadoop2.0中通常由兩個NameNode組成,一個處於active狀態,另一個處於standby狀態。Active NameNode對外提供服務,而Standby NameNode則不對外提供服務,僅同步active namenode的狀態,以便能夠在它失敗時快速進行切換。

所以在檢視hdfs中的檔案目錄時,要寫active節點的ip(主機名)而不是standby節點的。

17、scalac error: …\target\classes does not exist or is not a directory


錯誤原因:專案路徑中含有中文。

為了避免類似錯誤,以後無論什麼程式,都不要建立含有中文的路徑。

18、src refspec does not match any. failed to push some refs
git push origin [localRepoName]:[remoteRepoName]
注:兩個倉庫之間一定不能有空格。只能是冒號

(一直更新)