引用:hkxxlyzm 发表于 2017-03-13 14:39 原来如此,恭喜 |
好吧,我竟无言以对 |
引用:JackJiang 发表于 2017-03-13 14:15 instance = new ServerLauncherImpl() { @Override protected ServerCoreHandler initServerCoreHandler() { return new ServerCoreHandler(){ // 【注意】:重写此方法来实现您自已的user id生成算法哦^_^! @Override protected String getNextUserId(PLoginInfo loginInfo) { return loginInfo.getLoginName();//这里就是44行啊 } }; } }; |
引用:hkxxlyzm 发表于 2017-03-13 14:01 直接把代码帖出来吧,这怎么需要打什么断点 |
引用:JackJiang 发表于 2017-03-13 13:52 可是这里没有int类型啊 我看下弄个断点试试看下 |
引用:hkxxlyzm 发表于 2017-03-13 13:50 日志已经很明显了。 net.openmob.mobileimsdk.server.demo.ServerLauncherImpl$1$1.getNextUserId(ServerLauncherImpl.java:44) 这个 getNextUserId 方法的第44行存在尝试将字符串转成Int的问题。别跟我说你是新手啊。。 |
引用:JackJiang 发表于 2017-03-13 13:10 我把所有的都改成string类型啦 int 类型登陆可以 但是 带字母就不行啦 错误日志 [INFO] - [13:49:16.079][IMCORE]与{uid:null,cid:-1}/127.0.0.1:57579的会话建立(sessionCreated)了... | (ServerCoreHandler^sessionCreated:546) [INFO] - [13:49:16.083][IMCORE]与{uid:null,cid:-1}/127.0.0.1:57579的会话(sessionOpened)打开了... | (ServerCoreHandler^sessionOpened:573) [INFO] - [13:49:16.083][IMCORE]>> 客户端{uid:null,cid:-1}/127.0.0.1:57579发过来的登陆信息内容是:getLoginName=wwwww|getLoginPsw=qqqq | (ServerCoreHandler^messageReceived:277) [DEBUG] - [13:49:16.083]正在调用回调方法:OnVerifyUserCallBack...(extra=null) | (ServerEventListenerImpl^onVerifyUserCallBack:27) [ERROR] - [13:49:16.083][IMCORE]exceptionCaught捕获到错了,原因是:For input string: "wwwww" | (ServerCoreHandler^exceptionCaught:75) java.lang.NumberFormatException: For input string: "wwwww" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.valueOf(Unknown Source) at net.openmob.mobileimsdk.server.demo.ServerLauncherImpl$1$1.getNextUserId(ServerLauncherImpl.java:44) at net.openmob.mobileimsdk.server.ServerCoreHandler.messageReceived(ServerCoreHandler.java:339) at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:690) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:417) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:47) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:765) at org.apache.mina.core.filterchain.IoFilterEvent.fire(IoFilterEvent.java:78) at org.apache.mina.core.session.IoEvent.run(IoEvent.java:63) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) [INFO] - [13:49:16.084][IMCORE]与{uid:null,cid:-1}/127.0.0.1:57579的会话关闭(user_id=-1,loginName=null)了... | (ServerCoreHandler^sessionClosed:510) [WARN] - [13:49:16.084][IMCORE]【注意】客户端{uid:null,cid:-1}/127.0.0.1:57579的会话被系统close了,但它里面没有存放user_id,这个会话是何时建立的? | (ServerCoreHandler^sessionClosed:530) [INFO] - [13:49:52.888][IMCORE]与{uid:null,cid:-1}/127.0.0.1:53023的会话建立(sessionCreated)了... | (ServerCoreHandler^sessionCreated:546) [INFO] - [13:49:52.891][IMCORE]与{uid:null,cid:-1}/127.0.0.1:53023的会话(sessionOpened)打开了... | (ServerCoreHandler^sessionOpened:573) [INFO] - [13:49:52.892][IMCORE]>> 客户端{uid:null,cid:-1}/127.0.0.1:53023发过来的登陆信息内容是:getLoginName=wwwww|getLoginPsw=qqqq | (ServerCoreHandler^messageReceived:277) [DEBUG] - [13:49:52.892]正在调用回调方法:OnVerifyUserCallBack...(extra=null) | (ServerEventListenerImpl^onVerifyUserCallBack:27) [ERROR] - [13:49:52.892][IMCORE]exceptionCaught捕获到错了,原因是:For input string: "wwwww" | (ServerCoreHandler^exceptionCaught:75) java.lang.NumberFormatException: For input string: "wwwww" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.valueOf(Unknown Source) at net.openmob.mobileimsdk.server.demo.ServerLauncherImpl$1$1.getNextUserId(ServerLauncherImpl.java:44) at net.openmob.mobileimsdk.server.ServerCoreHandler.messageReceived(ServerCoreHandler.java:339) at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:690) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:417) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:47) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:765) at org.apache.mina.core.filterchain.IoFilterEvent.fire(IoFilterEvent.java:78) at org.apache.mina.core.session.IoEvent.run(IoEvent.java:63) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) [INFO] - [13:49:52.893][IMCORE]与{uid:null,cid:-1}/127.0.0.1:53023的会话关闭(user_id=-1,loginName=null)了... | (ServerCoreHandler^sessionClosed:510) [WARN] - [13:49:52.893][IMCORE]【注意】客户端{uid:null,cid:-1}/127.0.0.1:53023的会话被系统close了,但它里面没有存放user_id,这个会话是何时建立的? | (ServerCoreHandler^sessionClosed:530) |
你具体描述一下怎么个不行法,把错误log打出来看看。 你把所有原先user_id是int类型的地方全部改为String了? |