框架組合問(wèn)題集_第1頁(yè)
框架組合問(wèn)題集_第2頁(yè)
框架組合問(wèn)題集_第3頁(yè)
框架組合問(wèn)題集_第4頁(yè)
框架組合問(wèn)題集_第5頁(yè)
全文預(yù)覽已結(jié)束

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、一、 Servlete action is not available說(shuō)明:這種問(wèn)題是SSH框架結(jié)合使用最長(zhǎng)出現(xiàn)的問(wèn)題。問(wèn)題現(xiàn)象:2010-9-8 進(jìn)行SSH組合時(shí)出現(xiàn)Servlete action is not available.現(xiàn)象開(kāi)發(fā)環(huán)境:項(xiàng)目名(spring3) struts1.0 spring2.0 hibernate3.1分析:項(xiàng)目spring3三大框架部署完后,沒(méi)有添加log4j。導(dǎo)致項(xiàng)目運(yùn)行時(shí)只提示servletAction is not available !第一步:把log4j.jar 包導(dǎo)入項(xiàng)目spring第二步:設(shè)置perties文件log4j.ro

2、otLogger=info,appender1,appender2log4j.appender.appender1=log4j.appender.appender2=log4j.appender.appender1.File=c:log4j.loglog4j.appender.appender1.DatePattern='.'yyyy-MM-dd'.log'log4j.appender.appender1.layout=log4j.appender.appender2.layout=log4j.appender.appender1.layout.Conversi

3、onPattern=%-5p%dyyyy-MM-ddHH:mm:ssMethod:%l%n%m%nlog4j.appender.appender2.layout.ConversionPattern=%r%t%p-%c-%l-%m%n第三步:重新啟動(dòng)服務(wù)后,就報(bào)一下錯(cuò)誤:Log4j.log日志:INFO2010-09-0905:21:38 Method: org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)Loading

4、 XML bean definitions from ServletContext resource /WEB-INF/classes/applicationContext.xmlINFO 2010-09-09 05:21:39 Method: org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:393)Bean factory for application context org.springframewor

5、k.web.context.support.XmlWebApplicationContext176343e: org.springframework.beans.factory.support.DefaultListableBeanFactory1d317abINFO 2010-09-09 05:21:40 Method: org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:276)Pre-ins

6、tantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory1d317ab: defining beans ds,sessionfactory,TblFwxxDAO,listdao,listbiz,/list; root of factory hierarchyINFO 2010-09-09 05:21:40 Method: org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.de

7、stroySingletons(DefaultSingletonBeanRegistry.java:282)Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory1d317ab: defining beans ds,sessionfactory,TblFwxxDAO,listdao,listbiz,/list; root of factory hierarchyERROR 2010-09-09 05:21:45 Method: org.springframewor

8、k.web.struts.ContextLoaderPlugIn.init(ContextLoaderPlugIn.java:229)Context initialization failedorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ds' defined in ServletContext resource /WEB-INF/classes/applicationContext.xml: Instantiation of bean failed

9、; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPoolCaused by: java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPoolat java.lang.Class.getDeclaredConstructors0(Native Method)at java.lang.Class.privateGetDeclaredConstructors(Unk

10、nown Source)at java.lang.Class.getConstructor0(Unknown Source)at java.lang.Class.getDeclaredConstructor(Unknown Source)at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:54).第四步:跟據(jù)日志提示:java.lang.NoClassDefFoundError: org/apache/commo

11、ns/pool/impl/GenericObjectPool由于未找到org/apache/commons/pool/impl/GenericObjectPool/impl/GenericObjectPool這個(gè)類導(dǎo)致Context initialization failed第五步:看到第四步的分析后,檢查了項(xiàng)目中的jar包,發(fā)現(xiàn)項(xiàng)目中加載框架時(shí)沒(méi)有導(dǎo)入commons-pool.jar包解決辦法:從網(wǎng)上下載了commons-pool.jar包后。從新運(yùn)行就運(yùn)行正常了。項(xiàng)目spring3的代碼如下:項(xiàng)目結(jié)構(gòu)如下:struts-config.xml文件內(nèi)容如下<?xml version=&q

12、uot;1.0" encoding="UTF-8"?><!DOCTYPE struts-config PUBLIC "-/Apache Software Foundation/DTD Struts Configuration 1.2/EN" "/dtds/struts-config_1_2.dtd"><struts-config><data-sources /><form-beans ><form-bean name=&

13、quot;listForm" type="com.pcx.struts.form.ListForm" /></form-beans><global-exceptions /><global-forwards /><action-mappings ><actionattribute="listForm"name="listForm"path="/list"scope="request" type="org.spring

14、framework.web.struts.DelegatingActionProxy"><forward name="list" path="/list.jsp" /></action></action-mappings><message-resources parameter="com.pcx.struts.ApplicationResources" /> <plug-in className="org.springframework.web.strut

15、s.ContextLoaderPlugIn"> <set-property property="contextConfigLocation" value="/WEB-INF/classes/applicationContext.xml"/> </plug-in></struts-config>說(shuō)明:紅色字體是把struts和spring 集成在一起了applicationContext.xml文件內(nèi)容如下:<?xml version="1.0" encoding="U

16、TF-8"?><beansxmlns="/schema/beans"xmlns:xsi="/2001/XMLSchema-instance"xsi:schemaLocation="/schema/beans /schema/beans/spring-beans-2.0.xsd"><bean id=&

17、quot;ds" class="mons.dbcp.BasicDataSource"><property name="driverClassName"value="com.microsoft.sqlserver.jdbc.SQLServerDriver"></property><property name="url"value="jdbc:sqlserver:/localhost:1433;databaseName=zf"></prope

18、rty><property name="username" value="sa"></property><property name="password" value="xiaoli82102983"></property></bean><bean id="sessionfactory"class="org.springframework.orm.hibernate3.LocalSessionFactoryBean

19、"><property name="dataSource"><ref bean="ds" /></property><property name="hibernateProperties"><props><prop key="hibernate.dialect"></prop></props></property><property name="mappingResources"><list><value></value></list></property></bean><!- dao -><bean id="TblFwxxDAO" class="com.pcx.hb.entity.TblFwxxDAO"><property name="se

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論