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/06/19 05:20:43 UTC

[GitHub] [shardingsphere] AINewBegin opened a new issue #6131: srping boot pom with shardingsphere-jdbc 4.0.0,preoject start error,cant define entiryManagerFactory

AINewBegin opened a new issue #6131:
URL: https://github.com/apache/shardingsphere/issues/6131


   ## Question
   
   just one simple test,when i use the package <artifactId>sharding-jdbc-spring-boot-starter</artifactId> 4.0.0,application cant start and report one error ,said there is no entityManagerFactory 
   
   pom
   ```
   <?xml version="1.0" encoding="UTF-8"?>
   <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
       <modelVersion>4.0.0</modelVersion>
       <parent>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-starter-parent</artifactId>
           <version>2.2.1.RELEASE</version>
           <relativePath/> <!-- lookup parent from repository -->
       </parent>
       <groupId>glf.ainewbegin</groupId>
       <artifactId>japquerylearn</artifactId>
       <version>0.0.1-SNAPSHOT</version>
       <name>japquerylearn</name>
       <description>Demo project for Spring Boot</description>
   
       <properties>
           <java.version>1.8</java.version>
           <fastjson.version>1.2.58</fastjson.version>
           <sharding-sphere.version>4.1.0</sharding-sphere.version>
       </properties>
   
       <dependencies>
           <dependency>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-starter-data-jpa</artifactId>
           </dependency>
           <dependency>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-starter-web</artifactId>
           </dependency>
   
           <dependency>
               <groupId>org.projectlombok</groupId>
               <artifactId>lombok</artifactId>
               <optional>true</optional>
           </dependency>
   
           <dependency>
               <groupId>mysql</groupId>
               <artifactId>mysql-connector-java</artifactId>
               <scope>runtime</scope>
           </dependency>
   
           <dependency>
               <groupId>com.alibaba</groupId>
               <artifactId>fastjson</artifactId>
               <version>${fastjson.version}</version>
           </dependency>
   
   
           <dependency>
               <groupId>com.querydsl</groupId>
               <artifactId>querydsl-jpa</artifactId>
               <version>4.3.1</version>
           </dependency>
           <dependency>
               <groupId>com.querydsl</groupId>
               <artifactId>querydsl-apt</artifactId>
               <scope>provided</scope>
           </dependency>
   
           <dependency>
               <groupId>org.apache.commons</groupId>
               <artifactId>commons-pool2</artifactId>
               <version>2.6.1</version>
           </dependency>
   
           <dependency>
               <groupId>org.apache.shardingsphere</groupId>
               <artifactId>sharding-jdbc-spring-boot-starter</artifactId>
               <version>4.0.0</version>
           </dependency>
   
   
   
           <dependency>
               <groupId>com.alibaba</groupId>
               <artifactId>druid-spring-boot-starter</artifactId>
               <version>1.1.20</version>
           </dependency>
   
           <dependency>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-starter-test</artifactId>
               <scope>test</scope>
               <exclusions>
                   <exclusion>
                       <groupId>org.junit.vintage</groupId>
                       <artifactId>junit-vintage-engine</artifactId>
                   </exclusion>
               </exclusions>
           </dependency>
       </dependencies>
   
       <build>
           <plugins>
               <plugin>
                   <groupId>org.springframework.boot</groupId>
                   <artifactId>spring-boot-maven-plugin</artifactId>
               </plugin>
   
               <plugin>
                   <groupId>com.mysema.maven</groupId>
                   <artifactId>apt-maven-plugin</artifactId>
                   <version>1.1.3</version>
                   <executions>
                       <execution>
                           <goals>
                               <goal>process</goal>
                           </goals>
                           <configuration>
                               <outputDirectory>target/generated-sources/java</outputDirectory>
                               <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
                           </configuration>
                       </execution>
                   </executions>
               </plugin>
           </plugins>
       </build>
   
   </project>
   
   ```
   
   
   application.properties
   ```
   spring.datasource.url=jdbc:mysql://localhost:3306/developer_use?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&useSSL=true
   spring.datasource.username=root
   spring.datasource.password=root
   spring.datasource.driver-class-name=com.mysql.jdbc.Driver
   spring.jpa.show-sql=true
   spring.jpa.hibernate.ddl-auto=update
   ```
   
   ERROR 
   
   ```
   ***************************
   APPLICATION FAILED TO START
   ***************************
   
   Description:
   
   Parameter 1 of method requestMappingHandlerAdapter in org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport required a bean named 'entityManagerFactory' that could not be found.
   
   The injection point has the following annotations:
   	- @org.springframework.beans.factory.annotation.Qualifier(value=mvcConversionService)
   
   
   Action:
   
   Consider defining a bean named 'entityManagerFactory' in your configuration.
   
   Disconnected from the target VM, address: '127.0.0.1:64031', transport: 'socket'
   
   
   ```
   


----------------------------------------------------------------
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] AFatMan commented on issue #6131: srping boot pom with shardingsphere-jdbc 4.0.0,preoject start error,cant define entiryManagerFactory

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


   i had the same problem,how can i fix it?


-- 
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] AFatMan edited a comment on issue #6131: srping boot pom with shardingsphere-jdbc 4.0.0,preoject start error,cant define entiryManagerFactory

Posted by GitBox <gi...@apache.org>.
AFatMan edited a comment on issue #6131:
URL: https://github.com/apache/shardingsphere/issues/6131#issuecomment-854440644


   i think i had resolve the problem
   i change the 
   ```
   <dependency>
       <groupId>com.alibaba</groupId>
       <artifactId>druid-spring-boot-starter</artifactId>
       <version>${druid.version}</version>
   </dependency>
   ```
   to
   ```
   <dependency>
       <groupId>com.alibaba</groupId>
       <artifactId>druid</artifactId>
       <version>1.2.6</version>
   </dependency>
   ```
   
   and then when the project use **swagger**
   the program may jump out an error about **"Failed to start bean 'documentationPluginsBootstrapper'"**
   
   ignore the guava from shardingsphere can fix this problem
   ```
   <dependency>
       <groupId>org.apache.shardingsphere</groupId>
       <artifactId>sharding-jdbc-spring-boot-starter</artifactId>
       <!--ignore guava -->
       <exclusions>
           <exclusion>
               <groupId>com.google.guava</groupId>
               <artifactId>guava</artifactId>
           </exclusion>
       </exclusions>
       <version>4.1.1</version>
   </dependency>
   ```
   


-- 
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] AFatMan commented on issue #6131: srping boot pom with shardingsphere-jdbc 4.0.0,preoject start error,cant define entiryManagerFactory

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


   i think i had resolve the problem
   i change the 
   ```
   <dependency>
       <groupId>com.alibaba</groupId>
       <artifactId>druid-spring-boot-starter</artifactId>
       <version>${druid.version}</version>
   </dependency>
   ```
   to
   ```
   <dependency>
       <groupId>com.alibaba</groupId>
       <artifactId>druid</artifactId>
       <version>1.2.6</version>
   </dependency>
   ```
   
   and then when the project use **swagger**
   the project maybe product an error **"Failed to start bean 'documentationPluginsBootstrapper'"**
   
   ignore the guava from shardingsphere can fix this problem
   ```
   <dependency>
       <groupId>org.apache.shardingsphere</groupId>
       <artifactId>sharding-jdbc-spring-boot-starter</artifactId>
       <!--ignore guava -->
       <exclusions>
           <exclusion>
               <groupId>com.google.guava</groupId>
               <artifactId>guava</artifactId>
           </exclusion>
       </exclusions>
       <version>4.1.1</version>
   </dependency>
   ```
   


-- 
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] AFatMan commented on issue #6131: srping boot pom with shardingsphere-jdbc 4.0.0,preoject start error,cant define entiryManagerFactory

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






-- 
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] AINewBegin commented on issue #6131: srping boot pom with shardingsphere-jdbc 4.0.0,preoject start error,cant define entiryManagerFactory

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


   so,what i should do to create one entityManagerFactory that can be used by shardingsphrer jdbc


----------------------------------------------------------------
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] AFatMan edited a comment on issue #6131: srping boot pom with shardingsphere-jdbc 4.0.0,preoject start error,cant define entiryManagerFactory

Posted by GitBox <gi...@apache.org>.
AFatMan edited a comment on issue #6131:
URL: https://github.com/apache/shardingsphere/issues/6131#issuecomment-854440644


   i think i had resolve the problem
   i change the 
   ```
   <dependency>
       <groupId>com.alibaba</groupId>
       <artifactId>druid-spring-boot-starter</artifactId>
       <version>${druid.version}</version>
   </dependency>
   ```
   to
   ```
   <dependency>
       <groupId>com.alibaba</groupId>
       <artifactId>druid</artifactId>
       <version>1.2.6</version>
   </dependency>
   ```
   
   and then when the project use **swagger**
   the program may jump out an error about **"Failed to start bean 'documentationPluginsBootstrapper'"**
   
   ignore the guava from shardingsphere can fix this problem
   ```
   <dependency>
       <groupId>org.apache.shardingsphere</groupId>
       <artifactId>sharding-jdbc-spring-boot-starter</artifactId>
       <!--ignore guava -->
       <exclusions>
           <exclusion>
               <groupId>com.google.guava</groupId>
               <artifactId>guava</artifactId>
           </exclusion>
       </exclusions>
       <version>4.1.1</version>
   </dependency>
   ```
   


-- 
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] AINewBegin closed issue #6131: srping boot pom with shardingsphere-jdbc 4.0.0,preoject start error,cant define entiryManagerFactory

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


   


----------------------------------------------------------------
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