正常的话应该象下面这样加载xml的配置文件:
2010-8-17 10:55:56 org.springframework.context.support.AbstractApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.FileSystemXmlApplicationContext@1ac1fe4: display name [org.springframework.context.support.FileSystemXmlApplicationContext@1ac1fe4]; startup date [Tue Aug 17 10:55:56 CST 2010]; root of context hierarchy
2010-8-17 10:55:57 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from file [E:\MyEclipseWork7\SSHH\WebRoot\WEB-INF\applicationContext.xml]
2010-8-17 10:55:59 org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
信息: Bean factory for application context [org.springframework.context.support.FileSystemXmlApplicationContext@1ac1fe4]: org.springframework.beans.factory.support.DefaultListableBeanFactory@2acc65
2010-8-17 10:55:59 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
信息: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@2acc65: defining beans [dataSource,sessionFactory,transactionManager,txAdvice,org.springframework.aop.config.internalAutoProxyCreator,leePointcut,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0,clientDao,buildinfoDao,householdDao,roominfoDao,userbagDao,accessVisitorDao,textDao,recomhouseDao,mgr]; root of factory hierarchy
2010-8-17 10:56:00 com.mchange.v2.log.MLog <clinit>
信息: MLog clients using java 1.4+ standard logging.
2010-8-17 10:56:00 com.mchange.v2.c3p0.C3P0Registry banner
信息: Initializing c3p0-0.9.0.2 [built 26-September-2005 12:55:26 -0400; debug? true; trace: 10]
2010-8-17 10:56:04 org.springframework.orm.hibernate3.LocalSessionFactoryBean buildSessionFactory
信息: Building new Hibernate SessionFactory
2010-8-17 10:56:04 com.mchange.v2.c3p0.PoolBackedDataSource getPoolManager
信息: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource@187c55c[ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 187c55c, idleConnectionTestPeriod -> -1, initialPoolSize -> 1, jdbcUrl -> jdbc:mysql://localhost/house, loginTimeout -> 0, maxIdleTime -> 20, maxPoolSize -> 20, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 1, numHelperThreads -> 3, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 300, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, usesTraditionalReflectiveProxies -> false ]
2010-8-17 10:56:09 org.springframework.orm.hibernate3.HibernateTransactionManager afterPropertiesSet
信息: Using DataSource [com.mchange.v2.c3p0.ComboPooledDataSource@187c55c[ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 187c55c, idleConnectionTestPeriod -> -1, initialPoolSize -> 1, jdbcUrl -> jdbc:mysql://localhost/house, loginTimeout -> 0, maxIdleTime -> 20, maxPoolSize -> 20, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 1, numHelperThreads -> 3, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 300, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, usesTraditionalReflectiveProxies -> false ]] of Hibernate SessionFactory for HibernateTransactionManager但是现在运行,只有下面这样的输出信息:
2010-8-17 10:57:55 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Program Files\Genuitec\Common\binary\com.sun.java.jre.win32.x86_1.5.0.011\bin;D:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
2010-8-17 10:57:55 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2010-8-17 10:57:55 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 2007 ms
2010-8-17 10:57:56 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2010-8-17 10:57:56 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.20
2010-8-17 10:58:02 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2010-8-17 10:58:02 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2010-8-17 10:58:02 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/94 config=null
2010-8-17 10:58:02 org.apache.catalina.startup.Catalina start
信息: Server startup in 7109 ms由此可见,下面的输出信息只是表明打开了tomcat,但是没有加载xml文件,在tomcat的work文件夹下也看不到.class文件的存在,是空的,怎么回事??
2010-8-17 10:55:56 org.springframework.context.support.AbstractApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.FileSystemXmlApplicationContext@1ac1fe4: display name [org.springframework.context.support.FileSystemXmlApplicationContext@1ac1fe4]; startup date [Tue Aug 17 10:55:56 CST 2010]; root of context hierarchy
2010-8-17 10:55:57 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from file [E:\MyEclipseWork7\SSHH\WebRoot\WEB-INF\applicationContext.xml]
2010-8-17 10:55:59 org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
信息: Bean factory for application context [org.springframework.context.support.FileSystemXmlApplicationContext@1ac1fe4]: org.springframework.beans.factory.support.DefaultListableBeanFactory@2acc65
2010-8-17 10:55:59 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
信息: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@2acc65: defining beans [dataSource,sessionFactory,transactionManager,txAdvice,org.springframework.aop.config.internalAutoProxyCreator,leePointcut,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0,clientDao,buildinfoDao,householdDao,roominfoDao,userbagDao,accessVisitorDao,textDao,recomhouseDao,mgr]; root of factory hierarchy
2010-8-17 10:56:00 com.mchange.v2.log.MLog <clinit>
信息: MLog clients using java 1.4+ standard logging.
2010-8-17 10:56:00 com.mchange.v2.c3p0.C3P0Registry banner
信息: Initializing c3p0-0.9.0.2 [built 26-September-2005 12:55:26 -0400; debug? true; trace: 10]
2010-8-17 10:56:04 org.springframework.orm.hibernate3.LocalSessionFactoryBean buildSessionFactory
信息: Building new Hibernate SessionFactory
2010-8-17 10:56:04 com.mchange.v2.c3p0.PoolBackedDataSource getPoolManager
信息: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource@187c55c[ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 187c55c, idleConnectionTestPeriod -> -1, initialPoolSize -> 1, jdbcUrl -> jdbc:mysql://localhost/house, loginTimeout -> 0, maxIdleTime -> 20, maxPoolSize -> 20, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 1, numHelperThreads -> 3, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 300, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, usesTraditionalReflectiveProxies -> false ]
2010-8-17 10:56:09 org.springframework.orm.hibernate3.HibernateTransactionManager afterPropertiesSet
信息: Using DataSource [com.mchange.v2.c3p0.ComboPooledDataSource@187c55c[ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 187c55c, idleConnectionTestPeriod -> -1, initialPoolSize -> 1, jdbcUrl -> jdbc:mysql://localhost/house, loginTimeout -> 0, maxIdleTime -> 20, maxPoolSize -> 20, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 1, numHelperThreads -> 3, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 300, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, usesTraditionalReflectiveProxies -> false ]] of Hibernate SessionFactory for HibernateTransactionManager但是现在运行,只有下面这样的输出信息:
2010-8-17 10:57:55 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Program Files\Genuitec\Common\binary\com.sun.java.jre.win32.x86_1.5.0.011\bin;D:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
2010-8-17 10:57:55 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2010-8-17 10:57:55 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 2007 ms
2010-8-17 10:57:56 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2010-8-17 10:57:56 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.20
2010-8-17 10:58:02 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2010-8-17 10:58:02 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2010-8-17 10:58:02 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/94 config=null
2010-8-17 10:58:02 org.apache.catalina.startup.Catalina start
信息: Server startup in 7109 ms由此可见,下面的输出信息只是表明打开了tomcat,但是没有加载xml文件,在tomcat的work文件夹下也看不到.class文件的存在,是空的,怎么回事??
=========================
外部tomcat运行信息:
2010-8-17 12:01:28 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2010-8-17 12:01:28 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 1766 ms
2010-8-17 12:01:28 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2010-8-17 12:01:28 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.20
//从这里开始装载
2010-8-17 12:01:31 org.springframework.web.context.ContextLoader initWebApplicat
ionContext
信息: Root WebApplicationContext: initialization started
2010-8-17 12:01:31 org.springframework.context.support.AbstractApplicationContex
t prepareRefresh=============================
myeclipse环境中运行信息:
2010-8-17 12:17:04 org.apache.catalina.core.AprLifecycleListener init
信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Program Files\Genuitec\Common\binary\com.sun.java.jre.win32.x86_1.5.0.011\bin;D:\Program Files\Genuitec\Common\plugins\com.genuitec.eclipse.easie.tomcat.myeclipse_7.1.0.zmyeclipse7102009030516\tomcat\bin
2010-8-17 12:17:04 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2010-8-17 12:17:04 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 2189 ms
2010-8-17 12:17:05 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2010-8-17 12:17:05 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.13
//从下面开始,本来应该是开始装载ApplicationContext.xml文件的,但是没有装载,跳过了
2010-8-17 12:17:08 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2010-8-17 12:17:09 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2010-8-17 12:17:09 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/93 config=null
2010-8-17 12:17:09 org.apache.catalina.startup.Catalina start
信息: Server startup in 4422 ms
.正确的web.xml配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!--initialize the spring-->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!--end-->
<!--struts2-->
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
里面设置了初始化项目时候应该装载applicationContext.xml的,但是新项目中默认生成的web.xml是只有一个起始页index.jsp设置,其他什么设置都没有,所以就无法装载xml配置文件。悲剧,搞了这么久,重装了几次,原来是这点小问题