NutzCN Logo
问答 求解我用传参的方法去数据库中查找player = x的方式爆空指针,可是从页面传参去找数据就能找到数据
发布于 2693天前 作者 qq_4e5959f6 1725 次浏览 复制 上一个帖子 下一个帖子
标签:

For example:> "SELECT * FROM player WHERE playerID=1"
2017-08-08 11:40:22,940 org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:28) WARN - Error@/check/checkPlayerInfo :
java.lang.NullPointerException
at com.backend.Module.T1_OceanMoudle.getOceansByPlayerID(T1_OceanMoudle.java:91)
at com.backend.logic.Logic.getXinghaiMaxNum(Logic.java:137)
at com.backend.logic.Logic.setPlayerInfo(Logic.java:64)
at com.backend.Module.T1CheckModule.checkPlayerInfo(T1CheckModule.java:76)
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:497)
at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:25)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:40)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:113)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:40)
at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:183)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)

49 回复

回复按钮旁边有个 "插入代码或日志片段"的按钮, 把上述内容重新发一次

2017-08-08 11:40:22,940 org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:28) WARN  - Error@/check/checkPlayerInfo :
java.lang.NullPointerException
	at com.backend.Module.T1_OceanMoudle.getOceansByPlayerID(T1_OceanMoudle.java:91)
	at com.backend.logic.Logic.getXinghaiMaxNum(Logic.java:137)
	at com.backend.logic.Logic.setPlayerInfo(Logic.java:64)
	at com.backend.Module.T1CheckModule.checkPlayerInfo(T1CheckModule.java:76)
	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:497)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:25)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:40)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:113)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:40)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:183)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)

getOceansByPlayerID方法贴出来看看

	public List<T1_ocean> getOceansByPlayerID(long playerId){
		Cnd cnd = Cnd.where("playerID", "=", playerId);
		List<T1_ocean> ocean = dao.query(T1_ocean.class, cnd);
		return ocean;
	}
@At
	public Object gg(@Param("time") int playerID, @Param("isvery") boolean veriCode,HttpServletRequest request){
		NutMap re = new NutMap();
		Boolean isOpen = Boolean.valueOf(ServerKeyUtil.GetbackendCommonLoginWay());
		if (!isOpen) {
			return re.setv("ok", false).setv("msg", msg.get("jsp.server.errorlogin"));
		}
		Map<String, String> language = Mvcs.getMessages(Mvcs.getReq());
		Cnd cnd = Cnd.where("playerID", "=", playerID);
		oceans = dao.query(T1_ocean.class, cnd);
		if (oceans.isEmpty()) {
			return re.setv("ok", false).setv("msg", language.get("jsp.gmcommand.nodata"));
		}
		return re.setv("ok", true);
	}

这个是从网页输入iD就可以得到数据

dao是null?debug看看

    public InvocationTargetException(Throwable target) {
        super((Throwable)null);  // Disallow initCause
        this.target = target;
    }

大哥,好像就是没有进入sql语句,查不到东西

哪一行报错

就是dao.query(T1_ocean.class,cnd);,就在这里死掉的

dao是不是null

dao不是null,因为用的是方法外的同一个dao,但是另一个方法可以用,这个方法就dao中的数据变为空了

既然报错的是

dao.query(T1_ocean.class, cnd);

而且抛出的是空指针, 那么 这一句里面唯一能导致空指针的, 只能是dao=null了

T1_OceanMoudle是new出来的?没用@Inject? 怎么一个Module调用另外一个Module? 这种代码应该放在Service层的

@Inject
	protected Dao dao;
	
	private Map<String, String> msg = Mvcs.getMessages(Mvcs.getReq());

	private List<T1_ocean> oceans = null;
	
	
	/**
	 * 
	 * @param playerId
	 * @return
	 */
	@Filters
	public List<T1_ocean> getOceansByPlayerID(long playerId){
		Cnd cnd = Cnd.where("playerID", "=", playerId);
		List<T1_ocean> ocean = dao.query(T1_ocean.class, cnd);
		return ocean;
	}

可是我要的数据显示在一起呢!大哥希望你再说清楚一丢丢

我说你的T1_OceanMoudle实例是不是new出来的??

所以挂了... 得@Inject进来的...

啊??所以我当初new T1_OceanMoudle的时候应该用@Inject进去??

哥,我加了@inject,还是抛异常,这次说的是T1_Ocean空!0.0

哪里的T1_Ocean?? 哪一行代码?

@Inject
	private static T1_OceanMoudle Ocean;

就是调用这个module的时候,然后就进不去

	List<T1_ocean> oceans = Ocean.getOceansByPlayerID(playerId);

上次是因为new 的时候可以进去,但是没dao,这次是进不去

不能是static的

哥,现在报错了

org.nutz.ioc.IocException: Object 'Ocean' without define! For object [Ocean] - type:[] FAIL to create Ioc Bean name=[logic] 
beacase [Object 'Ocean' without define! For object [Ocean] - type:[]] FAIL to create Ioc Bean name=[t1CheckModule] 
beacase [Object 'Ocean' without define! For object [Ocean] - type:[] FAIL to create Ioc Bean name=[logic] 
beacase [Object 'Ocean' without define! For object [Ocean] - type:[]]]
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:141)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:196)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:221)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:106)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:40)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:183)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.nutz.ioc.IocException: Object 'Ocean' without define! For object [Ocean] - type:[] FAIL to create Ioc Bean name=[logic] 
beacase [Object 'Ocean' without define! For object [Ocean] - type:[]]
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:141)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:196)
	at org.nutz.ioc.val.ReferValue.get(ReferValue.java:24)
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:31)
	at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:132)
	... 28 more
Caused by: org.nutz.ioc.IocException: Object 'Ocean' without define! For object [Ocean] - type:[]
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:203)
	at org.nutz.ioc.val.ReferValue.get(ReferValue.java:24)
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:31)
	at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:132)
	... 33 more
Caused by: org.nutz.ioc.ObjectLoadException: Object 'Ocean' without define!
	at org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:149)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:168)
	... 37 more

别折腾了,写个Service吧

好吧,谢谢了大哥!

大哥,再请教一下,就是我配置了数据库,可是说取不到东西,我觉得可能哪里没配完整,求指教

	log.info("MainSetup init ----------------------");
		Ioc ioc = conf.getIoc();
		Dao backendDao = ioc.get(Dao.class,"backendDao");//后台数据库连接

		log.info("后台数据库连接 配置读取 backendDao:" + backendDao);

		Dao publicServerDao = ioc.get(Dao.class,"daoPublic");//公共数据库
		Daos.createTablesInPackage(backendDao, "com.backend", false);
		ioc.get(NutQuartzCronJobFactory.class);

		log.info("公共数据库 配置读取 publicServerDao:" + publicServerDao);

		
		Dao playerInfoDao = ioc.get(Dao.class,"daoPlayerInfo");//玩家数据消息连接
		log.info("玩家数据库连接 配置读取 backendDao:" + playerInfoDao);
		
playerInfoServerDataSource:{
        	 type : "com.alibaba.druid.pool.DruidDataSource",
             events : {
                 create : "init",
                 depose : 'close'
             },
             fields : {
                 url : {java:"$conf.get('fot.url')"},
                 username : {java:"$conf.get('fot.username')"},
                 password : {java:"$conf.get('fot.password')"},
                 testWhileIdle : true,
                 validationQuery : {java:"$conf.get('fot.validationQuery')"},
                 maxActive : {java:"$conf.get('fot.maxActive')"}
             }
        },
        daoPlayerInfo:{
        	type : "org.nutz.dao.impl.NutDao",
            args : [{refer:"playerInfoServerDataSource"}]
        },
        logDao : {
       	 type : "org.nutz.dao.impl.NutDao",
            args : [{refer:"playerInfoServerDataSource"}]
       },

我另外又加了一个数据库进去,但是读不到那个数据库中的东西,大哥,求指教指教

取不到什么东西??

就比如,我新加进去的数据库中有很多表数据,可是我用了正常的查询方法查不到其中表的数据,就像数据库没有连接上一样

数据连接参数写错了吧,日志里面有打印链接信息,mysql的话

可是两个库发生了混乱,比如A中库的表全部复制进了B库但是没有数据,B中的表全部复制进了A,也没有数据!

0.0 大哥,是这样的,就是我原本框架连接着一个数据库A,但是呢!这个数据库A中的数据不够我用,我需要从另外的数据库B中拿出数据。所以我就用上面的方法连接数据库B,并且在Bean里面写了几个关于数据库B的bean,但是呢!我只要启动项目,系统就看我数据库中A没有Bean中的一部分数据,就给我创建了A中没有的表。B数据库就创建了Bean里面B数据库没有的表!!!!所以造成了我查不到数据,这个应该怎么办呢???

把整个dao.js贴来看看

var ioc = {
		conf : {
            type : "org.nutz.ioc.impl.PropertiesProxy",
            fields : {
                paths : ["custom/"]
            }
        },
        backendDataSource : {
            type : "com.alibaba.druid.pool.DruidDataSource",
            events : {
                create : "init",
                depose : 'close'
            },
            fields : {
                url : {java:"$conf.get('db.backend.url')"},
                username : {java:"$conf.get('db.backend.username')"},
                password : {java:"$conf.get('db.backend.password')"},
                testWhileIdle : true,
                validationQuery : {java:"$conf.get('db.backend.validationQuery')"},
                maxActive : {java:"$conf.get('db.backend.maxActive')"}
            }
        },
        backendDao : {
            type : "org.nutz.dao.impl.NutDao",
            args : [{refer:"backendDataSource"}]
        },
        dao : {
        	 type : "org.nutz.dao.impl.NutDao",
             args : [{refer:"backendDataSource"}]
        },
      
        
        gameServerDataSource : {
            type : "com.alibaba.druid.pool.DruidDataSource",
            events : {
                create : "init",
                depose : 'close'
            },
            fields : {
                url : {java:"$conf.get('db.game_server.url')"},
                username : {java:"$conf.get('db.game_server.username')"},
                password : {java:"$conf.get('db.game_server.password')"},
                testWhileIdle : true,
                validationQuery : {java:"$conf.get('db.game_server.validationQuery')"},
                maxActive : {java:"$conf.get('db.game_server.maxActive')"}
            }
        },
        gameServerDao : {
            type : "org.nutz.dao.impl.NutDao",
            args : [{refer:"gameServerDataSource"}]
        },
        daoData: {
            type : "org.nutz.dao.impl.NutDao",
            args : [{refer:"gameServerDataSource"}]
        },
        
        
        publicServerDataSource : {
            type : "com.alibaba.druid.pool.DruidDataSource",
            events : {
                create : "init",
                depose : 'close'
            },
            fields : {
                url : {java:"$conf.get('db.public.url')"},
                username : {java:"$conf.get('db.public.username')"},
                password : {java:"$conf.get('db.public.password')"},
                testWhileIdle : true,
                validationQuery : {java:"$conf.get('db.public.validationQuery')"},
                maxActive : {java:"$conf.get('db.public.maxActive')"}
            }
        },
        daoPublic:{
            type : "org.nutz.dao.impl.NutDao",
            args : [{refer:"publicServerDataSource"}]
        },
        
        
        playerInfoServerDataSource:{
        	 type : "com.alibaba.druid.pool.DruidDataSource",
             events : {
                 create : "init",
                 depose : 'close'
             },
             fields : {
                 url : {java:"$conf.get('fot.url')"},
                 username : {java:"$conf.get('fot.username')"},
                 password : {java:"$conf.get('fot.password')"},
                 testWhileIdle : true,
                 validationQuery : {java:"$conf.get('fot.validationQuery')"},
                 maxActive : {java:"$conf.get('fot.maxActive')"}
             }
        },
        daoPlayerInfo:{
        	type : "org.nutz.dao.impl.NutDao",
            args : [{refer:"playerInfoServerDataSource"}]
        },
        logDao : {
       	 type : "org.nutz.dao.impl.NutDao",
            args : [{refer:"playerInfoServerDataSource"}]
       },
};

先把新增的去掉,看看是否正常

我把dao.js的新增的东西去掉,把mainSetup中加的一起去掉,就没问题!!!然后把数据库中多出来的表删掉,然后启动,又会给复制表进去

什么叫多出来的表? 自动建表所create的表? 日志里面有线索不?

我懵逼了,对,他自己create的表,他这个从别的库自己复制表给自己

2017-08-08 16:02:32,421 org.nutz.dao.jdbc.Jdbcs.getExpert(Jdbcs.java:98) INFO  - Get Connection from DataSource for JdbcExpert
2017-08-08 16:02:32,432 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:171) DEBUG - JDBC Driver --> mysql-connector-java-5.1.34 ( Revision: jess.balint@oracle.com-20141014163213-wqbwpf1ok2kvo1om )
2017-08-08 16:02:32,432 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:172) DEBUG - JDBC Name   --> MySQL Connector Java
2017-08-08 16:02:32,433 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:174) DEBUG - JDBC URL    --> jdbc:mysql://localhost:3306/public_0_1
2017-08-08 16:02:32,436 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:183) DEBUG - Mysql : character_set_client=latin1
2017-08-08 16:02:32,437 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:183) DEBUG - Mysql : character_set_connection=latin1
2017-08-08 16:02:32,437 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:183) DEBUG - Mysql : character_set_database=utf8
2017-08-08 16:02:32,438 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:183) DEBUG - Mysql : character_set_filesystem=binary
2017-08-08 16:02:32,439 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:183) DEBUG - Mysql : character_set_results=
2017-08-08 16:02:32,440 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:183) DEBUG - Mysql : character_set_server=latin1
2017-08-08 16:02:32,441 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:183) DEBUG - Mysql : character_set_system=utf8
2017-08-08 16:02:32,442 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:183) DEBUG - Mysql : character_sets_dir=C:\Program Files\MySQL\MySQL Server 5.5\share\charsets\
2017-08-08 16:02:32,444 org.nutz.dao.impl.DaoSupport.setDataSource(DaoSupport.java:188) DEBUG - Database info --> MYSQL:[MySQL - 5.5.28]
2017-08-08 16:02:38,712 org.nutz.resource.Scans.scan(Scans.java:234) DEBUG - Found 423 resource by src( com/backend/ ) , regex( ^.+[.]class$ )
2017-08-08 16:02:38,904 org.nutz.dao.impl.jdbc.AbstractJdbcExpert.setupEntityField(AbstractJdbcExpert.java:102) DEBUG - Table 'log_task' doesn't exist!
2017-08-08 16:02:38,946 org.nutz.dao.impl.jdbc.AbstractJdbcExpert.setupEntityField(AbstractJdbcExpert.java:102) DEBUG - Table 'log_task' doesn't exist!
2017-08-08 16:02:38,955 org.nutz.dao.impl.sql.run.NutDaoExecutor._runStatement(NutDaoExecutor.java:313) DEBUG - CREATE TABLE log_task(
ID INT(32) AUTO_INCREMENT COMMENT '任务唯一的ID',
playerID BIGINT(64) COMMENT '玩家的ID',
taskID INT(32) COMMENT '任务的ID',
rewardType VARCHAR(50) COMMENT '奖励的类型',
rewardNum VARCHAR(50) COMMENT '奖励的数量',
time TIMESTAMP NULL DEFAULT NULL COMMENT '时间',
PRIMARY KEY (ID)
) ENGINE=InnoDB CHARSET=utf8
2017-08-08 16:02:39,113 org.nutz.dao.impl.jdbc.AbstractJdbcExpert.setupEntityField(AbstractJdbcExpert.java:102) DEBUG - Table 'dat_gsdb' doesn't exist!
2017-08-08 16:02:39,136 org.nutz.dao.impl.jdbc.AbstractJdbcExpert.setupEntityField(AbstractJdbcExpert.java:102) DEBUG - Table 'dat_gsdb' doesn't exist!
2017-08-08 16:02:39,138 org.nutz.dao.impl.sql.run.NutDaoExecutor._runStatement(NutDaoExecutor.java:313) DEBUG - CREATE TABLE dat_gsdb(
gameid INT(32) COMMENT '游戏表ID',
gsid INT(32) COMMENT '游戏数据库ID',
server_name VARCHAR(50) COMMENT '服务器名字',
description VARCHAR(255) COMMENT '服务器简单描述',
gs_host VARCHAR(20) COMMENT 'GS主机',
gs_port VARCHAR(20) COMMENT 'GS端口',
db_host VARCHAR(20) COMMENT '主机名称',
db_port VARCHAR(20) COMMENT '主机端口',
db_user VARCHAR(20) COMMENT '主机用户账号',
db_password VARCHAR(32) COMMENT '用户密码',
db_charset VARCHAR(20) COMMENT '主机字符集',
db_timezone VARCHAR(20) COMMENT '主机时区',
log_db_host VARCHAR(20) COMMENT '日志库名称',
log_db_port VARCHAR(20) COMMENT '日志库端口',
log_db_user VARCHAR(20) COMMENT '日志库用户账号',
log_db_password VARCHAR(20) COMMENT '日志库用户密码',
log_db_charset VARCHAR(20) COMMENT '日志库字符集',
depotdb_name VARCHAR(20) COMMENT '仓库库名',
status VARCHAR(20),
label VARCHAR(20) COMMENT '服务器标签样式',
isrecommend TINYINT(4) COMMENT '是否推荐0否 1是',
isnew TINYINT(4) COMMENT '是否为新服 0 否 1 是',
mark TINYINT(4) COMMENT '0正常1测试服2被合服',
start_time INT(32) COMMENT '开服时间',
end_time INT(32) COMMENT '关服时间',
ext TEXT COMMENT '白名单',
gm_host VARCHAR(20) COMMENT 'gm_host',
gm_port VARCHAR(20) COMMENT 'gm_port',
db_name VARCHAR(20) COMMENT 'db_name',
log_db_name VARCHAR(20) COMMENT '日志数据库名字') ENGINE=InnoDB CHARSET=utf8
2017-08-08 16:02:39,254 org.nutz.dao.impl.jdbc.AbstractJdbcExpert.setupEntityField(AbstractJdbcExpert.java:102) DEBUG - Table 'log_campaign' doesn't exist!
2017-08-08 16:02:39,265 org.nutz.dao.impl.jdbc.AbstractJdbcExpert.setupEntityField(AbstractJdbcExpert.java:102) DEBUG - Table 'log_campaign' doesn't exist!
2017-08-08 16:02:39,267 org.nutz.dao.impl.sql.run.NutDaoExecutor._runStatement(NutDaoExecutor.java:313) DEBUG - CREATE TABLE log_campaign(
id INT(32) AUTO_INCREMENT COMMENT '每日战役的ID',
playerID BIGINT(64) COMMENT '玩家ID',
battleID BIGINT(64) COMMENT '战役ID',
map INT(32) COMMENT '地图ID',
mission INT(32) COMMENT '关卡ID',
camp1 INT(32) COMMENT '..',
camp2 INT(32) COMMENT '..',
power INT(32) COMMENT '..',
result INT(32) COMMENT '..',
time TIMESTAMP NULL DEFAULT NULL COMMENT '时间',
PRIMARY KEY (id)
) ENGINE=InnoDB CHARSET=utf8
2017-08-08 16:02:39,445 org.nutz.dao.impl.jdbc.AbstractJdbcExpert.setupEntityField(AbstractJdbcExpert.java:102) DEBUG - Table 'log_pvprank' doesn't exist!
2017-08-08 16:02:39,455 org.nutz.dao.impl.jdbc.AbstractJdbcExpert.setupEntityField(AbstractJdbcExpert.java:102) DEBUG - Table 'log_pvprank' doesn't exist!
2017-08-08 16:02:39,459 org.nutz.dao.impl.sql.run.NutDaoExecutor._runStatement(NutDaoExecutor.java:313) DEBUG - CREATE TABLE log_pvprank(
ID INT(32) AUTO_INCREMENT COMMENT 'PVP争夺的ID',
player1ID BIGINT(64) COMMENT '玩家1的ID',
player2ID BIGINT(64) COMMENT '玩家2的ID',
time TIMESTAMP NULL DEFAULT NULL COMMENT '时间',
battleID BIGINT(64) COMMENT '战役的ID',
player1Power INT(32) COMMENT '玩家1的战斗力',
player2Power INT(32) COMMENT '玩家2的战斗力',
round INT(32) COMMENT '回合',
player1Camp1 INT(32) COMMENT '玩家1的阵营1',
player1Camp2 INT(32) COMMENT '玩家1的阵营2',
player2Camp1 INT(32) COMMENT '玩家2的阵营1',
player2Camp2 INT(32) COMMENT '玩家2的阵营2',
matchTime NUMERIC(15,10) COMMENT '匹配时间',
player1Score INT(32) COMMENT '玩家1的分数',
player2Score INT(32) COMMENT '玩家2的分数',
PRIMARY KEY (ID)
) ENGINE=InnoDB CHARSET=utf8
2017-08-08 16:02:39,595 org.nutz.dao.impl.jdbc.AbstractJdbcExpert.setupEntityField(AbstractJdbcExpert.java:102) DEBUG - Table 'log_pvpbox' doesn't exist!
2017-08-08 16:02:39,613 org.nutz.dao.impl.jdbc.AbstractJdbcExpert.setupEntityField(AbstractJdbcExpert.java:102) DEBUG - Table 'log_pvpbox' doesn't exist!
2017-08-08 16:02:39,616 org.nutz.dao.impl.sql.run.NutDaoExecutor._runStatement(NutDaoExecutor.java:313) DEBUG - CREATE TABLE log_pvpbox(
ID INT(32) AUTO_INCREMENT COMMENT 'PVP争夺的ID',
player1ID BIGINT(64) COMMENT '玩家1的ID',
player2ID BIGINT(64) COMMENT '玩家2的ID',
time TIMESTAMP NULL DEFAULT NULL COMMENT '时间',
battleID BIGINT(64) COMMENT '战役的ID',
player1Power INT(32) COMMENT '玩家1的战斗力',
player2Power INT(32) COMMENT '玩家2的战斗力',
round INT(32) COMMENT '回合',
player1Camp1 INT(32) COMMENT '玩家1的阵营1',
player1Camp2 INT(32) COMMENT '玩家1的阵营2',
player2Camp1 INT(32) COMMENT '玩家2的阵营1',
player2Camp2 INT(32) COMMENT '玩家2的阵营2',
matchTime NUMERIC(15,10) COMMENT '匹配时间',
player1Score INT(32) COMMENT '玩家1的分数',
player2Score INT(32) COMMENT '玩家2的分数',
PRIMARY KEY (ID)
) ENGINE=InnoDB CHARSET=utf8
2017-08-08 16:02:39,707 org.nutz.dao.impl.jdbc.AbstractJdbcExpert.setupEntityField(AbstractJdbcExpert.java:102) DEBUG - Table 'log_pvpfun' doesn't exist!
2017-08-08 16:02:39,717 org.nutz.dao.impl.jdbc.AbstractJdbcExpert.setupEntityField(AbstractJdbcExpert.java:102) DEBUG - Table 'log_pvpfun' doesn't exist!
2017-08-08 16:02:39,718 org.nutz.dao.impl.sql.run.NutDaoExecutor._runStatement(NutDaoExecutor.java:313) DEBUG - CREATE TABLE log_pvpfun(

其实就是按照bean中没有的类create了相关的表,这样表中就没有数据!!!!可是那些类我在另外的数据库中是有数据的

这跟"复制"没一点关系, create语句哪里的"复制"

这是Setup里面Daos.createTablesInPackage的执行效果

都是新建的表,当然没有数据

不好意思大哥,是我愚昧了,没反应过来!!!那么我怎么才可以从B表中取数据呢??刚才我把Daos.createTablesInPackage注掉了,但是也取不到

哪个Dao实例取不到哪个表的数据? 在Setup.init里面写测试代码

大哥,我明白了,找到原因了!!!!终于知道了,谢谢你的帮助,感谢!!

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