NutzCN Logo
问答 org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8
发布于 2961天前 作者 Hamming 4254 次浏览 复制 上一个帖子 下一个帖子
标签:

上传文件奇怪的错误

2016-10-14 11:00:52,254 nuoshang.bluejay.common.shiro.cache.RedisCache.put(RedisCache.java:54) DEBUG - SET name=shiro-activeSessionCache key=70qv5bejsihmgot7hroqg6q0lv
2016-10-14 11:00:52,254 nuoshang.bluejay.common.shiro.cache.LCache.fire(LCache.java:95) DEBUG - fire channel=LCache:shiro-activeSessionCache msg=s9f9d4eeveimmqvl1ft2gedidg:70qv5bejsihmgot7hroqg6q0lv
2016-10-14 11:00:52,255 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) DEBUG - Found mapping for [POST] path=/app/app_users/photo : AppUserModules.userPhoto(AppUserModules.java:322)
2016-10-14 11:00:52,255 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'permission'<class nuoshang.bluejay.common.shiro.view.Permission>
2016-10-14 11:00:52,255 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'dateUtil'<class nuoshang.bluejay.common.util.DateUtil>
2016-10-14 11:00:52,255 nuoshang.bluejay.common.shiro.cache.CachePubSub.onPMessage(CachePubSub.java:15) DEBUG - channel=LCache:shiro-activeSessionCache, msg=s9f9d4eeveimmqvl1ft2gedidg:70qv5bejsihmgot7hroqg6q0lv
2016-10-14 11:00:52,255 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'stringUtil'<class nuoshang.bluejay.common.util.StringUtil>
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte Ff in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte Ff in state 2
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 00 in state 2
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 84 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte Ff in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte C0 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 01 in state 2
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 03 in state 2
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte Ff in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 01 in state 2
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte A2 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 81 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 91 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte A1 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte B1 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte C1 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte F0 in state 2
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 82 in state 0
[WARNING] java.lang.NumberFormatException: !hex 38
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 83 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 84 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 85 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 86 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 87 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 88 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 89 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 8a in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 92 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 93 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 94 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 95 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 96 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 97 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 98 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 99 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 9a in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte A2 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte A3 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte A4 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte A5 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte A6 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte A7 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte A8 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte A9 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte Aa in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte B2 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte B3 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte B4 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte B5 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte B6 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte B7 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte B8 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte B9 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte Ba in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte C3 in state 2
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte C5 in state 2
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte C7 in state 2
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte C9 in state 2
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte D2 in state 2
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte D4 in state 2
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte D6 in state 2
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte D8 in state 2
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte Da in state 2
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte E2 in state 3
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte E4 in state 3
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte E6 in state 3
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte E8 in state 3
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte Ea in state 3
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte F2 in state 7
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte F4 in state 7
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte F5 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte F6 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte F7 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte F8 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte F9 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte Fa in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 81 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 91 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte A1 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte B1 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte C1 in state 0
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 15 in state 6
[WARNING] org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte 0a in state 2
2016-10-14 11:00:52,260 nuoshang.bluejay.common.processor.LogTimeProcessor.process(LogTimeProcessor.java:26) DEBUG - [POST]URI=/app/app_users/photo 5ms
2016-10-14 11:00:52,262 org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:28) WARN  - Error@/app/app_users/photo :
org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte Ef in state 3
	at org.eclipse.jetty.util.Utf8Appendable.appendByte(Utf8Appendable.java:195)
	at org.eclipse.jetty.util.Utf8Appendable.append(Utf8Appendable.java:134)
	at org.eclipse.jetty.util.UrlEncoded.decodeUtf8To(UrlEncoded.java:595)
	at org.eclipse.jetty.util.UrlEncoded.decodeTo(UrlEncoded.java:641)
	at org.eclipse.jetty.server.Request.extractFormParameters(Request.java:371)
	at org.eclipse.jetty.server.Request.extractContentParameters(Request.java:303)
	at org.eclipse.jetty.server.Request.extractParameters(Request.java:257)
	at org.eclipse.jetty.server.Request.getParameter(Request.java:826)
	at javax.servlet.ServletRequestWrapper.getParameter(ServletRequestWrapper.java:194)
	at nuoshang.bluejay.common.processor.GlobalsSettingProcessor.process(GlobalsSettingProcessor.java:28)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at nuoshang.bluejay.common.processor.LogTimeProcessor.process(LogTimeProcessor.java:21)
	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.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at nuoshang.bluejay.common.filter.RouteFilter.doFilter(RouteFilter.java:33)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:224)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
	at org.eclipse.jetty.server.Server.handle(Server.java:499)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
	at java.lang.Thread.run(Thread.java:745)

6 回复

用什么上传的?网页?

@wendal
上传图片


@At("/photo") @AdaptBy(type = UploadAdaptor.class, args = { "ioc:myUpload" }) @POST @Ok("json:{ignoreNull:true}") // @Filters(@By(type=AccessTokenFilter.class)) public Object userPhoto(@Param("id") String id, @Param("token") String token, @Param("photo") TempFile tf, AdaptorErrorContext err) { try { if (err != null && err.getAdaptorErr() != null) { return ResultApp.error(3,"文件不合法"); } else if (tf == null) { return ResultApp.error(3,"空文件"); } else { if(id == null){ return ResultApp.error(3,"ID 不能为空"); }else if (!apiService.verifyToken(id,token)) { return ResultApp.error("无效的token"); } App_user u = appUserService.fetch(Integer.parseInt(id)); // String p = Globals.AppRoot; String f = Globals.AppUploadPath + "/image/user/"+ id + R.UU32() + ".jpg";//tf.getSubmittedFileName().substring(tf.getSubmittedFileName().indexOf(".")) //保存到数据库的路径 String path = f.substring(0,(f.length() - 4)); if(u.getIcon()!=null){ String ordPath = u.getIcon() +".jpg"; ordPath = ordPath.substring(10,ordPath.length()); ///open/file/upload new File(ordPath).delete();//删除原本的图片 u.setIcon( "/open/file" + path); }else { u.setIcon("/open/file" + path); } BufferedImage imgTemp = Images.read(tf.getInputStream()); //裁剪图片大小 imgTemp = Images.zoomScale(imgTemp, 200, 200, Color.WHITE); Images.writeJpeg(imgTemp, Files.createFileIfNoExists(new File(f)),0.9f); // Files.write(new File(f), tf.getInputStream()); appUserService.updateUser(u); NutMap re = new NutMap(); re.addv("icon",u.getIcon()); return ResultApp.success("success",re); } } catch (Exception e) { return ResultApp.error(e.toString()); } catch (Throwable e) { return ResultApp.error(3,"图片格式错误"); } }

配置文件

var ioc={
    tmpFilePool : {
        type : 'org.nutz.filepool.NutFilePool',
        // 临时文件最大个数为 1000 个
        args : [ "~/bluejay/upload/tmp", 1000 ]
    },
    uploadImageContext : {
        type : 'org.nutz.mvc.upload.UploadingContext',
        singleton : false,
        args : [ { refer : 'tmpFilePool' } ],
        fields : {
        // 是否忽略空文件, 默认为 false
        ignoreNull : true,
        // 单个文件最大尺寸(大约的值,单位为字节,即 2097152 为 2M)
        maxFileSize : 2097152,
        // 正则表达式匹配可以支持的文件名
        nameFilter : '^(.+[.])(gif|jpg|png)$'
        }
    },
    imageUpload : {
        type : 'org.nutz.mvc.upload.UploadAdaptor',
        singleton : false,
        args : [ { refer : 'uploadImageContext' } ]
    },

    uploadFileContext : {
        type : 'org.nutz.mvc.upload.UploadingContext',
        singleton : false,
        args : [ { refer : 'tmpFilePool' } ],
        fields : {
            // 是否忽略空文件, 默认为 false
            ignoreNull : true,
            // 单个文件最大尺寸(大约的值,单位为字节,即 20971520 为 20M)
            maxFileSize : 20971520,
            // 正则表达式匹配可以支持的文件名
            nameFilter : '^(.+[.])(gif|jpg|png|doc|docx|xls|xlsx|rar|zip|7z|flv|swf|mkv|avi|txt|xml|pdf|md|pptx|ppt|flv|swf|mkv|avi|rm|rmvb|wmv|mp4|mov|mpg|mpeg)$'
        }
    },
    myUpload : {
        type : 'org.nutz.mvc.upload.UploadAdaptor',
        singleton : false,
        args : [ { refer : 'uploadFileContext' } ]
    },
    fileUpload : {
        type : 'org.nutz.mvc.upload.UploadAdaptor',
        singleton : false,
        args : [ { refer : 'uploadFileContext' } ]
    },
    uploadVideoContext : {
        type : 'org.nutz.mvc.upload.UploadingContext',
        singleton : false,
        args : [ { refer : 'tmpFilePool' } ],
        fields : {
            // 是否忽略空文件, 默认为 false
            ignoreNull : true,
            // 单个文件最大尺寸(大约的值,单位为字节,即 209715200 为 200M)
            maxFileSize : 209715200,
            // 正则表达式匹配可以支持的文件名
            nameFilter : '^(.+[.])(flv|swf|mkv|avi|rm|rmvb|wmv|mp4|mov|mpg|mpeg)$'
        }
    },
    videoUpload : {
        type : 'org.nutz.mvc.upload.UploadAdaptor',
        singleton : false,
        args : [ { refer : 'uploadVideoContext' } ]
    }
};

@tonyyule 是不是网页表单上传?

@tonyyule 那就不是网页上传。

content type选错

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