J2EE 部分常見錯誤

1、org.apache.commons.dbcp.basicdatasource not found
   缺少包:commons-dbcp.jar,commons-pool.jar 
   在spring-framework-2.0.1-with-dependencies/spring-framework-2.0.1/lib/jakarta-commons目錄下導入即可。
2、項目myeclipse 的add and remove project deployments 不能執行:需要通過Add重新添加jdk,這裏需要另起一個名稱,jdk5.x,否則會出現錯誤。
3、hibernate.cfg.xml,applicationContext.xml配置文件可通過myeclipse生成,注意其路徑都在src根目錄下。
4、/hibernate.cfg.xml找不到,是其配置文件有誤,仔細查看。
5、JSPException,請導入相應的數據驅動包。

6、ISO-8859-4無法保存錯誤:myeclipse的屬性:files and edits 中所有jsp、php等選擇爲FTP-8即可。

7、struts標籤庫無法識別:myeclipse的屬性,添加add struts capablities即可。

8、org.springframework.orm.hibernate3.hibernatesupport not found:

  缺少包:spring-hibernate3.jar

  在spring-framework-2.0.1-with-dependencies/spring-framework-2.0.1/dist/modules導入其下邊的spring-hibernate3.jar包即可。

9、在eclipse中啓動tomcat時出現的問題:
嚴重: Exception during cleanup after start failed
LifecycleException:  Container StandardContext[/MAMIS.myeclipse.bak] has not been started
解決方案:
把tomcat下conf裏(/Tomcat 5.0/conf/Catalina/localhost)的相應文件刪了就行了。
實在不行:連同/Tomcat 5.0/webapps和/Tomcat 5.0/work下的都刪了。

10、用myeclipse佈置struts報錯  
  org.apache.jasper.JasperException:    
  This   absolute   uri   (http://jakarta.apache.org/struts/tags-bean)   cannot   be   resolved   in   either   web.xml   or   the   jar   files   deployed   with   this   application 

解決方案:

你的jsp中的taglib配置不對,http://jakarta.apache.org/struts/tags-bean這個鏈接已經被刪除了  
  可以手動配置在struts的開發包中找到struts-html.tld文件,將他放到WEB-INF/tlds目錄下面  
  在web.xml中指定  
  <jsp-config>
    <taglib>
       <taglib-uri>/tags/struts-html</taglib-uri> 
       <taglib-location>/WEB-INF/struts-html.tld</taglib-location>  
    </taglib>
    <taglib>
       <taglib-uri>/tags/struts-bean</taglib-uri> 
       <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>  
    </taglib>
  </jsp-config>
  在jsp中引用  
<%@ taglib uri="/WEB-INF/struts-bean.tld"   prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld"   prefix="html" %>

11、P Status 404 - Servlet action is not available

解決方法:

type Status report

message Servlet action is not available

description The requested resource (Servlet action is not available) is not available.

問題原因:

1.、web.xml文件中未配置ActionServlet。

2、struts-config.xml文件未配置你要訪問的Action。

3、你的jsp文件form標記中action屬性的路徑名稱錯誤。

4、非以上三種情況。

針對以上4種情況相應的解決方案如下:

1、在web.xml文件中加上ActionServlet的配置信息

    action
    org.apache.struts.action.ActionServlet
    config
    /WEB-INF/struts-config.xml

2、在struts-config.xml文件檢查你要訪問的Action配置文件。

3、檢查jsp文件form標記中action屬性的路徑名稱是否與struts-config.xml文件中action標記的path屬性的路徑名稱一致。

4、非以上情況的解決辦法就是檢查web容器的log日誌,如果時tomcat則檢查下logs目錄下的localhost_log文件,看裏邊是否記錄有錯誤信息,然後根據錯誤信息提示將其糾正。

5、解決找不到Action問題

HTTP Status 404 - Servlet action is not available


type Status report

message Servlet action is not available

description The requested resource (Servlet action is not available) is not available.


Apache Tomcat/5.0.28

就是找不到我們的action。

去掉applicationContext.xml下面這個<property>標籤

   <property name="mappingResources">
    <list>
     <value>
      com/ssh/beans/po/Customer.hbm.xml
     </value>
    </list>
   </property>

問題在於構件路徑(lib)內的包重疊(提示:前提是你要保證這個問題出現之前都正常),所以你要確定構建路徑裏的包不能重複!

建議:在導入包時,按照默認導入,不要把所有的包都導進工程,在操作中在把需要的jar包導進去(最好不要把整個liberaries導進去),這樣即可以減小工程的大小,又能確保struts/spring/hibernate之間的包不會重疊或者被替換。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章