体会真正的Struts开发(2期) 3

类别:Java 点击:0 评论:0 推荐:

配置Web.xml使这个Servlet在启动时加载。

<servlet>

        <servlet-name>testConnectionPooler</servlet-name>

        <servlet-class>com.test.web.TestServlet</servlet-class>

        <load-on-startup>2</load-on-startup>

 </servlet>

启动Tomcat

出现信息如下

2004-3-20 21:28:05 org.apache.commons.modeler.Registry getRegistry

信息: Creating new Registry instance

2004-3-20 21:28:06 org.apache.commons.modeler.Registry getServer

信息: Creating MBeanServer

2004-3-20 21:28:07 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 21:28:13 org.apache.struts.util.PropertyMessageResources <init>

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

2004-3-20 21:28:13 org.apache.struts.util.PropertyMessageResources <init>

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

出现信息如下

2004-3-20 21:26:48 org.apache.commons.modeler.Registry getRegistry

信息: Creating new Registry instance

2004-3-20 21:26:49 org.apache.commons.modeler.Registry getServer

信息: Creating MBeanServer

2004-3-20 21:26:50 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 21:26:56 org.apache.struts.util.PropertyMessageResources <init>

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

2004-3-20 21:26:56 org.apache.struts.util.PropertyMessageResources <init>

 

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

本文地址:http://com.8s8s.com/it/it16699.htm