---
title: "体会真正的Struts开发(2期) 3"
author: "fanjava"
date: "2004-06-27T19:01:00Z"
tags: []
slug: "struts-2-3"
draft: false
lastmod: "2004-06-27T19:01:00Z"
id: 601991
url: "https://fanjava.iteye.com/blog/601991"
---

配置Web.xml使这个Servlet在启动时加载。&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;

**&lt;servlet&gt;**

**&lt;servlet-name&gt;testConnectionPooler&lt;/servlet-name&gt;**

**&lt;servlet-class&gt;com.test.web.TestServlet&lt;/servlet-class&gt;**

**&lt;load-on-startup&gt;2&lt;/load-on-startup&gt;**

**&lt;/servlet&gt;**

启动Tomcat

&lt;?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /&gt;&lt;shapetype id="\_x0000\_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"&gt;&lt;stroke joinstyle="miter"&gt;&lt;/stroke&gt;&lt;formulas&gt;&lt;f eqn="if lineDrawn pixelLineWidth 0"&gt;&lt;/f&gt;&lt;f eqn="sum @0 1 0"&gt;&lt;/f&gt;&lt;f eqn="sum 0 0 @1"&gt;&lt;/f&gt;&lt;f eqn="prod @2 1 2"&gt;&lt;/f&gt;&lt;f eqn="prod @3 21600 pixelWidth"&gt;&lt;/f&gt;&lt;f eqn="prod @3 21600 pixelHeight"&gt;&lt;/f&gt;&lt;f eqn="sum @0 0 1"&gt;&lt;/f&gt;&lt;f eqn="prod @6 1 2"&gt;&lt;/f&gt;&lt;f eqn="prod @7 21600 pixelWidth"&gt;&lt;/f&gt;&lt;f eqn="sum @8 21600 0"&gt;&lt;/f&gt;&lt;f eqn="prod @7 21600 pixelHeight"&gt;&lt;/f&gt;&lt;f eqn="sum @10 21600 0"&gt;&lt;/f&gt;&lt;/formulas&gt;&lt;path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"&gt;&lt;/path&gt;&lt;lock v:ext="edit" aspectratio="t"&gt;&lt;/lock&gt;&lt;/shapetype&gt;&lt;shape id="\_x0000\_i1025" style="WIDTH: 129.75pt; HEIGHT: 85.5pt" type="#\_x0000\_t75"&gt;&lt;img src="http://dev.csdn.net/Develop/ArticleImages/25/25884/CSDN\_Dev\_Image\_2004-3-211047340.png" o=""&gt;&lt;/shape&gt;

出现信息如下

2004-3-20 &lt;?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /&gt;&lt;time hour="21" minute="28"&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: red; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-highlight: white"&gt;21:28:05&lt;/span&gt;&lt;/time&gt; org.apache.commons.modeler.Registry getRegistry

信息: Creating new Registry instance

2004-3-20 &lt;time hour="21" minute="28"&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: red; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-highlight: white"&gt;21:28:06&lt;/span&gt;&lt;/time&gt; org.apache.commons.modeler.Registry getServer

信息: Creating MBeanServer

2004-3-20 &lt;time hour="21" minute="28"&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: red; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-highlight: white"&gt;21:28:07&lt;/span&gt;&lt;/time&gt; org.apache.coyote.http11.Http11Protocol init

信息: Initializing Coyote HTTP/1.1 on port 80

Starting service Tomcat-Standalone

Apache Tomcat/4.1.27-LE-jdk14

2004-03-20 21:28:11,843 INFO \[main] web.TestServlet (TestServlet.java:43) - 连接池OK

2004-3-20 &lt;time hour="21" minute="28"&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: red; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-highlight: white"&gt;21:28:13&lt;/span&gt;&lt;/time&gt; org.apache.struts.util.PropertyMessageResources &lt;init&gt;

信息: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true

2004-3-20 &lt;time hour="21" minute="28"&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: red; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-highlight: white"&gt;21:28:13&lt;/span&gt;&lt;/time&gt; org.apache.struts.util.PropertyMessageResources &lt;init&gt;

现在我们关闭MySQL数据库服务，再重新启动Tomcat

出现信息如下

2004-3-20 &lt;time hour="21" minute="26"&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: red; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-highlight: white"&gt;21:26:48&lt;/span&gt;&lt;/time&gt; org.apache.commons.modeler.Registry getRegistry

信息: Creating new Registry instance

2004-3-20 &lt;time hour="21" minute="26"&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: red; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-highlight: white"&gt;21:26:49&lt;/span&gt;&lt;/time&gt; org.apache.commons.modeler.Registry getServer

信息: Creating MBeanServer

2004-3-20 &lt;time hour="21" minute="26"&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: red; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-highlight: white"&gt;21:26:50&lt;/span&gt;&lt;/time&gt; org.apache.coyote.http11.Http11Protocol init

信息: Initializing Coyote HTTP/1.1 on port 80

Starting service Tomcat-Standalone

Apache Tomcat/4.1.27-LE-jdk14

2004-03-20 21:26:55,421 ERROR \[main] web.TestServlet (TestServlet.java:48) - 出现错误Cannot create PoolableConnectionFactory

2004-3-20 &lt;time hour="21" minute="26"&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: red; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-highlight: white"&gt;21:26:56&lt;/span&gt;&lt;/time&gt; org.apache.struts.util.PropertyMessageResources &lt;init&gt;

信息: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true

2004-3-20 &lt;time hour="21" minute="26"&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: red; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-highlight: white"&gt;21:26:56&lt;/span&gt;&lt;/time&gt; org.apache.struts.util.PropertyMessageResources &lt;init&gt;

好了数据库连接已经成功，接下来我们重新配置Hibernate，使其支持连接池