NutzCN Logo
问答 NutzDao 数据库类型问题
发布于 2570天前 作者 TuWei1992 3285 次浏览 复制 上一个帖子 下一个帖子
标签:

dbType not support : null, url jdbc:highgo://10.1.1.220:5866/dbName

这是不支持翰高数据库么???? 急啊..

15 回复

highgo数据库?没听说过啊

识别不了,会回落为mysql模式

@wendal 就是国内自己改的postgres,有自己的驱动(也是改的). 能提供支持me

来自 iPhone 6 Plus

@wendal 就是国内自己改的postgres,有自己的驱动(也是改的). 能提供支持么

来自 iPhone 6 Plus

哦,应该是兼容pgsql的吧,改一下nutz_jdbc_expert.js就好了

@wendal
我拷贝了一份expert.js到项目里,
增加了一行:

//翰高数据库
"highgo.*" : "org.nutz.dao.impl.jdbc.psql.PsqlJdbcExpert",

数据库连接信息如下:

  datasource:
    url: jdbc:highgo://10.1.1.220:5866/dbName
    driver-class-name: com.highgo.jdbc.Driver
    username: highgo
    password: highgo
    sql-script-encoding: utf-8

但是报错:

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.nutz.dao.Dao]: Factory method 'dao' threw exception; nested exception is java.lang.ExceptionInInitializerError
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
	... 44 common frames omitted
Caused by: java.lang.ExceptionInInitializerError: null
	at org.nutz.dao.impl.DaoSupport.setDataSource(DaoSupport.java:187)
	at org.nutz.dao.impl.DaoSupport.setDataSource(DaoSupport.java:178)
	at org.nutz.dao.impl.NutDao.<init>(NutDao.java:104)
	at org.nutz.dao.impl.NutDao.<init>(NutDao.java:108)
	at com.some.framework.db.nutz.config.NutzDaoAutoConfiguration.dao(NutzDaoAutoConfiguration.java:41)
	at com.some.framework.db.nutz.config.NutzDaoAutoConfiguration$$EnhancerBySpringCGLIB$$880b3e3.CGLIB$dao$0(<generated>)
	at com.some.framework.db.nutz.config.NutzDaoAutoConfiguration$$EnhancerBySpringCGLIB$$880b3e3$$FastClassBySpringCGLIB$$8430e806.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358)
	at com.some.framework.db.nutz.config.NutzDaoAutoConfiguration$$EnhancerBySpringCGLIB$$880b3e3.dao(<generated>)
	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 org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
	... 45 common frames omitted
Caused by: org.nutz.castor.FailToCastObjectException: String 'org.nutz.dao.impl.jdbc.dm.DmJdbcExpert' can not cast to Class<?>!
	at org.nutz.castor.castor.String2Class.cast(String2Class.java:43)
	at org.nutz.castor.castor.String2Class.cast(String2Class.java:12)
	at org.nutz.castor.Castors.cast(Castors.java:252)
	at org.nutz.castor.Castors.castTo(Castors.java:316)
	at org.nutz.mapl.impl.convert.ObjConvertImpl.injectMap(ObjConvertImpl.java:133)
	at org.nutz.mapl.impl.convert.ObjConvertImpl.inject(ObjConvertImpl.java:77)
	at org.nutz.mapl.impl.convert.ObjConvertImpl.convert(ObjConvertImpl.java:65)
	at org.nutz.mapl.Mapl.maplistToObj(Mapl.java:34)
	at org.nutz.mapl.impl.convert.ObjConvertImpl.injectObj(ObjConvertImpl.java:220)
	at org.nutz.mapl.impl.convert.ObjConvertImpl.inject(ObjConvertImpl.java:81)
	at org.nutz.mapl.impl.convert.ObjConvertImpl.convert(ObjConvertImpl.java:65)
	at org.nutz.mapl.Mapl.maplistToObj(Mapl.java:34)
	at org.nutz.json.Json.parse(Json.java:79)
	at org.nutz.json.Json.fromJson(Json.java:58)
	at org.nutz.dao.jdbc.Jdbcs.<clinit>(Jdbcs.java:75)
	... 60 common frames omitted

什么鬼👻...??

写个main方法测试一下

@wendal 如果把最后面的 "dm dbms.*" : "org.nutz.dao.impl.jdbc.dm.DmJdbcExpert" 这行删掉就能正常使用dao了. 啥原因呢?

是不是json格式错了, 整个js文件贴来看看

/*
 * Nutz.Dao 的默认支持数据库的种类
 */
var ioc = {

    /*
     * Experts 的映射列表
     */
    experts : {
        "h2.*" : "org.nutz.dao.impl.jdbc.h2.H2JdbcExpert",
        "mysql.*" : "org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert",
        "postgresql.*" : "org.nutz.dao.impl.jdbc.psql.PsqlJdbcExpert",
        //翰高数据库
        "highgo.*" : "org.nutz.dao.impl.jdbc.psql.PsqlJdbcExpert",
        "db2.*" : "org.nutz.dao.impl.jdbc.db2.Db2JdbcExpert",
        "oracle.*" : "org.nutz.dao.impl.jdbc.oracle.OracleJdbcExpert",
        // SqlServer2005 --> 9.0 , SqlServer2008 --> 10.0
        "microsoft sql server.*(9|10)[.].+" : "org.nutz.dao.impl.jdbc.sqlserver2005.Sqlserver2005JdbcExpert",
        "microsoft sql server.*(8)[.].+" : "org.nutz.dao.impl.jdbc.sqlserver2000.Sqlserver2000JdbcExpert",
        "microsoft sql server.*(11|12|13|14|15)[.].+" : "org.nutz.dao.impl.jdbc.sqlserver2005.Sqlserver2005JdbcExpert",
        "hsql.*" : "org.nutz.dao.impl.jdbc.hsqldb.HsqldbJdbcExpert",
        "sqlite" : "org.nutz.dao.impl.jdbc.sqlite.SQLiteJdbcExpert",
        ".+derby.+" : "org.nutz.dao.impl.jdbc.derby.DerbyJdbcExpert",
        "gbase.*" : "org.nutz.dao.impl.jdbc.gbase.GBaseJdbcExpert",
        "sybase.*" : "org.nutz.dao.impl.jdbc.sybase.SybaseIQJdbcExpert",
        "dm dbms.*" : "org.nutz.dao.impl.jdbc.dm.DmJdbcExpert"
        // ~ 映射结束
    },

    /*
     * 所有 Expert 都能读到这个配置文件
     */
    config : {
        // 默认的 Clob 以及 Blog 临时目录
        "pool-home" : "~/.nutz/tmp/dao/",
        // 临时目录大小,0 为不限大小
        "pool-max" : 200000,
        // Mysql 特殊配置
        "mysql-engine" : "InnoDB",
        // GBase 特殊配置
        "gbase-engine" : "GsDB"
        // ~ 配置信息结束
    } };

是不是你的nutz.jar没有org.nutz.dao.impl.jdbc.dm.DmJdbcExpert类???

我用的1.r.62 官方包啊, 不过里面的确没有DmJdbcExpert这个类

恩, 你拷贝的是最新的, 删掉就好了

来个pull req不(;`O´)o

添加回复
请先登陆
回到顶部