NutzCN Logo
问答 微信开发接收到消息提示2字节的UTF-8 序列字节2无效
发布于 3130天前 作者 fineliving 6355 次浏览 复制 上一个帖子 下一个帖子
标签:

程序在eclipse里调试的时候都正常运行,但是部署的时候就只要接收到的消息带中文就出现UTF-8 序列字节无效错误
详细错误信息如下:

2016-05-28 05:47:42,742 [WARN][org.nutz.mvc.impl.processor.FailProcessor] - Error@/Weixin :
java.lang.RuntimeException: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 2 字节的 UTF-8 序列的字节 2 无效。
	at org.nutz.lang.Lang.wrapThrow(Lang.java:153)
	at org.nutz.lang.Xmls.xml(Xmls.java:62)
	at org.nutz.weixin.util.Wxs.convert(Wxs.java:160)
	at org.nutz.weixin.util.Wxs.convert(Wxs.java:175)
	at org.nutz.weixin.util.Wxs.handle(Wxs.java:607)
	at net.hzfanqun.weixin.modules.WxModule.msgIn(WxModule.java:67)
	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.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:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	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:44)
	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:198)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
	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:220)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
	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:956)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2517)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2506)
	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: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 2 字节的 UTF-8 序列的字节 2 无效。
	at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:701)
	at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:372)
	at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1793)
	at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.scanData(XMLEntityScanner.java:1292)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanCDATASection(XMLDocumentFragmentScannerImpl.java:1655)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3017)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243)
	at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
	at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121)
	at org.nutz.lang.Xmls.xml(Xmls.java:56)
	... 44 more

麻烦帮忙看看,谢谢!

14 回复

群里兽总说 notepad++打开,然后另存为 无BOM的UTF8
不知道如何操作,请明示,谢啦

jdk版本问题吧?启动日志也贴一下

刚刚用本站的微信号测试了一下,很正常呢, JDK8, nutzwx 1.r.56, centos 6.5 x64, jetty 9.3.9

@wendal
等下我再试下
JDK8,tomcat7,Windows server

来自 iPhone 6 Plus

windows啊, 那肯定是编码没设置啦

在tomcat的conf里面env.bat 文件(没有就新建一个)中加入

 set JAVA_OPTS="-Dfile.encoding=UTF-8"

@wendal
回去试试,谢谢!
我比较奇怪是为啥eclipse里调试没有问题呢

来自 iPhone 6 Plus

@wendal
还是没搞定啊,贴启动日志

2016-05-28 16:05:31,080 [INFO][org.nutz.mvc.NutFilter] - NutFilter[nutz] starting ...
2016-05-28 16:05:31,189 [DEBUG][org.nutz.resource.Scans] - Locations for Scans:
[JarResourceLocation [jarPath=C:\iegreen\apache-tomcat-7.0.69\bin\tomcat-juli.jar], FileSystemResourceLocation [root=C:\iegreen\apache-tomcat-7.0.69\bin], JarResourceLocation [jarPath=C:\iegreen\weixin-nutz\WEB-INF\lib\nutz-1.r.57-20160524.011752-23.jar], FileSystemResourceLocation [root=C:\iegreen\weixin-nutz\WEB-INF\classes], JarResourceLocation [jarPath=C:\iegreen\apache-tomcat-7.0.69\bin\bootstrap.jar]]
2016-05-28 16:05:31,580 [DEBUG][org.nutz.resource.Scans] - Locations for Scans:
[FileSystemResourceLocation [root=C:\iegreen\apache-tomcat-7.0.69\bin], JarResourceLocation [jarPath=C:\iegreen\weixin-nutz\WEB-INF\lib\base64.Base64-1.3.1.jar], JarResourceLocation [jarPath=C:\iegreen\weixin-nutz\WEB-INF\lib\slf4j-log4j12-1.7.13.jar], JarResourceLocation [jarPath=C:\iegreen\weixin-nutz\WEB-INF\lib\pinyin4j-2.5.1.jar], JarResourceLocation [jarPath=C:\iegreen\weixin-nutz\WEB-INF\lib\slf4j-api-1.7.13.jar], JarResourceLocation [jarPath=C:\iegreen\weixin-nutz\WEB-INF\lib\nutzwx-1.r.57-20160524.151018-4.jar], JarResourceLocation [jarPath=C:\iegreen\weixin-nutz\WEB-INF\lib\log4j-1.2.17.jar], JarResourceLocation [jarPath=C:\iegreen\weixin-nutz\WEB-INF\lib\nutz-1.r.57-20160525.065323-24.jar], JarResourceLocation [jarPath=C:\iegreen\apache-tomcat-7.0.69\bin\tomcat-juli.jar], JarResourceLocation [jarPath=C:\iegreen\weixin-nutz\WEB-INF\lib\mysql-connector-java-5.1.39.jar], JarResourceLocation [jarPath=C:\iegreen\weixin-nutz\WEB-INF\lib\nutz-1.r.57-20160524.011752-23.jar], JarResourceLocation [jarPath=C:\iegreen\weixin-nutz\WEB-INF\lib\nutzwx-1.r.57-20160524.134605-3.jar], FileSystemResourceLocation [root=C:\iegreen\weixin-nutz\WEB-INF\classes], JarResourceLocation [jarPath=C:\iegreen\apache-tomcat-7.0.69\bin\bootstrap.jar], JarResourceLocation [jarPath=C:\iegreen\weixin-nutz\WEB-INF\lib\druid-1.0.19.jar], JarResourceLocation [jarPath=C:\iegreen\weixin-nutz\WEB-INF\lib\nutz-1.r.57-20160527.144834-25.jar]]
2016-05-28 16:05:31,580 [DEBUG][org.nutz.mvc.config.AbstractNutConfig] - MainModule: <net.hzfanqun.weixin.modules.MainModule>
2016-05-28 16:05:31,611 [DEBUG][org.nutz.mvc.config.AbstractNutConfig] - Loading by class org.nutz.mvc.impl.NutLoading
2016-05-28 16:05:31,611 [INFO][org.nutz.mvc.impl.NutLoading] - Nutz Version : 1.r.57-SNAPSHOT 
2016-05-28 16:05:31,611 [INFO][org.nutz.mvc.impl.NutLoading] - Nutz.Mvc[nutz] is initializing ...
2016-05-28 16:05:31,611 [DEBUG][org.nutz.mvc.impl.NutLoading] - Web Container Information:
2016-05-28 16:05:31,627 [DEBUG][org.nutz.mvc.impl.NutLoading] -  - Default Charset : GBK
2016-05-28 16:05:31,627 [DEBUG][org.nutz.mvc.impl.NutLoading] -  - Current . path  : C:\iegreen\apache-tomcat-7.0.69\bin\.
2016-05-28 16:05:31,627 [DEBUG][org.nutz.mvc.impl.NutLoading] -  - Java Version    : 1.8.0_91
2016-05-28 16:05:31,627 [DEBUG][org.nutz.mvc.impl.NutLoading] -  - File separator  : \
2016-05-28 16:05:31,627 [DEBUG][org.nutz.mvc.impl.NutLoading] -  - Timezone        : Asia/Shanghai
2016-05-28 16:05:31,627 [DEBUG][org.nutz.mvc.impl.NutLoading] -  - OS              : Windows Server 2008 R2 amd64
2016-05-28 16:05:31,627 [DEBUG][org.nutz.mvc.impl.NutLoading] -  - ServerInfo      : Apache Tomcat/7.0.69
2016-05-28 16:05:31,627 [DEBUG][org.nutz.mvc.impl.NutLoading] -  - Servlet API     : 3.0
2016-05-28 16:05:31,627 [DEBUG][org.nutz.mvc.impl.NutLoading] -  - ContextPath     : /WxNutz
2016-05-28 16:05:31,627 [DEBUG][org.nutz.mvc.impl.NutLoading] -  - context.tempdir : C:\iegreen\apache-tomcat-7.0.69\work\Catalina\localhost\WxNutz
2016-05-28 16:05:31,627 [DEBUG][org.nutz.mvc.config.AbstractNutConfig] - MainModule: <net.hzfanqun.weixin.modules.MainModule>
2016-05-28 16:05:31,627 [DEBUG][org.nutz.mvc.impl.NutLoading] - >> app.root = C:/iegreen/weixin-nutz
2016-05-28 16:05:31,767 [DEBUG][org.nutz.castor.Castors] - Using 94 castor for Castors
2016-05-28 16:05:31,799 [DEBUG][org.nutz.mvc.impl.NutLoading] - @IocBy(type=org.nutz.mvc.ioc.provider.ComboIocProvider, args=["*js", "config/", "*anno", "net.hzfanqun"],init=[])
2016-05-28 16:05:31,830 [DEBUG][org.nutz.resource.Scans] - Found 2 resource by src( config/ ) , regex( ^(.+[.])(js|json)$ )
2016-05-28 16:05:31,830 [DEBUG][org.nutz.ioc.loader.json.JsonLoader] - loading ioc js config from [datasource.js]
2016-05-28 16:05:31,846 [DEBUG][org.nutz.ioc.loader.json.JsonLoader] - loading ioc js config from [wx.js]
2016-05-28 16:05:31,846 [DEBUG][org.nutz.ioc.loader.json.JsonLoader] - Loaded 5 bean define from path=[config/] --> [dao, config, dataSource, wxApi, sqlManeger]
2016-05-28 16:05:31,861 [DEBUG][org.nutz.resource.Scans] - Found 25 resource by src( net/hzfanqun/ ) , regex( ^.+[.]class$ )
2016-05-28 16:05:31,971 [DEBUG][org.nutz.ioc.loader.annotation.AnnotationIocLoader] - Found : class net.hzfanqun.weixin.modules.MainWxHandler
2016-05-28 16:05:32,033 [DEBUG][org.nutz.ioc.loader.annotation.AnnotationIocLoader] - Found : class net.hzfanqun.weixin.modules.WxModule
2016-05-28 16:05:32,049 [INFO][org.nutz.ioc.loader.annotation.AnnotationIocLoader] - Found 2 classes in 1 base-packages!
beans = ["wxModule", "wxHandler"]
2016-05-28 16:05:32,049 [INFO][org.nutz.ioc.impl.NutIoc] - NutIoc init begin ...
2016-05-28 16:05:32,064 [INFO][org.nutz.ioc.impl.NutIoc] - ... NutIoc init complete
2016-05-28 16:05:32,064 [DEBUG][org.nutz.mvc.config.AbstractNutConfig] - MainModule: <net.hzfanqun.weixin.modules.MainModule>
2016-05-28 16:05:32,064 [INFO][org.nutz.mvc.impl.NutLoading] - Build URL mapping by net.hzfanqun.weixin.modules.UrlMappingSet ...
2016-05-28 16:05:32,064 [DEBUG][org.nutz.mvc.impl.NutLoading] - @Views(DefaultViewMaker.class)
2016-05-28 16:05:32,080 [DEBUG][org.nutz.mvc.impl.NutLoading] - @ChainBy(org.nutz.mvc.impl.NutActionChainMaker)
2016-05-28 16:05:32,080 [DEBUG][org.nutz.mvc.impl.Loadings] - module class location 'file:/C:/iegreen/weixin-nutz/WEB-INF/classes/'
2016-05-28 16:05:32,080 [DEBUG][org.nutz.mvc.impl.Loadings] -  > scan 'net.hzfanqun.weixin.modules'
2016-05-28 16:05:32,096 [DEBUG][org.nutz.resource.Scans] - Found 6 resource by src( net/hzfanqun/weixin/modules/ ) , regex( ^.+[.]class$ )
2016-05-28 16:05:32,096 [DEBUG][org.nutz.mvc.impl.Loadings] -    >> add 'net.hzfanqun.weixin.modules.WxModule'
2016-05-28 16:05:32,111 [INFO][org.nutz.mvc.impl.NutActionChainMaker] - Optional processor class not found, disabled : org.nutz.integration.shiro.NutShiroProcessor
2016-05-28 16:05:32,111 [INFO][org.nutz.mvc.impl.NutActionChainMaker] - Optional processor class not found, disabled : org.nutz.plugins.validation.ValidationProcessor
2016-05-28 16:05:32,127 [DEBUG][org.nutz.mvc.impl.UrlMappingImpl] -    '/getusers'                 >> WxModule.getUsers(...)         : void       | @Ok(raw  ) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2016-05-28 16:05:32,142 [DEBUG][org.nutz.mvc.impl.UrlMappingImpl] -    '/cwxmenu'                  >> WxModule.createWxMenux(...)    : WxResp     | @Ok(raw  ) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2016-05-28 16:05:32,158 [DEBUG][org.nutz.mvc.impl.UrlMappingImpl] -    '/weixin', '/weixin/?'      >> WxModule.msgIn(...)            : View       | @Ok(raw  ) @Fail(http:200) | by 0 Filters | (I:UTF-8/O:UTF-8)
2016-05-28 16:05:32,158 [DEBUG][org.nutz.mvc.impl.UrlMappingImpl] -    '/sendtmsg'                 >> WxModule.sendTemplateMsg(...)  : WxResp     | @Ok(raw  ) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2016-05-28 16:05:32,158 [INFO][org.nutz.mvc.impl.NutLoading] - Found 4 module methods
2016-05-28 16:05:32,158 [DEBUG][org.nutz.mvc.impl.NutLoading] - @Localization not define
2016-05-28 16:05:32,158 [INFO][org.nutz.mvc.impl.NutLoading] - Setup application...
2016-05-28 16:05:32,158 [DEBUG][org.nutz.ioc.impl.NutIoc] - Get 'dao'<interface org.nutz.dao.Dao>
2016-05-28 16:05:32,158 [DEBUG][org.nutz.ioc.aop.SimpleAopMaker] - Load AopConfigure for anno=org.nutz.ioc.aop.Aop by type=org.nutz.ioc.aop.config.impl.AnnotationAopConfigration
2016-05-28 16:05:32,158 [DEBUG][org.nutz.ioc.impl.NutIoc] - 	 >> Load definition name=dao
2016-05-28 16:05:32,158 [DEBUG][org.nutz.ioc.loader.map.MapLoader] - Loading define for name=dao
2016-05-28 16:05:32,174 [DEBUG][org.nutz.ioc.loader.combo.ComboIocLoader] - Found IocObject(dao) in JsonLoader(paths=[config/])
2016-05-28 16:05:32,174 [DEBUG][org.nutz.ioc.impl.NutIoc] - 	 >> Make...'dao'<interface org.nutz.dao.Dao>
2016-05-28 16:05:32,205 [DEBUG][org.nutz.ioc.aop.impl.DefaultMirrorFactory] - Load class org.nutz.dao.impl.NutDao without AOP
2016-05-28 16:05:32,205 [DEBUG][org.nutz.ioc.impl.ScopeContext] - Save object 'dao' to [app] 
2016-05-28 16:05:32,221 [DEBUG][org.nutz.ioc.impl.NutIoc] - Get 'dataSource'<>
2016-05-28 16:05:32,221 [DEBUG][org.nutz.ioc.impl.NutIoc] - 	 >> Load definition name=dataSource
2016-05-28 16:05:32,221 [DEBUG][org.nutz.ioc.loader.map.MapLoader] - Loading define for name=dataSource
2016-05-28 16:05:32,236 [DEBUG][org.nutz.ioc.loader.combo.ComboIocLoader] - Found IocObject(dataSource) in JsonLoader(paths=[config/])
2016-05-28 16:05:32,236 [DEBUG][org.nutz.ioc.impl.NutIoc] - 	 >> Make...'dataSource'<>
2016-05-28 16:05:32,267 [DEBUG][org.nutz.ioc.aop.impl.DefaultMirrorFactory] - Load class com.alibaba.druid.pool.DruidDataSource without AOP
2016-05-28 16:05:32,267 [DEBUG][org.nutz.ioc.impl.ScopeContext] - Save object 'dataSource' to [app] 
2016-05-28 16:05:32,299 [DEBUG][org.nutz.ioc.impl.NutIoc] - Get 'config'<>
2016-05-28 16:05:32,299 [DEBUG][org.nutz.ioc.impl.NutIoc] - 	 >> Load definition name=config
2016-05-28 16:05:32,299 [DEBUG][org.nutz.ioc.loader.map.MapLoader] - Loading define for name=config
2016-05-28 16:05:32,299 [DEBUG][org.nutz.ioc.loader.combo.ComboIocLoader] - Found IocObject(config) in JsonLoader(paths=[config/])
2016-05-28 16:05:32,314 [DEBUG][org.nutz.ioc.impl.NutIoc] - 	 >> Make...'config'<>
2016-05-28 16:05:32,314 [DEBUG][org.nutz.ioc.aop.impl.DefaultMirrorFactory] - Load class org.nutz.ioc.impl.PropertiesProxy without AOP
2016-05-28 16:05:32,314 [DEBUG][org.nutz.ioc.impl.ScopeContext] - Save object 'config' to [app] 
2016-05-28 16:05:32,330 [DEBUG][org.nutz.resource.Scans] - Found 2 resource by src( custom ) , regex( ^.+[.]properties$ )
2016-05-28 16:05:32,346 [DEBUG][org.nutz.ioc.impl.NutIoc] - Get 'config'<>
2016-05-28 16:05:32,346 [DEBUG][org.nutz.ioc.impl.NutIoc] - Get 'config'<>
2016-05-28 16:05:32,346 [DEBUG][org.nutz.ioc.impl.NutIoc] - Get 'config'<>
2016-05-28 16:05:32,346 [DEBUG][org.nutz.ioc.impl.NutIoc] - Get 'config'<>
2016-05-28 16:05:32,346 [DEBUG][org.nutz.ioc.impl.NutIoc] - Get 'config'<>
2016-05-28 16:05:32,346 [DEBUG][org.nutz.ioc.impl.NutIoc] - Get 'config'<>
2016-05-28 16:05:32,346 [DEBUG][org.nutz.ioc.impl.NutIoc] - Get 'config'<>
2016-05-28 16:05:32,361 [DEBUG][org.nutz.ioc.impl.NutIoc] - Get 'config'<>
2016-05-28 16:05:32,361 [DEBUG][org.nutz.ioc.impl.NutIoc] - Get 'config'<>
2016-05-28 16:05:32,361 [DEBUG][org.nutz.ioc.impl.NutIoc] - Get 'config'<>
2016-05-28 16:05:32,361 [DEBUG][org.nutz.ioc.impl.NutIoc] - Get 'config'<>
2016-05-28 16:05:32,361 [DEBUG][org.nutz.ioc.impl.NutIoc] - Get 'config'<>
2016-05-28 16:05:32,361 [DEBUG][org.nutz.ioc.impl.NutIoc] - Get 'config'<>
2016-05-28 16:05:32,377 [DEBUG][org.nutz.ioc.impl.NutIoc] - Get 'sqlManeger'<>
2016-05-28 16:05:32,377 [DEBUG][org.nutz.ioc.impl.NutIoc] - 	 >> Load definition name=sqlManeger
2016-05-28 16:05:32,377 [DEBUG][org.nutz.ioc.loader.map.MapLoader] - Loading define for name=sqlManeger
2016-05-28 16:05:32,392 [DEBUG][org.nutz.ioc.loader.combo.ComboIocLoader] - Found IocObject(sqlManeger) in JsonLoader(paths=[config/])
2016-05-28 16:05:32,392 [DEBUG][org.nutz.ioc.impl.NutIoc] - 	 >> Make...'sqlManeger'<>
2016-05-28 16:05:32,392 [DEBUG][org.nutz.ioc.aop.impl.DefaultMirrorFactory] - Load class org.nutz.dao.impl.FileSqlManager without AOP
2016-05-28 16:05:32,392 [DEBUG][org.nutz.ioc.impl.ScopeContext] - Save object 'sqlManeger' to [app] 
2016-05-28 16:05:32,392 [DEBUG][org.nutz.resource.Scans] - Found 0 resource by src( sqls ) , regex( .(sql|sqlx|sqls)$ )
2016-05-28 16:05:32,392 [DEBUG][org.nutz.ioc.impl.NutIoc] - Get 'dataSource'<>
2016-05-28 16:05:32,392 [DEBUG][org.nutz.ioc.impl.NutIoc] - Get 'sqlManeger'<>
2016-05-28 16:05:32,408 [DEBUG][org.nutz.dao.impl.NutDao] - NutDao[_selfId=0] init ...
2016-05-28 16:05:32,439 [INFO][org.nutz.filepool.NutFilePool] - Init file-pool by: C:\Users\Administrator/.nutz/tmp/dao/ [200000]
2016-05-28 16:05:32,439 [DEBUG][org.nutz.filepool.NutFilePool] - file-pool.home: 'C:\Users\Administrator\.nutz\tmp\dao'
2016-05-28 16:05:32,439 [INFO][org.nutz.filepool.NutFilePool] - file-pool.cursor: 0
2016-05-28 16:05:32,455 [DEBUG][org.nutz.dao.jdbc.Jdbcs] - Jdbcs init complete
2016-05-28 16:05:32,455 [INFO][org.nutz.dao.jdbc.Jdbcs] - Get Connection from DataSource for JdbcExpert, if I lock at here, check your database server and configure
2016-05-28 16:05:32,892 [DEBUG][druid.sql.Connection] - {conn-10001} connected
2016-05-28 16:05:32,955 [DEBUG][druid.sql.Connection] - {conn-10002} connected
2016-05-28 16:05:33,002 [DEBUG][druid.sql.Connection] - {conn-10003} connected
2016-05-28 16:05:33,064 [DEBUG][druid.sql.Connection] - {conn-10004} connected
2016-05-28 16:05:33,142 [DEBUG][druid.sql.Connection] - {conn-10005} connected
2016-05-28 16:05:33,189 [DEBUG][druid.sql.Connection] - {conn-10006} connected
2016-05-28 16:05:33,267 [DEBUG][druid.sql.Connection] - {conn-10007} connected
2016-05-28 16:05:33,314 [DEBUG][druid.sql.Connection] - {conn-10008} connected
2016-05-28 16:05:33,361 [DEBUG][druid.sql.Connection] - {conn-10009} connected
2016-05-28 16:05:33,408 [DEBUG][druid.sql.Connection] - {conn-10010} connected
2016-05-28 16:05:33,439 [INFO][com.alibaba.druid.pool.DruidDataSource] - {dataSource-1} inited
2016-05-28 16:05:33,455 [DEBUG][druid.sql.Connection] - {conn-10010} pool-connect
2016-05-28 16:05:33,455 [DEBUG][druid.sql.Connection] - {conn-10010} pool-recycle
2016-05-28 16:05:33,455 [DEBUG][druid.sql.Connection] - {conn-10010} pool-connect
2016-05-28 16:05:33,455 [DEBUG][org.nutz.dao.impl.DaoSupport] - JDBC Driver --> mysql-connector-java-5.1.39 ( Revision: 3289a357af6d09ecc1a10fd3c26e95183e5790ad )
2016-05-28 16:05:33,455 [DEBUG][org.nutz.dao.impl.DaoSupport] - JDBC Name   --> MySQL Connector Java
2016-05-28 16:05:33,455 [DEBUG][org.nutz.dao.impl.DaoSupport] - JDBC URL    --> jdbc:mysql:///wxnutz?useUnicode=true&characterEncoding=utf8
2016-05-28 16:05:33,471 [DEBUG][druid.sql.Statement] - {conn-10010, stmt-20000} created
2016-05-28 16:05:33,611 [DEBUG][druid.sql.Statement] - {conn-10010, stmt-20000, rs-50000} query executed. 136.966849 millis. 
SHOW VARIABLES LIKE 'character_set%'
2016-05-28 16:05:33,611 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20000, rs-50000} open
2016-05-28 16:05:33,611 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20000, rs-50000} Header: [VARIABLE_NAME, VARIABLE_VALUE]
2016-05-28 16:05:33,611 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20000, rs-50000} Result: [character_set_client, utf8]
2016-05-28 16:05:33,611 [DEBUG][org.nutz.dao.impl.DaoSupport] - Mysql : character_set_client=utf8
2016-05-28 16:05:33,611 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20000, rs-50000} Result: [character_set_connection, utf8]
2016-05-28 16:05:33,611 [DEBUG][org.nutz.dao.impl.DaoSupport] - Mysql : character_set_connection=utf8
2016-05-28 16:05:33,611 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20000, rs-50000} Result: [character_set_database, utf8]
2016-05-28 16:05:33,611 [DEBUG][org.nutz.dao.impl.DaoSupport] - Mysql : character_set_database=utf8
2016-05-28 16:05:33,627 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20000, rs-50000} Result: [character_set_filesystem, binary]
2016-05-28 16:05:33,627 [DEBUG][org.nutz.dao.impl.DaoSupport] - Mysql : character_set_filesystem=binary
2016-05-28 16:05:33,627 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20000, rs-50000} Result: [character_set_results, ]
2016-05-28 16:05:33,642 [DEBUG][org.nutz.dao.impl.DaoSupport] - Mysql : character_set_results=
2016-05-28 16:05:33,642 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20000, rs-50000} Result: [character_set_server, utf8]
2016-05-28 16:05:33,642 [DEBUG][org.nutz.dao.impl.DaoSupport] - Mysql : character_set_server=utf8
2016-05-28 16:05:33,642 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20000, rs-50000} Result: [character_set_system, utf8]
2016-05-28 16:05:33,642 [DEBUG][org.nutz.dao.impl.DaoSupport] - Mysql : character_set_system=utf8
2016-05-28 16:05:33,642 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20000, rs-50000} Result: [character_sets_dir, D:\MySQL\mysql-5.6.28-winx64\share\charsets\]
2016-05-28 16:05:33,642 [DEBUG][org.nutz.dao.impl.DaoSupport] - Mysql : character_sets_dir=D:\MySQL\mysql-5.6.28-winx64\share\charsets\
2016-05-28 16:05:33,642 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20000, rs-50000} closed
2016-05-28 16:05:33,658 [DEBUG][druid.sql.Statement] - {conn-10010, stmt-20000, rs-50001} query executed. 4.604775 millis. 
SELECT DATABASE()
2016-05-28 16:05:33,658 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20000, rs-50001} open
2016-05-28 16:05:33,658 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20000, rs-50001} Header: [DATABASE()]
2016-05-28 16:05:33,658 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20000, rs-50001} Result: [nutz]
2016-05-28 16:05:33,658 [DEBUG][org.nutz.dao.impl.DaoSupport] - Mysql : database=nutz
2016-05-28 16:05:33,658 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20000, rs-50001} closed
2016-05-28 16:05:33,658 [DEBUG][druid.sql.Statement] - {conn-10010, stmt-20000, rs-50002} query executed. 4.569854 millis. 
SELECT USER()
2016-05-28 16:05:33,658 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20000, rs-50002} open
2016-05-28 16:05:33,658 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20000, rs-50002} Header: [USER()]
2016-05-28 16:05:33,658 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20000, rs-50002} Result: [xsd@120.26.228.42]
2016-05-28 16:05:33,658 [DEBUG][org.nutz.dao.impl.DaoSupport] - Mysql : user=xsd@120.26.228.42
2016-05-28 16:05:33,658 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20000, rs-50002} closed
2016-05-28 16:05:33,658 [DEBUG][druid.sql.Statement] - {conn-10010, stmt-20000} closed
2016-05-28 16:05:33,674 [DEBUG][druid.sql.Statement] - {conn-10010, pstmt-20001} created. 
SELECT TABLE_NAME FROM information_schema.TABLES where TABLE_SCHEMA = ? and engine = 'MyISAM'
2016-05-28 16:05:33,705 [DEBUG][druid.sql.Statement] - {conn-10010, pstmt-20001} Parameters : [nutz]
2016-05-28 16:05:33,705 [DEBUG][druid.sql.Statement] - {conn-10010, pstmt-20001} Types : [VARCHAR]
2016-05-28 16:05:33,705 [DEBUG][druid.sql.Statement] - {conn-10010, pstmt-20001, rs-50003} query executed. 7.402338 millis. 
SELECT TABLE_NAME FROM information_schema.TABLES where TABLE_SCHEMA = ? and engine = 'MyISAM'
2016-05-28 16:05:33,705 [DEBUG][druid.sql.ResultSet] - {conn-10010, pstmt-20001, rs-50003} open
2016-05-28 16:05:33,705 [DEBUG][druid.sql.ResultSet] - {conn-10010, pstmt-20001, rs-50003} Header: [TABLE_NAME]
2016-05-28 16:05:33,705 [DEBUG][druid.sql.ResultSet] - {conn-10010, pstmt-20001, rs-50003} closed
2016-05-28 16:05:33,705 [DEBUG][druid.sql.Statement] - {conn-10010, pstmt-20001} closed
2016-05-28 16:05:33,705 [DEBUG][druid.sql.Connection] - {conn-10010} pool-recycle
2016-05-28 16:05:33,705 [DEBUG][org.nutz.dao.impl.DaoSupport] - Database info --> MYSQL:[MySQL - 5.6.28-log]
2016-05-28 16:05:33,705 [DEBUG][org.nutz.dao.impl.DaoSupport] - SqlManager Sql count=0
2016-05-28 16:05:33,736 [DEBUG][org.nutz.resource.Scans] - Found 25 resource by src( net/hzfanqun/weixin/ ) , regex( ^.+[.]class$ )
2016-05-28 16:05:33,799 [DEBUG][druid.sql.Connection] - {conn-10010} pool-connect
2016-05-28 16:05:33,799 [DEBUG][druid.sql.Statement] - {conn-10010, stmt-20002} created
2016-05-28 16:05:33,814 [DEBUG][druid.sql.Statement] - {conn-10010, stmt-20002, rs-50004} query executed. 7.731429 millis. 
SELECT * FROM users LIMIT 1
2016-05-28 16:05:33,814 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20002, rs-50004} open
2016-05-28 16:05:33,814 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20002, rs-50004} Header: [id, openid, headimgurl, createTime, subscribe, nickname, sex, language, city, province, country, subscribe_time]
2016-05-28 16:05:33,814 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20002, rs-50004} closed
2016-05-28 16:05:33,814 [DEBUG][druid.sql.Statement] - {conn-10010, stmt-20002} closed
2016-05-28 16:05:33,814 [DEBUG][druid.sql.Connection] - {conn-10010} pool-recycle
2016-05-28 16:05:33,830 [DEBUG][druid.sql.Connection] - {conn-10010} pool-connect
2016-05-28 16:05:33,830 [DEBUG][druid.sql.Statement] - {conn-10010, stmt-20003} created
2016-05-28 16:05:33,830 [DEBUG][druid.sql.Statement] - {conn-10010, stmt-20003, rs-50005} query executed. 3.929549 millis. 
SELECT * FROM user_location LIMIT 1
2016-05-28 16:05:33,830 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20003, rs-50005} open
2016-05-28 16:05:33,830 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20003, rs-50005} Header: [id, open_id, label, lng, lat, bd09_lng, bd09_lat, create_time]
2016-05-28 16:05:33,830 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20003, rs-50005} closed
2016-05-28 16:05:33,830 [DEBUG][druid.sql.Statement] - {conn-10010, stmt-20003} closed
2016-05-28 16:05:33,830 [DEBUG][druid.sql.Connection] - {conn-10010} pool-recycle
2016-05-28 16:05:33,830 [DEBUG][druid.sql.Connection] - {conn-10010} pool-connect
2016-05-28 16:05:33,830 [DEBUG][druid.sql.Statement] - {conn-10010, stmt-20004} created
2016-05-28 16:05:33,830 [DEBUG][druid.sql.Statement] - {conn-10010, stmt-20004, rs-50006} query executed. 6.036521 millis. 
SELECT COUNT(1) FROM users where 1!=1
2016-05-28 16:05:33,830 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20004, rs-50006} open
2016-05-28 16:05:33,830 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20004, rs-50006} Header: [COUNT(1)]
2016-05-28 16:05:33,830 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20004, rs-50006} Result: [0]
2016-05-28 16:05:33,846 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20004, rs-50006} closed
2016-05-28 16:05:33,846 [DEBUG][druid.sql.Statement] - {conn-10010, stmt-20004} closed
2016-05-28 16:05:33,846 [DEBUG][druid.sql.Connection] - {conn-10010} pool-recycle
2016-05-28 16:05:33,846 [DEBUG][druid.sql.Connection] - {conn-10010} pool-connect
2016-05-28 16:05:33,846 [DEBUG][druid.sql.Statement] - {conn-10010, stmt-20005} created
2016-05-28 16:05:33,846 [DEBUG][druid.sql.Statement] - {conn-10010, stmt-20005, rs-50007} query executed. 3.952737 millis. 
SELECT COUNT(1) FROM user_location where 1!=1
2016-05-28 16:05:33,846 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20005, rs-50007} open
2016-05-28 16:05:33,846 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20005, rs-50007} Header: [COUNT(1)]
2016-05-28 16:05:33,846 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20005, rs-50007} Result: [0]
2016-05-28 16:05:33,846 [DEBUG][druid.sql.ResultSet] - {conn-10010, stmt-20005, rs-50007} closed
2016-05-28 16:05:33,846 [DEBUG][druid.sql.Statement] - {conn-10010, stmt-20005} closed
2016-05-28 16:05:33,846 [DEBUG][druid.sql.Connection] - {conn-10010} pool-recycle
2016-05-28 16:05:33,846 [INFO][org.nutz.mvc.impl.NutLoading] - Nutz.Mvc[nutz] is up in 2219ms
2016-05-28 16:05:33,846 [INFO][org.nutz.mvc.NutFilter] - exclusionsPrefix  = ^(/druid/)
2016-05-28 16:05:33,846 [INFO][org.nutz.mvc.NutFilter] - exclusionsSuffix = (.html)$

这一句

2016-05-28 16:05:31,627 [DEBUG][org.nutz.mvc.impl.NutLoading] -  - Default Charset : GBK

代表容器的编码不对. tomcat是通过什么启动的? windows service? 改启动参数,在JVM参数中加入

-Dfile.encoding=UTF-8

@wendal
我是通过startup.bat运行tomcat的。加上编码就可以了,不过这样tomcat的catalina.log日志里面的中文都是乱码了。有没有更完美的解决办法呢?

用记事本看乱码很正常,用notepad++

@wendal
好的,谢谢
MainModule已经加了

@Encoding(input = "UTF-8", output = "UTF-8")

为啥还是不行呢?

用的不是最新的nutzwx?

@wendal @wendal @wendal
最新的啊,1.r.57.SNAPSHOT

来自 iPhone 6 Plus

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