jboot生成代码时提示  jdbcUrl is required with driverClassName

萧天帝 发布于 2018/05/12 15:40
阅读 1K+
收藏 0

【Gopher China万字分享】华为云的Go语言云原生实战经验!>>>

Exception in thread "main" java.lang.IllegalArgumentException: jdbcUrl is required with driverClassName.
	at com.zaxxer.hikari.HikariConfig.validate(HikariConfig.java:971)
	at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:77)
	at io.jboot.codegen.CodeGenHelpler.getDatasource(CodeGenHelpler.java:52)
	at io.jboot.codegen.CodeGenHelpler.createMetaBuilder(CodeGenHelpler.java:57)
	at io.jboot.codegen.model.JbootModelGenerator.doGenerate(JbootModelGenerator.java:67)
	at io.jboot.codegen.model.JbootModelGenerator.run(JbootModelGenerator.java:40)
	at cn.com.xuelj.gen.CodeGenerator.main(CodeGenerator.java:20)

jboot生成代码时提示  jdbcUrl is required with driverClassName

并且访问数据库也访问不到

java.lang.NullPointerException
	at com.jfinal.plugin.activerecord.Db.find(Db.java:279)
	at cn.com.xuelj.controller.IndexController.dbtest(IndexController.java:21)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.jfinal.aop.Invocation.invoke(Invocation.java:73)
	at io.jboot.web.fixedinterceptor.FixedInvocation.invoke(FixedInvocation.java:46)
	at io.jboot.component.metric.JbootMetricInterceptor.intercept(JbootMetricInterceptor.java:104)
	at io.jboot.web.fixedinterceptor.FixedInvocation.invoke(FixedInvocation.java:44)
	at io.jboot.component.opentracing.OpentracingInterceptor.intercept(OpentracingInterceptor.java:49)
	at io.jboot.web.fixedinterceptor.FixedInvocation.invoke(FixedInvocation.java:44)
	at io.jboot.component.shiro.JbootShiroInterceptor.intercept(JbootShiroInterceptor.java:33)
	at io.jboot.web.fixedinterceptor.FixedInvocation.invoke(FixedInvocation.java:44)
	at io.jboot.component.jwt.JwtInterceptor.intercept(JwtInterceptor.java:38)
	at io.jboot.web.fixedinterceptor.FixedInvocation.invoke(FixedInvocation.java:44)
	at io.jboot.web.controller.validate.ParaValidateInterceptor.intercept(ParaValidateInterceptor.java:47)
	at io.jboot.web.fixedinterceptor.FixedInvocation.invoke(FixedInvocation.java:44)
	at io.jboot.web.limitation.LimitationInterceptor.intercept(LimitationInterceptor.java:42)
	at io.jboot.web.fixedinterceptor.FixedInvocation.invoke(FixedInvocation.java:44)
	at io.jboot.web.cors.CORSInterceptor.intercept(CORSInterceptor.java:46)
	at io.jboot.web.fixedinterceptor.FixedInvocation.invoke(FixedInvocation.java:44)
	at io.jboot.web.handler.JbootActionHandler.invokeInvocation(JbootActionHandler.java:187)
	at io.jboot.web.handler.JbootActionHandler.handle(JbootActionHandler.java:88)
	at io.jboot.web.handler.JbootHandler.doHandle(JbootHandler.java:89)
	at io.jboot.web.handler.JbootHandler.handle(JbootHandler.java:74)
	at io.jboot.web.cache.ActionCacheHandler.handle(ActionCacheHandler.java:64)
	at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:73)
	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:67)
	at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
	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:292)
	at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
	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:272)
	at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
	at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:360)
	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

 

程序代码

@RequestMapping("/")
public class IndexController extends JbootController {
	
	public void index() {
        renderText("Hello World Jboot");
    }
	
	public void dbtest(){
        List<Record> records = Db.find("select * from Sys_User");
        renderJson(records);
    }


    public static void main(String[] args) {
        Jboot.run(args);
    }	

}

jboot.proerties文件配置

jboot.datasource.type=mysql
jboot.datasource.url=jdbc:mysql://127.0.0.1:3306/jbootdemo
jboot.datasource.user=root
jboot.datasource.password=root

加载中
0
萧天帝

问题已解决

官网的资源文件名称写错了,我是复制的资源文件名称建立的,所以也错了,找不到资源文件

返回顶部
顶部