참고 URL : http://tomcat.apache.org/tomcat-6.0-doc/config/index.html

CATLINA_HOME :  /usr/local/tomcat-6.0.29 라고 가정하고 진행.

1. server.xml 설정

vi $CATALINA_HOME/conf/server.xml

GlobalNamingResources 설정에 우리가 사용할 Resource 를 설정한다.

Resource 설정

<Resource auth="Container" driverClassName="com.mysql.jdbc.Driver"
                 name="jdbc/BIZUMA_DS" username="bizuma" password="password"
                 url="jdbc:mysql://localhost:3306/bizumadb
                 type="javax.sql.DataSource" />
  

context 설정

 <Host name="localhost" appBase="webapps" unpackWARs="true"
          autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"
          <Context docBase="$CATALINA_HOME/webapps/bizuma" path="/bizuma" reloadable="true" />     
</HOST>



context 설정에서 appBase설정에 따라 docBase를 설정하고 unpackWARS 를 true로 설정을 했으니 bizuma.war 파일이 webapps/bizuma.war 로 배포가 될 것이고 webapps/bizuma 폴더에 압축이 풀릴것이다. context 파일을 특별히 설정할 필요는 없다. webapps/bizuma.war 가 존재 한다면 자동으로 contxt path 는 bizuma로 잡을것이다.

2. context.xml설정

vi $CATALINA_HOME/webapps/conf/context.xml
 <Context>
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <ResourceLink global="jdbc/BIZUMA_DS" name="jdbc/BIZUMA_DS" type="javax.sql.DataSource"/>
</Context>

3. bizuma.war 의 web.xml 파일의 resource-ref 설정

 <resource-ref>
    <description>Nexfa Mysql Datasource</description>
    <res-ref-name>jdbc/NEXFA_DS</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
</resource-ref>





블로그 이미지

비추마

,