主要参考http://docs.codehaus.org/display/BTM/Tomcat2x进行配置,可是出现了下面的错误:2012-9-10 10:12:13 org.apache.catalina.core.NamingContextListener addResource
警告: Failed to register in JMX: javax.naming.NamingException: no resource registered with uniqueName 'jdbc/MYSQL', available resources: []下面是我的tomcat配置:
btm-config.properties:bitronix.tm.serverId=tomcat-btm-node0
bitronix.tm.journal.disk.logPart1Filename=${btm.root}/work/btm1.tlog
bitronix.tm.journal.disk.logPart2Filename=${btm.root}/work/btm2.tlog
bitronix.tm.resource.configuration=${btm.root}/conf/resources.properties
context.xml: <?xml version='1.0' encoding='utf-8'?>
<Context>
 
    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
 
    <!-- about BTM -->
    <Transaction factory="bitronix.tm.BitronixUserTransactionObjectFactory" />
 
    <Resource name="jdbc/MYSQL" auth="Container" type="javax.sql.DataSource"
        factory="bitronix.tm.resource.ResourceObjectFactory"
        className="bitronix.tm.resource.jdbc.lrc.LrcXADataSource"
    driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/xxx"
    username="root"
        password="root"
    minPoolSize="0"
        maxPoolSize="5"
        uniqueName="jdbc/MYSQL"/>
 
  
   
 
</Context>
server.xml: <?xml version='1.0' encoding='utf-8'?>
 
<Server port="8005" shutdown="SHUTDOWN">
 
  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <!-- about BTM-->
  <Listener className="bitronix.tm.integration.tomcat55.BTMLifecycleListener" />
 
 
  <GlobalNamingResources>
 
    <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" />
 
     
  </GlobalNamingResources>
 
 
  <Service name="Catalina">
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
    <Engine name="Catalina" defaultHost="localhost">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
      </Host>
    </Engine>
  </Service>
 
 
</Server>
求解决,小弟被这问题困扰很久了,看警告信息应该是context.xml没配对,但是我又没发现哪里错了