You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/05/27 03:59:26 UTC

[GitHub] [shardingsphere] Gkytbn opened a new issue #5810: 使用maven-shade-plugin打包为单独jar运行时报 Cannot support database type 'MySQL'

Gkytbn opened a new issue #5810:
URL: https://github.com/apache/shardingsphere/issues/5810


   
   我的项目是一个普通的main方法启动的jar,里面使用了 shardingsphere 查询分表的数据
   项目在idea中运行正常,一旦打包为独立jar(依赖打进jar内)后 启动就会报错 Cannot support database type 'MySQL'。
   
   ##pom文件如
   ```
    <plugin>
                               <groupId>org.apache.maven.plugins</groupId>
                               <artifactId>maven-shade-plugin</artifactId>
                               <version>3.2.2</version>
                               <executions>
                                   <execution>
                                       <phase>package</phase>
                                       <goals>
                                           <goal>shade</goal>
                                       </goals>
   
                                       <configuration>
                                           <minimizeJar>false</minimizeJar>
                                           <transformers>
                                               <transformer
                                                       implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                                   <mainClass>com.xxxxx.xxxxx</mainClass>
                                               </transformer>
                                           </transformers>
                                       </configuration>
   
                                   </execution>
                               </executions>
                               <configuration>
                                   <createDependencyReducedPom>false</createDependencyReducedPom>
                                   <artifactSet>
                                       <excludes>
                                           <exclude>commons-logging:commons-logging</exclude>-->
                                           <exclude>javax.servlet:servlet-api</exclude>
      
                                       </excludes>
                                   </artifactSet>
   
   
                               </configuration>
                           </plugin>
   
   
   
   ```
   ##错误如下
   ```
   java.lang.UnsupportedOperationException: Cannot support database type 'MySQL'
   	at org.apache.shardingsphere.sql.parser.core.parser.SQLParserFactory.newInstance(SQLParserFactory.java:55)
   	at org.apache.shardingsphere.sql.parser.core.parser.SQLParserExecutor.towPhaseParse(SQLParserExecutor.java:55)
   	at org.apache.shardingsphere.sql.parser.core.parser.SQLParserExecutor.execute(SQLParserExecutor.java:47)
   	at org.apache.shardingsphere.sql.parser.SQLParserEngine.parse0(SQLParserEngine.java:79)
   	at org.apache.shardingsphere.sql.parser.SQLParserEngine.parse(SQLParserEngine.java:61)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.metadata.ShardingParameterMetaData.getParameterCount(ShardingParameterMetaData.java:36)
   ```
   
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] Gkytbn commented on issue #5810: want use maven-shade-plugin to build a single jar(all libs inside ) ,but throw error Cannot support database type 'MySQL'

Posted by GitBox <gi...@apache.org>.
Gkytbn commented on issue #5810:
URL: https://github.com/apache/shardingsphere/issues/5810#issuecomment-634446972


   Sorry, the problem is solved。just need marge the file  META-INF/services/org.apache.shardingsphere.sql.parser.spi.SQLParserConfiguration.
   
   The pom file are floower.
   
   ```
     <plugin>
                   <groupId>org.apache.maven.plugins</groupId>
                   <artifactId>maven-shade-plugin</artifactId>
                   <version>3.2.2</version>
                   <executions>
                       <execution>
                           <phase>package</phase>
                           <goals>
                               <goal>shade</goal>
                           </goals>
   
                           <configuration>
                               <minimizeJar>false</minimizeJar>
                               <transformers>
                                   <transformer
                                           implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                       <mainClass>com.xxxx.xxxx</mainClass>
                                   </transformer>
   
                                   <transformer
                                           implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                       <resource>
                                           META-INF/services/org.apache.shardingsphere.sql.parser.spi.SQLParserConfiguration
                                       </resource>
                                   </transformer>
                               </transformers>
                           </configuration>
   
                       </execution>
                   </executions>
                   <configuration>
                       <createDependencyReducedPom>false</createDependencyReducedPom>
                       <artifactSet>
                           <excludes>
                              
                               <exclude>commons-logging:commons-logging</exclude>-->
                               <exclude>javax.servlet:servlet-api</exclude>
                              
                           </excludes>
                       </artifactSet>
   
   
                   </configuration>
               </plugin>
   
   ```
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] azraelee commented on issue #5810: 使用maven-shade-plugin打包为单独jar运行时报 Cannot support database type 'MySQL'

Posted by GitBox <gi...@apache.org>.
azraelee commented on issue #5810:
URL: https://github.com/apache/shardingsphere/issues/5810#issuecomment-634402471






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wang7241 commented on issue #5810: want use maven-shade-plugin to build a single jar(all libs inside ) ,but throw error Cannot support database type 'MySQL'

Posted by GitBox <gi...@apache.org>.
wang7241 commented on issue #5810:
URL: https://github.com/apache/shardingsphere/issues/5810#issuecomment-655979110


   > Sorry, the problem is solved。just need marge the file META-INF/services/org.apache.shardingsphere.sql.parser.spi.SQLParserConfiguration.
   > 
   > The pom file are floower.
   > 
   > ```
   >   <plugin>
   >                 <groupId>org.apache.maven.plugins</groupId>
   >                 <artifactId>maven-shade-plugin</artifactId>
   >                 <version>3.2.2</version>
   >                 <executions>
   >                     <execution>
   >                         <phase>package</phase>
   >                         <goals>
   >                             <goal>shade</goal>
   >                         </goals>
   > 
   >                         <configuration>
   >                             <minimizeJar>false</minimizeJar>
   >                             <transformers>
   >                                 <transformer
   >                                         implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
   >                                     <mainClass>com.xxxx.xxxx</mainClass>
   >                                 </transformer>
   > 
   >                                 <transformer
   >                                         implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
   >                                     <resource>
   >                                         META-INF/services/org.apache.shardingsphere.sql.parser.spi.SQLParserConfiguration
   >                                     </resource>
   >                                 </transformer>
   >                             </transformers>
   >                         </configuration>
   > 
   >                     </execution>
   >                 </executions>
   >                 <configuration>
   >                     <createDependencyReducedPom>false</createDependencyReducedPom>
   >                     <artifactSet>
   >                         <excludes>
   >                            
   >                             <exclude>commons-logging:commons-logging</exclude>-->
   >                             <exclude>javax.servlet:servlet-api</exclude>
   >                            
   >                         </excludes>
   >                     </artifactSet>
   > 
   > 
   >                 </configuration>
   >             </plugin>
   > ```
   
   please ignore my last question,I have solved


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] Gkytbn closed issue #5810: want use maven-shade-plugin to build a single jar(all libs inside ) ,but throw error Cannot support database type 'MySQL'

Posted by GitBox <gi...@apache.org>.
Gkytbn closed issue #5810:
URL: https://github.com/apache/shardingsphere/issues/5810


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wang7241 commented on issue #5810: want use maven-shade-plugin to build a single jar(all libs inside ) ,but throw error Cannot support database type 'MySQL'

Posted by GitBox <gi...@apache.org>.
wang7241 commented on issue #5810:
URL: https://github.com/apache/shardingsphere/issues/5810#issuecomment-655892453


   > Sorry, the problem is solved。just need marge the file META-INF/services/org.apache.shardingsphere.sql.parser.spi.SQLParserConfiguration.
   > 
   > The pom file are floower.
   > 
   > ```
   >   <plugin>
   >                 <groupId>org.apache.maven.plugins</groupId>
   >                 <artifactId>maven-shade-plugin</artifactId>
   >                 <version>3.2.2</version>
   >                 <executions>
   >                     <execution>
   >                         <phase>package</phase>
   >                         <goals>
   >                             <goal>shade</goal>
   >                         </goals>
   > 
   >                         <configuration>
   >                             <minimizeJar>false</minimizeJar>
   >                             <transformers>
   >                                 <transformer
   >                                         implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
   >                                     <mainClass>com.xxxx.xxxx</mainClass>
   >                                 </transformer>
   > 
   >                                 <transformer
   >                                         implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
   >                                     <resource>
   >                                         META-INF/services/org.apache.shardingsphere.sql.parser.spi.SQLParserConfiguration
   >                                     </resource>
   >                                 </transformer>
   >                             </transformers>
   >                         </configuration>
   > 
   >                     </execution>
   >                 </executions>
   >                 <configuration>
   >                     <createDependencyReducedPom>false</createDependencyReducedPom>
   >                     <artifactSet>
   >                         <excludes>
   >                            
   >                             <exclude>commons-logging:commons-logging</exclude>-->
   >                             <exclude>javax.servlet:servlet-api</exclude>
   >                            
   >                         </excludes>
   >                     </artifactSet>
   > 
   > 
   >                 </configuration>
   >             </plugin>
   > ```
   
   I  have a similar problem when I use sharding-jdbc-spring-namespace (4.1.1 version) Execute SQL.it reminds me Error querying database.  Cause: java.lang.UnsupportedOperationException: Cannot support database type 'MySQL'. In fact I do not understand your answer(just need marge the file META-INF/services/org.apache.shardingsphere.sql.parser.spi.SQLParserConfiguration),


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] Gkytbn commented on issue #5810: want use maven-shade-plugin to build a single jar(all libs inside ) ,but throw error Cannot support database type 'MySQL'

Posted by GitBox <gi...@apache.org>.
Gkytbn commented on issue #5810:
URL: https://github.com/apache/shardingsphere/issues/5810#issuecomment-634421062


   English version as you wish


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org