2015-5-13 19:21:54 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: f:\Users\xu\AppData\Local\MyEclipse\Common\binary\com.sun.java.jdk.win32.x86_64_1.6.0.013\bin;F:\Users\xu\AppData\Local\MyEclipse\Common\plugins\com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201109141806\tomcat\bin
2015-5-13 19:21:54 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2015-5-13 19:21:54 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 1716 ms
2015-5-13 19:21:54 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2015-5-13 19:21:54 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.13
log4j:WARN No appenders could be found for logger (com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory).
log4j:WARN Please initialize the log4j system properly.
2015-5-13 19:21:58 org.apache.catalina.core.StandardContext filterStart
嚴重: Exception starting filter struts2
Unable to load configuration. - action - file:/E:/%E6%96%B0%E5%BB%BA%E6%96%87%E4%BB%B6%E5%A4%B9/workspace/.metadata/.me_tcat/webapps/userhaber/WEB-INF/classes/struts.xml:8:70
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:493)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3693)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4340)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: Unable to load configuration. - action - file:/E:/%E6%96%B0%E5%BB%BA%E6%96%87%E4%BB%B6%E5%A4%B9/workspace/.metadata/.me_tcat/webapps/userhaber/WEB-INF/classes/struts.xml:8:70
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:967)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:435)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:479)
... 29 more
Caused by: Action class [com.xu.action] not found - action - file:/E:/%E6%96%B0%E5%BB%BA%E6%96%87%E4%BB%B6%E5%A4%B9/workspace/.metadata/.me_tcat/webapps/userhaber/WEB-INF/classes/struts.xml:8:70
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:486)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:429)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:556)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:295)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:264)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
... 32 more
2015-5-13 19:21:58 org.apache.catalina.core.StandardContext start
嚴重: Error filterStart
2015-5-13 19:21:58 org.apache.catalina.core.StandardContext start
嚴重: Context [/userhaber] startup failed due to previous errors
2015-5-13 19:22:00 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2015-5-13 19:22:00 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2015-5-13 19:22:00 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/16 config=null
2015-5-13 19:22:00 org.apache.catalina.startup.Catalina start
信息: Server startup in 5324 ms
hibernate.cfg.xml
復制代碼
<?xml version='1.0' encoding='gb2312'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<!--聲明Hibernate配置文件的開始-->
<hibernate-configuration>
<!--表明以下的配置是針對session-factory配置的,SessionFactory是Hibernate中的一個類,
這個類主要負責保存HIbernate的配置信息,以及對Session的操作-->
<!--配置數據庫的驅動程序,Hibernate在連接數據庫時,需要用到數據庫的驅動程序-->
com.mysql.jdbc.Driver
<!--設置數據庫的連接url:jdbc:mysql://localhost/hibernate,其中localhost表示mysql服務器名稱,此處為本機, hibernate是數據庫名-->
<property name="hibernate.connection.url">jdbc:mysql://localhost/hibernate</hibernate>
<!--連接數據庫是用戶名-->
<property name="hibernate.connection.username">root</property>
<!--連接數據庫是密碼-->
<property name="hibernate.connection.password">123456 </property>
<!--數據庫連接池的大小-->
<property name="hibernate.connection.pool.size">20 </property>
<!--是否在後台顯示Hibernate用到的SQL語句,開發時設置為true,便於查錯,程序運行時可以在Eclipse的控制台顯示Hibernate的執行Sql語句。
項目部署後可以設置為false,提高運行效率-->
true
<!--jdbc.fetch_size是指Hibernate每次從數據庫中取出並放到JDBC的Statement中的記錄條數。Fetch Size設的越大,讀數據庫的次數越少,速度越快,
Fetch Size越小,讀數據庫的次數越多,速度越慢-->
50
<!--jdbc.batch_size是指Hibernate批量插入,刪除和更新時每次操作的記錄數。Batch Size越大,
批量操作的向數據庫發送Sql的次數越少,速度就越快,同樣耗用內存就越大-->
23
<!--jdbc.use_scrollable_resultset是否允許Hibernate用JDBC的可滾動的結果集。對分頁的結果集。對分頁時的設置非常有幫助-->
<property name="jdbc.use_scrollable_resultset">false </property>
<!--connection.useUnicode 連接數據庫時是否使用Unicode編碼-->
<property name="Connection.useUnicode">true </property>
<!--connection.characterEncoding連接數據庫時數據的傳輸字符集編碼方式,最好設置為gbk,用gb2312有的字符不全-->
<property name="connection.characterEncoding">gbk </property>
<!--hibernate.dialect 只是Hibernate使用的數據庫方言,就是要用Hibernate連接那種類型的數據庫服務器。-->
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect </property>
<!--指定映射文件為“hibernate/ch1/UserInfo.hbm.xml”-->
<mapping resource="org/mxg/UserInfo.hbm.xml">
<!-- 連接驅動 -->
<!-- 連接url -->
<!-- 連接用戶名 -->
<!-- 連接密碼 -->
<!-- hibernate配置文件位置 -->
WEB-INF/hibernate.cfg.xml
<!--針對oracle數據庫的方言,特定的關系數據庫生成優化的SQL -->
org.hibernate.dialect.OracleDialect
<!--選擇HQL解析器的實現 -->
org.hibernate.hql.ast.ASTQueryTranslatorFactory
<!-- 是否在控制台打印sql語句 -->
true
<!-- 在Hibernate系統參數中hibernate.use_outer_join被打開的情況下,該參數用來允許使用outer join來載入此集合的數據。 -->
true
<!-- 默認打開,啟用cglib反射優化。cglib是用來在Hibernate中動態生成PO字節碼的,打開優化可以加快字節碼構造的速度 -->
true
<!-- 輸出格式化後的sql,更方便查看 -->
true
<!-- “useUnicode”和“characterEncoding”決定了它是否在客戶端和服務器端傳輸過程中進行Encode,以及如何進行Encode -->
true
<!-- 允許查詢緩存, 個別查詢仍然需要被設置為可緩存的. -->
false
16
<!--連接池的最大活動個數 -->
100
<!-- 當連接池中的連接已經被耗盡的時候,DBCP將怎樣處理(0 = 失敗,1 = 等待,2 = 增長) -->
1
<!-- 最大等待時間 -->
1200
<!-- 沒有人用連接的時候,最大閒置的連接個數 -- >
10
<!-- 以下是對prepared statement的處理,同上。 -->
100
1
1200
10