---
title: "部署IBatis例子JPetstore5.0源码-下载并配置Tomcat6的JNDI(第一步)"
author: "llhdf"
date: "2008-11-16T22:33:59Z"
tags: []
slug: "ibatis-jpetstore5-0-tomcat6-jndi"
draft: false
lastmod: "2008-11-16T23:28:57Z"
id: 268298
url: "https://llhdf.iteye.com/blog/268298"
---

本文将记录如何在MyEclipse6.5中，导入IBatis的JPetStore5.0源码，并且部署到tomcat6.0中。

 

下载tomcat6.0：[http://dev.xiaonei.com/apache-mirror/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.zip](http://dev.xiaonei.com/apache-mirror/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.zip)

 

配置Tomcat6.0中上下文，使用JPetStore目录。

 

&lt;?xml version='1.0' encoding='utf-8'?&gt;

 

&lt;Server port="8005" shutdown="SHUTDOWN"&gt;

 

  &lt;Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /&gt;  
  &lt;Listener className="org.apache.catalina.core.JasperListener" /&gt;  
  &lt;Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" /&gt;  
  &lt;Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /&gt;

 

  &lt;GlobalNamingResources&gt;

    &lt;Resource name="UserDatabase" auth="Container"  
              type="org.apache.catalina.UserDatabase"  
              description="User database that can be updated and saved"  
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"  
              pathname="conf/tomcat-users.xml" /&gt;  
  &lt;/GlobalNamingResources&gt;

  &lt;Service name="Catalina"&gt;  
   
   &lt;Connector port="8080" protocol="HTTP/1.1"  
              enableLookups="false"  
              connectionTimeout="20000"  
              redirectPort="8443"  
              maxThreads="900"  
              minSpareThreads="150"  
              maxSpareThreads="450"  
              disableUploadTimeout="true"  
              URIEncoding="UTF-8" /&gt;

    &lt;Connector port="8009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8"/&gt;

 

    &lt;Engine name="Catalina" defaultHost="localhost"&gt;

      &lt;Realm className="org.apache.catalina.realm.UserDatabaseRealm"  
             resourceName="UserDatabase"/&gt;

      &lt;Host name="localhost"  appBase="webapps"  
            unpackWARs="true" autoDeploy="true"  
            xmlValidation="false" xmlNamespaceAware="false"&gt;

 

     &lt;Context path="" docBase="jpetstore" reloadable="true" crossContext="true"&gt;

     &lt;Resource name="jdbc/jpetstore"

       auth="Container"

       type="javax.sql.DataSource"  
       maxActive="10" maxIdle="5" maxWait="100"  
       username="jpetstore" password="ibatis9977"

       driverClassName="com.mysql.jdbc.Driver"  
       url="jdbc:mysql://127.0.0.1:3306/jpetstore?autoReconnect=true&amp;characterEncoding=GBK"/&gt;

 

 

 

      &lt;/Context&gt;

 

      &lt;/Host&gt;  
    &lt;/Engine&gt;  
  &lt;/Service&gt;  
&lt;/Server&gt;