代码生成报错

Java 未结 1 1608
杨彦彬
杨彦彬 2019-12-05 17:05

一、该问题的重现步骤是什么?

  1. 报错信息如下:

  2. java.sql.SQLSyntaxErrorException: Unknown database 'bladex'
     at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
     at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
     at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
     at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:827)
     at com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:447)
     at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:237)
     at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199)
     at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
     at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228)
     at com.baomidou.mybatisplus.generator.config.DataSourceConfig.getConn(DataSourceConfig.java:197)
     at com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder.handlerDataSource(ConfigBuilder.java:269)
     at com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder.(ConfigBuilder.java:132)
     at com.baomidou.mybatisplus.generator.AutoGenerator.execute(AutoGenerator.java:92)
     at org.springblade.develop.support.BladeCodeGenerator.run(BladeCodeGenerator.java:201)
     at org.springblade.develop.controller.CodeController.lambda$genCode$0(CodeController.java:146)
     at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
     at org.springblade.develop.controller.CodeController.genCode(CodeController.java:125)
     at org.springblade.develop.controller.CodeController$$FastClassBySpringCGLIB$$34ab753d.invoke()
     at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
     at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:750)
     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
     at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
     at org.springblade.core.secure.aspect.AuthAspect.preAuth(AuthAspect.java:67)
     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.base/java.lang.reflect.Method.invoke(Method.java:566)
     at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
     at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
     at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
     at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
     at org.springblade.core.log.aspect.RequestLogAspect.aroundApi(RequestLogAspect.java:181)
     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.base/java.lang.reflect.Method.invoke(Method.java:566)
     at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
     at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
     at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
     at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)
     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
     at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)
     at org.springblade.develop.controller.CodeController$$EnhancerBySpringCGLIB$$5e33408a.genCode()
     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.base/java.lang.reflect.Method.invoke(Method.java:566)
     at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
     at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
     at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)
     at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:893)
     at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:798)
     at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
     at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
     at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
     at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
     at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:665)
     at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)
     at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
     at com.github.xiaoymin.swaggerbootstrapui.filter.SecurityBasicAuthFilter.doFilter(SecurityBasicAuthFilter.java:84)
     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
     at com.github.xiaoymin.swaggerbootstrapui.filter.ProductionSecurityFilter.doFilter(ProductionSecurityFilter.java:53)
     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
     at org.springblade.core.log.filter.LogTraceFilter.doFilter(LogTraceFilter.java:39)
     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
     at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:88)
     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
     at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
     at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
     at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:94)
     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
     at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:114)
     at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:104)
     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
     at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
     at com.alibaba.csp.sentinel.adapter.servlet.CommonFilter.doFilter(CommonFilter.java:91)
     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
     at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
     at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
     at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
     at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
     at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
     at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132)
     at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
     at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
     at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
     at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
     at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
     at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
     at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
     at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
     at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
     at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:269)
     at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:78)
     at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:133)
     at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:130)
     at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
     at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
     at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:249)
     at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:78)
     at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:99)
     at io.undertow.server.Connectors.executeRootHandler(Connectors.java:376)
     at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
     at java.base/java.lang.Thread.run(Thread.java:834)


麻烦帮忙看一下,谢谢。



1条回答
  •  zhx1994
    zhx1994 (楼主)
    2019-12-05 17:07

    Unknown database 'bladex'

    你没有新建这个库

    作者追问:2019-12-05 17:07

    image.png

    有这个数据库

    0 讨论(1)
提交回复