Unity - A计划(永久有效期) 扫二维码继续学习 二维码时效为半小时

(197评价)
价格: 4431.00元
PhotonServer问题
Zero.发起了问答2017-06-25
4
回复
1729
浏览

在跟老师一起做PhotonServeR的登录教程的时候出了个问题找不到解决原因,我在客户端点登录之后LOG日志里面 有一个报错看不懂。

我理解是不是哪里调用了一个Nhibernate的ADD方法,而USERNAME是空,但是我找不到哪里调用了这个。。

报错如下:

2017-06-25 14:23:47,503 [10] INFO  NHibernate.Impl.SessionFactoryImpl - building session factory
2017-06-25 14:23:48,248 [10] INFO  NHibernate.Impl.SessionFactoryObjectFactory - no name configured
2017-06-25 14:23:48,352 [10] INFO  NHibernate.Loader.Loader - SELECT this_.id as id1_0_0_, this_.username as userna2_0_0_, this_.password as passwo3_0_0_, this_.registerdate as regist4_0_0_ FROM users this_ WHERE this_.username is null 
2017-06-25 14:23:48,520 [10] ERROR NHibernate.AdoNet.AbstractBatcher - Could not execute query: INSERT INTO users (username, password, registerdate) VALUES (?p0, ?p1, ?p2);SELECT LAST_INSERT_ID()
MySql.Data.MySqlClient.MySqlException (0x80004005): Column 'username' cannot be null
   在 MySql.Data.MySqlClient.MySqlStream.ReadPacket()
   在 MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)
   在 MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
   在 MySql.Data.MySqlClient.MySqlDataReader.NextResult()
   在 MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
   在 NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)
2017-06-25 14:23:48,528 [10] WARN  NHibernate.Util.ADOExceptionReporter - MySql.Data.MySqlClient.MySqlException (0x80004005): Column 'username' cannot be null
   在 MySql.Data.MySqlClient.MySqlStream.ReadPacket()
   在 MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)
   在 MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
   在 MySql.Data.MySqlClient.MySqlDataReader.NextResult()
   在 MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
   在 NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)
   在 NHibernate.Id.IdentityGenerator.InsertSelectDelegate.ExecuteAndExtract(IDbCommand insert, ISessionImplementor session)
   在 NHibernate.Id.Insert.AbstractReturningDelegate.PerformInsert(SqlCommandInfo insertSQL, ISessionImplementor session, IBinder binder)
2017-06-25 14:23:48,529 [10] ERROR NHibernate.Util.ADOExceptionReporter - Column 'username' cannot be null
2017-06-25 14:23:48,535 [10] ERROR Photon.SocketServer.PeerBase - exception during handling of data.Peer:T:ClientPeer,ConnId:0,ip:127.0.0.1:60910, Data: F3-02-01-00-02-01-69-00-00-00-64-02-73-00-04-65-72-72-72,
Exception:NHibernate.Exceptions.GenericADOException: could not insert: [SurviveServer.Model.Users][SQL: INSERT INTO users (username, password, registerdate) VALUES (?, ?, ?);SELECT LAST_INSERT_ID()] ---> MySql.Data.MySqlClient.MySqlException: Column 'username' cannot be null
   在 MySql.Data.MySqlClient.MySqlStream.ReadPacket()
   在 MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)
   在 MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
   在 MySql.Data.MySqlClient.MySqlDataReader.NextResult()
   在 MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
   在 NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)
   在 NHibernate.Id.IdentityGenerator.InsertSelectDelegate.ExecuteAndExtract(IDbCommand insert, ISessionImplementor session)
   在 NHibernate.Id.Insert.AbstractReturningDelegate.PerformInsert(SqlCommandInfo insertSQL, ISessionImplementor session, IBinder binder)
   --- 内部异常堆栈跟踪的结尾 ---

 

 

所有回复
  • siki 2017-06-25

    Column 'username' cannot be null

    这里意思就是你在做插入的时候,username不能为空,你检查一下

    • Zero. 2017-06-25

      我找了很久代码没有发现哪里调用了,服务器端调试好麻烦

      (0) 回复
    还有-4条回复,点击查看
    你还没有登录,请先登录注册
  • siki 2017-06-25

    插入用户名,应该是在注册用户相关的功能那里

    还有-5条回复,点击查看
    你还没有登录,请先登录注册
  • xyz123 2017-09-03

    2017-09-03 15:51:34,884 [11] ERROR Photon.SocketServer.PeerBase [(null)] - NHibernate.Exceptions.GenericADOException: could not insert: [TaidouCommon.Model.Role][SQL: INSERT INTO role (name, level, isman, userid) VALUES (?, ?, ?, ?)] ---> MySql.Data.MySqlClient.MySqlException: Cannot add or update a child row: a foreign key constraint fails (`taidouserver`.`role`, CONSTRAINT `fk_userid` FOREIGN KEY (`userid`) REFERENCES `role` (`Id`))


    我做的泰斗破坏神出现这种错误的,是什么原因呢?

    还有-5条回复,点击查看
    你还没有登录,请先登录注册
发表回复
你还没有登录,请先 登录或 注册!