主题:springboot2.0整合beetlsql报错

ko889910 2019年02月27日 69

两个几乎完全一样的工程一个成功另一个失败,成功的那个是将springboot2.0精髓第五章整合的代码稍微修改了下,改成oracle版本的,失败的那个pom依赖完全一样工程结构也一样,只是model不一样

成功的工程的pom

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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.bee.sample ch5.beetlsql 0.0.1-SNAPSHOT   org.springframework.boot  spring-boot-starter-parent  2.0.0.M7        org.springframework.boot   spring-boot-starter-web       org.springframework.boot   spring-boot-devtools   true       org.springframework.boot   spring-boot-starter-jdbc                com.ibeetl            beetl-framework-starter            1.1.23.RELEASE          com.zaxxer   HikariCP         com.oracle    ojdbc6    11.2.0.3               org.springframework.boot    spring-boot-maven-plugin              spring-snapshots   http://repo.spring.io/snapshot       true          spring-milestones   http://repo.spring.io/milestone         spring-snapshots   http://repo.spring.io/snapshot       spring-milestones   http://repo.spring.io/milestone   

成功的sql1.png

成功的配置文件2.png


失败的pom

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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.lk.ruleGenerate dataModel 0.0.1-SNAPSHOT   org.springframework.boot  spring-boot-starter-parent  2.0.0.M7        org.springframework.boot   spring-boot-starter-web       org.springframework.boot   spring-boot-devtools   true       org.springframework.boot   spring-boot-starter-jdbc         com.ibeetl   beetl-framework-starter   1.1.23.RELEASE       com.zaxxer   HikariCP       com.oracle   ojdbc6   11.2.0.3              org.springframework.boot    spring-boot-maven-plugin              spring-snapshots   http://repo.spring.io/snapshot       true          spring-milestones   http://repo.spring.io/milestone         spring-snapshots   http://repo.spring.io/snapshot       spring-milestones   http://repo.spring.io/milestone   


失败的sql3.png



配置文件

4.png


下面是报错信息(换了最新版本的beetlsql还是一样)

11:40:34.497 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Included patterns for restart : []11:40:34.505 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Excluded patterns for restart : [/spring-boot-starter/target/classes/, /spring-boot-autoconfigure/target/classes/, /spring-boot-starter-[\w-]+/, /spring-boot/target/classes/, /spring-boot-actuator/target/classes/, /spring-boot-devtools/target/classes/]11:40:34.505 [main] DEBUG org.springframework.boot.devtools.restart.ChangeableUrls - Matching URLs for reloading : [file:/C:/Users/ko889910/eclipse-workspace/dataModel/target/classes/]  .   ____          _            __ _ _ /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/  ___)| |_)| | | | | || (_| |  ) ) ) )  '  |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot ::             (v2.0.0.M7)2019-02-27 11:40:35.416  INFO 27224 --- [  restartedMain] c.lk.rulegenerate.datamodel.Application  : Starting Application on DESKTOP-SRLI51N with PID 27224 (C:\Users\ko889910\eclipse-workspace\dataModel\target\classes started by ko889910 in C:\Users\ko889910\eclipse-workspace\dataModel)2019-02-27 11:40:35.422  INFO 27224 --- [  restartedMain] c.lk.rulegenerate.datamodel.Application  : No active profile set, falling back to default profiles: default2019-02-27 11:40:35.680  INFO 27224 --- [  restartedMain] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@eb9912d: startup date [Wed Feb 27 11:40:35 CST 2019]; root of context hierarchy2019-02-27 11:40:40.515  INFO 27224 --- [  restartedMain] o.h.v.i.engine.ValidatorFactoryImpl      : HV000238: Temporal validation tolerance set to 0.2019-02-27 11:40:42.379  INFO 27224 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)2019-02-27 11:40:42.402  INFO 27224 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]2019-02-27 11:40:42.404  INFO 27224 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.232019-02-27 11:40:42.437  INFO 27224 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : Loaded APR based Apache Tomcat Native library [1.2.19] using APR version [1.6.5].2019-02-27 11:40:42.438  INFO 27224 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].2019-02-27 11:40:42.438  INFO 27224 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]2019-02-27 11:40:42.449  INFO 27224 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : OpenSSL successfully initialized [OpenSSL 1.1.1a  20 Nov 2018]2019-02-27 11:40:42.642  INFO 27224 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext2019-02-27 11:40:42.642  INFO 27224 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 6973 ms2019-02-27 11:40:43.082  INFO 27224 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]2019-02-27 11:40:43.090  INFO 27224 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]2019-02-27 11:40:43.091  INFO 27224 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]2019-02-27 11:40:43.091  INFO 27224 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]2019-02-27 11:40:43.091  INFO 27224 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]BeetlSQL 运行在 product=false,md charset=UTF-82019-02-27 11:40:43.737  INFO 27224 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...2019-02-27 11:40:44.252  INFO 27224 --- [  restartedMain] com.zaxxer.hikari.pool.PoolBase          : HikariPool-1 - Driver does not support get/set network timeout for connections. (oracle.jdbc.driver.T4CConnection.getNetworkTimeout()I)2019-02-27 11:40:44.260  INFO 27224 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.2019-02-27 11:40:44.297  WARN 27224 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '/main': Unsatisfied dependency expressed through field 'mainService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mainServiceImpl': Unsatisfied dependency expressed through field 'mainModelDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mainModelDao': FactoryBean threw exception on object creation; nested exception is java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class2019-02-27 11:40:44.297  INFO 27224 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...2019-02-27 11:40:44.304  INFO 27224 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.2019-02-27 11:40:44.309  INFO 27224 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]2019-02-27 11:40:44.341  INFO 27224 --- [  restartedMain] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.2019-02-27 11:40:44.350 ERROR 27224 --- [  restartedMain] o.s.boot.SpringApplication               : Application startup failedorg.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '/main': Unsatisfied dependency expressed through field 'mainService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mainServiceImpl': Unsatisfied dependency expressed through field 'mainModelDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mainModelDao': FactoryBean threw exception on object creation; nested exception is java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:586) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:372) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1344) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:758) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868) ~[spring-context-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:138) ~[spring-boot-2.0.0.M7.jar:2.0.0.M7] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:751) [spring-boot-2.0.0.M7.jar:2.0.0.M7] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:387) [spring-boot-2.0.0.M7.jar:2.0.0.M7] at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.0.M7.jar:2.0.0.M7] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1245) [spring-boot-2.0.0.M7.jar:2.0.0.M7] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1233) [spring-boot-2.0.0.M7.jar:2.0.0.M7] at com.lk.rulegenerate.datamodel.Application.main(Application.java:9) [classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_191] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_191] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_191] at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_191] at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.0.0.M7.jar:2.0.0.M7]Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mainServiceImpl': Unsatisfied dependency expressed through field 'mainModelDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mainModelDao': FactoryBean threw exception on object creation; nested exception is java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:586) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:372) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1344) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1135) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1062) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:583) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] ... 24 common frames omittedCaused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mainModelDao': FactoryBean threw exception on object creation; nested exception is java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:169) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:101) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1640) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:1178) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1135) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1062) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:583) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] ... 37 common frames omittedCaused by: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class at org.beetl.sql.core.mapper.MapperJavaProxy.onResolveEntityClassFromMapperInterface(MapperJavaProxy.java:111) ~[beetlsql-2.10.45.jar:na] at org.beetl.sql.core.mapper.MapperJavaProxy.mapperInterface(MapperJavaProxy.java:68) ~[beetlsql-2.10.45.jar:na] at org.beetl.sql.core.mapper.MapperJava8Proxy.mapperInterface(MapperJava8Proxy.java:48) ~[beetlsql-2.10.45.jar:na] at org.beetl.sql.core.mapper.MapperJava8Proxy.mapperInterface(MapperJava8Proxy.java:21) ~[beetlsql-2.10.45.jar:na] at org.beetl.sql.core.mapper.MapperJavaProxy.(MapperJavaProxy.java:56) ~[beetlsql-2.10.45.jar:na] at org.beetl.sql.core.mapper.MapperJava8Proxy.(MapperJava8Proxy.java:36) ~[beetlsql-2.10.45.jar:na] at org.beetl.sql.core.mapper.DefaultMapperBuilder.buildInstance(DefaultMapperBuilder.java:83) ~[beetlsql-2.10.45.jar:na] at org.beetl.sql.core.mapper.DefaultMapperBuilder.getMapper(DefaultMapperBuilder.java:63) ~[beetlsql-2.10.45.jar:na] at org.beetl.sql.core.SQLManager.getMapper(SQLManager.java:1926) ~[beetlsql-2.10.45.jar:na] at org.beetl.sql.ext.spring4.BeetlSqlFactoryBean.getObject(BeetlSqlFactoryBean.java:29) ~[beetlsql-2.10.45.jar:na] at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:162) ~[spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE] ... 46 common frames omitted

闲大赋 2019年02月27日

看看你的dao怎么定义的,你的dao接口应该继承BaseMapper,并指定一个Entity

public User implements BaseMapper
  • ko889910 :果然是这边的问题 (2019年02月27日)