server.xml web.xml
server.xml
<?xml version="1.0" encoding="Windows-31J"?> <Server port="8005" shutdown="SHUTDOWN"> <GlobalNamingResources> <!-- Used by Manager webapp --> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved"> </Resource> <ResourceParams name="UserDatabase"> <parameter> <name>factory</name> <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value> </parameter> <parameter> <name>pathname</name> <value>conf/tomcat-users.xml</value> </parameter> </ResourceParams> </GlobalNamingResources> <Service name="Catalina"> <!-- HTTP Port --> <Connector port="80" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" /> <Engine name="Catalina" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase" /> <Host name="localhost" appBase="webapps" xmlValidation="false"> <!-- Context appliction path. --> <Context path="/jns" reloadable="true" docBase="C:\home\xxx\workspace\xxx\ContextRoot" workDir="C:\home\xxx\workspace\xxx\work"> <!-- Session persistent --> <Manager className="org.apache.catalina.session.PersistentManager" debug="0" saveOnRestart="false" maxActiveSessions="-1" minIdleSwap="-1" maxIdleSwap="-1" maxIdleBackup="-1"> <Store className="org.apache.catalina.session.FileStore"/> </Manager> <Resource name="jdbc/db" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/db"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <parameter> <name>maxActive</name> <value>100</value> </parameter> <parameter> <name>maxIdle</name> <value>30</value> </parameter> <parameter> <name>maxWait</name> <value>10000</value> </parameter> <parameter> <name>username</name> <value>ユーザ</value> </parameter> <parameter> <name>password</name> <value>パスワード</value> </parameter> <parameter> <name>driverClassName</name> <value>oracle.jdbc.driver.OracleDriver</value> </parameter> <parameter> <name>url</name> <value>jdbc:oracle:thin:@192.168.1.xxx:1521:orcl</value> </parameter> </ResourceParams> <!-- 上記は Tomcat 5.0 まで。Tomcat 5.5 以降の場合は下記。 <Resource name="jdbc/DataSource" auth="Container" type="javax.sql.DataSource" url="jdbc:oracle:thin:@192.168.1.xxx:1521:orcl" username="ユーザ" password="パスワード" driverClassName="oracle.jdbc.driver.OracleDriver" maxActive="20" maxIdle="3" maxWait="10000" removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"/> --> </Context> </Host> </Engine> </Service> </Server>
web.xml
<?xml version="1.0" encoding="Windows-31J"?> <web-app 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 web-app_2_4.xsd" version="2.4"> <!-- DB 参照定義 --> <resource-ref> <description>DB Connection</description> <res-ref-name>jdbc/db</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> <!-- サーブレット定義 --> <servlet> <servlet-name>action</servlet-name> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/struts-config.xml</param-value> </init-param> <init-param> <param-name>debug</param-name> <param-value>2</param-value> </init-param> <init-param> <param-name>detail</param-name> <param-value>2</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <servlet> <servlet-name>jsp</servlet-name> <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class> <init-param> <param-name>logVerbosityLevel</param-name> <param-value>WARNING</param-value> </init-param> <init-param> <param-name>javaEncoding</param-name> <param-value>Windows-31J</param-value> </init-param> <load-on-startup>3</load-on-startup> </servlet> <!-- サーブレット・マッピング定義 --> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <!-- JSP 構成 --> <jsp-config> <jsp-property-group> <url-pattern>*.jsp</url-pattern> <url-pattern>*.jspf</url-pattern> <el-ignored>false</el-ignored> <page-encoding>Windows-31J</page-encoding> <scripting-invalid>false</scripting-invalid> <include-prelude>/WEB-INF/pages/common/prelude.jspf</include-prelude> </jsp-property-group> </jsp-config> </web-app>