<h2 dir="auto">Question</h2>
<p dir="auto"><strong>For English only</strong>, other languages will not accept.</p>
<p dir="auto">Before asking a question, make sure you have:</p>
<ul dir="auto">
<li>Googled your question.</li>
<li>Searched open and closed <a href="https://github.com/apache/shardingsphere/issues">GitHub issues</a>.</li>
<li>Read documentation: <a href="https://shardingsphere.apache.org/document/current/en/overview" rel="nofollow">ShardingSphere Doc</a>.</li>
</ul>
<p dir="auto">Please pay attention on issues you submitted, because we maybe need more details.<br>
If no response anymore and we cannot reproduce it on current information, we will <strong>close it</strong>.</p>
<ul dir="auto">
<li>
<p dir="auto">In the current <a href="https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-proxy/distsql/syntax/rdl/resource-definition/" rel="nofollow">https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-proxy/distsql/syntax/rdl/resource-definition/</a>, which requires <code class="notranslate">Before adding resources, please confirm that a distributed database has been created, and execute the use command to successfully select a database;</code>. This means to people that when starting <code class="notranslate">ShardingSphere Proxy</code>, not only does the <code class="notranslate">server.yaml</code> need to exist, but at least one <code class="notranslate">config-*.yaml</code> needs to be created to define at least one data source.</p>
</li>
<li>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/20187731/194799249-cd40c6ac-5c27-4586-b569-0ad7a7a752b2.png"><img src="https://user-images.githubusercontent.com/20187731/194799249-cd40c6ac-5c27-4586-b569-0ad7a7a752b2.png" alt="image" style="max-width: 100%;"></a></p>
</li>
<li>
<p dir="auto">When using the Docker Image of <a href="https://github.com/apache/shardingsphere/pkgs/container/shardingsphere-proxy/44714726?tag=f4080b1b3ddcaa9eb15e87e50a6fb0d2fe2baa7f">https://github.com/apache/shardingsphere/pkgs/container/shardingsphere-proxy/44714726?tag=f4080b1b3ddcaa9eb15e87e50a6fb0d2fe2baa7f</a>, if the RDL is directly executed, the following exception will appear on the server.</p>
</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[ERROR] 2022-10-10 04:20:53.273 [Connection-1-ThreadExecutor] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
org.apache.calcite.runtime.CalciteContextException: At line 0, column 0: Object 'proc' not found within 'mysql'
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at jdk.internal.reflect.GeneratedConstructorAccessor29.newInstance(Unknown Source)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
	at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:505)
	at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:932)
	at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:917)
	at org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:5362)
	at org.apache.calcite.sql.validate.IdentifierNamespace.resolveImpl(IdentifierNamespace.java:138)
	at org.apache.calcite.sql.validate.IdentifierNamespace.validateImpl(IdentifierNamespace.java:188)
	at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:89)
	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1107)
	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3381)
	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:1078)
	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3360)
	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3697)
	at org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:64)
	at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:248)
	at org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:759)
	at org.apache.shardingsphere.sqlfederation.advanced.AdvancedSQLFederationExecutor.executeQuery(AdvancedSQLFederationExecutor.java:110)
	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.doExecuteFederation(JDBCDatabaseCommunicationEngine.java:163)
	at org.apache.shardingsphere.sqlfederation.advanced.AdvancedSQLFederationExecutor.execute(AdvancedSQLFederationExecutor.java:141)
	at org.apache.shardingsphere.sqlfederation.optimizer.SQLOptimizeEngine.optimize(SQLOptimizeEngine.java:50)
	at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:592)
	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:1053)
	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:121)
	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:111)
	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:94)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:78)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)"><pre class="notranslate"><code class="notranslate">[ERROR] 2022-10-10 04:20:53.273 [Connection-1-ThreadExecutor] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
org.apache.calcite.runtime.CalciteContextException: At line 0, column 0: Object 'proc' not found within 'mysql'
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at jdk.internal.reflect.GeneratedConstructorAccessor29.newInstance(Unknown Source)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
	at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:505)
	at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:932)
	at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:917)
	at org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:5362)
	at org.apache.calcite.sql.validate.IdentifierNamespace.resolveImpl(IdentifierNamespace.java:138)
	at org.apache.calcite.sql.validate.IdentifierNamespace.validateImpl(IdentifierNamespace.java:188)
	at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:89)
	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1107)
	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3381)
	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:1078)
	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3360)
	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3697)
	at org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:64)
	at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:248)
	at org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:759)
	at org.apache.shardingsphere.sqlfederation.advanced.AdvancedSQLFederationExecutor.executeQuery(AdvancedSQLFederationExecutor.java:110)
	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.doExecuteFederation(JDBCDatabaseCommunicationEngine.java:163)
	at org.apache.shardingsphere.sqlfederation.advanced.AdvancedSQLFederationExecutor.execute(AdvancedSQLFederationExecutor.java:141)
	at org.apache.shardingsphere.sqlfederation.optimizer.SQLOptimizeEngine.optimize(SQLOptimizeEngine.java:50)
	at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:592)
	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:1053)
	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:121)
	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:111)
	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:94)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:78)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
</code></pre></div>
<ul dir="auto">
<li>I'm not quite sure if this is an expected behavior.</li>
</ul>
<h2 dir="auto">Bug Report</h2>
<h3 dir="auto">Which version of ShardingSphere did you use?</h3>
<p dir="auto">master branch, <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/apache/shardingsphere/commit/0b41852bc93129f480989b33bda929fedc739199/hovercard" href="https://github.com/apache/shardingsphere/commit/0b41852bc93129f480989b33bda929fedc739199"><tt>0b41852</tt></a></p>
<h3 dir="auto">Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?</h3>
<p dir="auto">Proxy</p>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">XA transaction won't be started.</p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">It started.</p>
<h3 dir="auto">Reason analyze (If you can)</h3>
<p dir="auto">In GlobalRulesBuilder:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/42492540/177501542-ca95718b-eb17-4b45-bcf0-fc986e12d8e0.png"><img width="1176" alt="WX20220706-152940@2x" src="https://user-images.githubusercontent.com/42492540/177501542-ca95718b-eb17-4b45-bcf0-fc986e12d8e0.png" style="max-width: 100%;"></a></p>
<p dir="auto">In XAShardingSphereTransactionManager:<br>
Since AtomikosTransactionManagerProvider is the default impl of XATransactionManagerProvider, <code class="notranslate">XATransactionManagerProviderFactory.getInstance(null)</code> in <code class="notranslate">XAShardingSphereTransactionManager.init</code> return AtomikosTransactionManagerProvider instance.<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/42492540/177502052-f409bb37-0707-4a58-bc7b-3d055d1fdb99.png"><img width="1252" alt="图片" src="https://user-images.githubusercontent.com/42492540/177502052-f409bb37-0707-4a58-bc7b-3d055d1fdb99.png" style="max-width: 100%;"></a></p>
<h3 dir="auto">Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.</h3>
<p dir="auto"><code class="notranslate">server.yaml</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="mode:
  type: Cluster
  repository:
    type: ZooKeeper
    props:
      namespace: mysql
      server-lists: localhost:2181
      retryIntervalMilliseconds: 500
      timeToLiveSeconds: 60
      maxRetries: 3
      operationTimeoutMilliseconds: 500
  overwrite: false

rules:
  - !AUTHORITY
    users:
      - root@%:root
      - sharding@:sharding
    provider:
      type: ALL_PERMITTED
#  - !TRANSACTION
#    defaultType: XA
#    providerType: Atomikos
  - !SQL_PARSER
    sqlCommentParseEnabled: true
    sqlStatementCache:
      initialCapacity: 2000
      maximumSize: 65535
    parseTreeCache:
      initialCapacity: 128
      maximumSize: 1024"><pre class="notranslate"><code class="notranslate">mode:
  type: Cluster
  repository:
    type: ZooKeeper
    props:
      namespace: mysql
      server-lists: localhost:2181
      retryIntervalMilliseconds: 500
      timeToLiveSeconds: 60
      maxRetries: 3
      operationTimeoutMilliseconds: 500
  overwrite: false

rules:
  - !AUTHORITY
    users:
      - root@%:root
      - sharding@:sharding
    provider:
      type: ALL_PERMITTED
#  - !TRANSACTION
#    defaultType: XA
#    providerType: Atomikos
  - !SQL_PARSER
    sqlCommentParseEnabled: true
    sqlStatementCache:
      initialCapacity: 2000
      maximumSize: 65535
    parseTreeCache:
      initialCapacity: 128
      maximumSize: 1024
</code></pre></div>
<p dir="auto">Global rules in ZK after Proxy 3307 started:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- !AUTHORITY
  provider:
    type: ALL_PERMITTED
  users:
  - root@%:root
  - sharding@%:sharding
- !SQL_PARSER
  parseTreeCache:
    initialCapacity: 128
    maximumSize: 1024
  sqlCommentParseEnabled: true
  sqlStatementCache:
    initialCapacity: 2000
    maximumSize: 65535"><pre class="notranslate"><code class="notranslate">- !AUTHORITY
  provider:
    type: ALL_PERMITTED
  users:
  - root@%:root
  - sharding@%:sharding
- !SQL_PARSER
  parseTreeCache:
    initialCapacity: 128
    maximumSize: 1024
  sqlCommentParseEnabled: true
  sqlStatementCache:
    initialCapacity: 2000
    maximumSize: 65535
</code></pre></div>
<p dir="auto">1, Start Proxy with 3307 port</p>
<p dir="auto">2, Start another Proxy with 3308 port</p>
<p dir="auto">The second one will start failed with exception:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[ERROR] 2022-07-06 15:16:50.805 [main] c.a.persistence.imp.LogFileLock - The specified log seems to be in use already: xa_tx in ./logs/. Make sure that no other instance is running, or kill any pending process if needed.
Exception in thread &quot;main&quot; com.atomikos.icatch.SysException: Error in init: The specified log seems to be in use already: xa_tx in ./logs/. Make sure that no other instance is running, or kill any pending process if needed.
	at com.atomikos.icatch.provider.imp.AssemblerImp.createRepository(AssemblerImp.java:200)
	at com.atomikos.icatch.provider.imp.AssemblerImp.assembleTransactionService(AssemblerImp.java:170)
	at com.atomikos.icatch.config.Configuration.assembleSystemComponents(Configuration.java:424)
	at com.atomikos.icatch.config.Configuration.init(Configuration.java:390)
	at com.atomikos.icatch.config.UserTransactionServiceImp.initialize(UserTransactionServiceImp.java:100)
	at com.atomikos.icatch.config.UserTransactionServiceImp.init(UserTransactionServiceImp.java:189)
	at org.apache.shardingsphere.transaction.xa.atomikos.manager.AtomikosTransactionManagerProvider.init(AtomikosTransactionManagerProvider.java:46)
	at org.apache.shardingsphere.transaction.xa.XAShardingSphereTransactionManager.init(XAShardingSphereTransactionManager.java:55)
	at org.apache.shardingsphere.transaction.ShardingSphereTransactionManagerEngine.lambda$init$0(ShardingSphereTransactionManagerEngine.java:66)
	at java.util.Map.forEach(Map.java:630)
	at org.apache.shardingsphere.transaction.ShardingSphereTransactionManagerEngine.init(ShardingSphereTransactionManagerEngine.java:66)
	at org.apache.shardingsphere.transaction.rule.TransactionRule.createTransactionManagerEngine(TransactionRule.java:75)
	at org.apache.shardingsphere.transaction.rule.TransactionRule.createTransactionManagerEngines(TransactionRule.java:67)
	at org.apache.shardingsphere.transaction.rule.TransactionRule.&lt;init&gt;(TransactionRule.java:61)
	at org.apache.shardingsphere.transaction.rule.builder.TransactionRuleBuilder.build(TransactionRuleBuilder.java:36)
	at org.apache.shardingsphere.transaction.rule.builder.TransactionRuleBuilder.build(TransactionRuleBuilder.java:32)
	at org.apache.shardingsphere.infra.rule.builder.global.GlobalRulesBuilder.buildRules(GlobalRulesBuilder.java:53)
	at org.apache.shardingsphere.mode.manager.cluster.ClusterContextManagerBuilder.buildMetaDataContexts(ClusterContextManagerBuilder.java:91)
	at org.apache.shardingsphere.mode.manager.cluster.ClusterContextManagerBuilder.build(ClusterContextManagerBuilder.java:69)
	at org.apache.shardingsphere.proxy.initializer.BootstrapInitializer.createContextManager(BootstrapInitializer.java:66)
	at org.apache.shardingsphere.proxy.initializer.BootstrapInitializer.init(BootstrapInitializer.java:55)
	at org.apache.shardingsphere.proxy.Bootstrap.main(Bootstrap.java:50)
Caused by: com.atomikos.recovery.LogException: The specified log seems to be in use already: xa_tx in ./logs/. Make sure that no other instance is running, or kill any pending process if needed.
	at com.atomikos.persistence.imp.LogFileLock.acquireLock(LogFileLock.java:60)
	at com.atomikos.recovery.fs.FileSystemRepository.init(FileSystemRepository.java:53)
	at com.atomikos.icatch.provider.imp.AssemblerImp.createCoordinatorLogEntryRepository(AssemblerImp.java:248)
	at com.atomikos.icatch.provider.imp.AssemblerImp.createRepository(AssemblerImp.java:198)
	... 21 more"><pre class="notranslate"><code class="notranslate">[ERROR] 2022-07-06 15:16:50.805 [main] c.a.persistence.imp.LogFileLock - The specified log seems to be in use already: xa_tx in ./logs/. Make sure that no other instance is running, or kill any pending process if needed.
Exception in thread "main" com.atomikos.icatch.SysException: Error in init: The specified log seems to be in use already: xa_tx in ./logs/. Make sure that no other instance is running, or kill any pending process if needed.
	at com.atomikos.icatch.provider.imp.AssemblerImp.createRepository(AssemblerImp.java:200)
	at com.atomikos.icatch.provider.imp.AssemblerImp.assembleTransactionService(AssemblerImp.java:170)
	at com.atomikos.icatch.config.Configuration.assembleSystemComponents(Configuration.java:424)
	at com.atomikos.icatch.config.Configuration.init(Configuration.java:390)
	at com.atomikos.icatch.config.UserTransactionServiceImp.initialize(UserTransactionServiceImp.java:100)
	at com.atomikos.icatch.config.UserTransactionServiceImp.init(UserTransactionServiceImp.java:189)
	at org.apache.shardingsphere.transaction.xa.atomikos.manager.AtomikosTransactionManagerProvider.init(AtomikosTransactionManagerProvider.java:46)
	at org.apache.shardingsphere.transaction.xa.XAShardingSphereTransactionManager.init(XAShardingSphereTransactionManager.java:55)
	at org.apache.shardingsphere.transaction.ShardingSphereTransactionManagerEngine.lambda$init$0(ShardingSphereTransactionManagerEngine.java:66)
	at java.util.Map.forEach(Map.java:630)
	at org.apache.shardingsphere.transaction.ShardingSphereTransactionManagerEngine.init(ShardingSphereTransactionManagerEngine.java:66)
	at org.apache.shardingsphere.transaction.rule.TransactionRule.createTransactionManagerEngine(TransactionRule.java:75)
	at org.apache.shardingsphere.transaction.rule.TransactionRule.createTransactionManagerEngines(TransactionRule.java:67)
	at org.apache.shardingsphere.transaction.rule.TransactionRule.&lt;init&gt;(TransactionRule.java:61)
	at org.apache.shardingsphere.transaction.rule.builder.TransactionRuleBuilder.build(TransactionRuleBuilder.java:36)
	at org.apache.shardingsphere.transaction.rule.builder.TransactionRuleBuilder.build(TransactionRuleBuilder.java:32)
	at org.apache.shardingsphere.infra.rule.builder.global.GlobalRulesBuilder.buildRules(GlobalRulesBuilder.java:53)
	at org.apache.shardingsphere.mode.manager.cluster.ClusterContextManagerBuilder.buildMetaDataContexts(ClusterContextManagerBuilder.java:91)
	at org.apache.shardingsphere.mode.manager.cluster.ClusterContextManagerBuilder.build(ClusterContextManagerBuilder.java:69)
	at org.apache.shardingsphere.proxy.initializer.BootstrapInitializer.createContextManager(BootstrapInitializer.java:66)
	at org.apache.shardingsphere.proxy.initializer.BootstrapInitializer.init(BootstrapInitializer.java:55)
	at org.apache.shardingsphere.proxy.Bootstrap.main(Bootstrap.java:50)
Caused by: com.atomikos.recovery.LogException: The specified log seems to be in use already: xa_tx in ./logs/. Make sure that no other instance is running, or kill any pending process if needed.
	at com.atomikos.persistence.imp.LogFileLock.acquireLock(LogFileLock.java:60)
	at com.atomikos.recovery.fs.FileSystemRepository.init(FileSystemRepository.java:53)
	at com.atomikos.icatch.provider.imp.AssemblerImp.createCoordinatorLogEntryRepository(AssemblerImp.java:248)
	at com.atomikos.icatch.provider.imp.AssemblerImp.createRepository(AssemblerImp.java:198)
	... 21 more
</code></pre></div>
<h3 dir="auto">Example codes for reproduce this issue (such as a github link).</h3>