安卓从网站读数据时遇到偶发异常java.io.EOFException

代码如下
package com.example.aaa;

public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
caonima("http://www.weather.com.cn/data/cityinfo/101010100.html");
}

public void caonima(final String address){
    new Thread(new Runnable(){
        @Override
        public void run() {
            HttpURLConnection connection=null;
            try {
                URL url=new URL(address);
                connection=(HttpURLConnection) url.openConnection();
                connection.setRequestMethod("GET");
                connection.setConnectTimeout(8000);
                connection.setReadTimeout(8000);
                InputStream in=connection.getInputStream();
                BufferedReader reader=new BufferedReader(new InputStreamReader(in));
                StringBuilder response=new StringBuilder();
                String line;
                while((line=reader.readLine())!=null){
                    response.append(line);
                }                                           
                System.out.println(response.toString());

            } catch (Exception e) {
                System.out.println( e.toString());

            }finally{
                if(connection!=null){
                    connection.disconnect();
                }
            }

}

    }).start();
}

}
同类型有些address会进这个异常,但有些不会进,
(这些address在浏览器输入网站返回的json数据都是正常的)

4个回答

这个我看过了,还是不能解决,有些特定地址正常运行,而有些却不可以让我无法理解

你改成https试下,现在很多都重定向为http为https了

或者使用网络框架,比如okhttp,它底层自动实现重定向了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
readUTF()使用报 java.io.EOFException异常

今天在编程的时候,用到了DataInPutStream类的readUTF()方法时报了个异常,查了好多资料也不能解决,求大神指点啊.高分悬赏. ``` package IO流; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class DataTest { /** * 数据输入输出流 * */ public static void main(String[] args) throws IOException { //向指定文件中写入数据 //打开文件输出流 FileOutputStream fos=new FileOutputStream("G://word.txt"); //将此输出流链接到指定基础输出流DataOutPutStream DataOutputStream dos=new DataOutputStream(fos); //写入数据: dos.writeBytes("我是大禹!");//用此方法写入的数据用记事本打开是乱码 dos.writeChars("我治水!");//用此方法写入的数据用记事本打开是乱码 dos.writeUTF("你智障吗?"); //关闭流 fos.close(); //从文件中读取数据 //首先打开文件输入流 FileInputStream fis=new FileInputStream("G://word.txt"); //将此输入流连接到基本数据输入流DataInPutStream DataInputStream dis=new DataInputStream(fis); //开始读取数据啦 // String s=dis.readUTF(); System.out.println(dis.readUTF()); dis.close(); } } ``` 异常信息: Exception in thread "main" java.io.EOFException at java.io.DataInputStream.readFully(DataInputStream.java:180) at java.io.DataInputStream.readUTF(DataInputStream.java:592) at java.io.DataInputStream.readUTF(DataInputStream.java:547) at IO流.DataTest.main(DataTest.java:35)

tomcat启动报java.io.EOFException,不影响运行

java.io.EOFException at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2577) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1315) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369) at net.bull.javamelody.CounterStorage.readFromFile(CounterStorage.java:110) at net.bull.javamelody.Counter.readFromFile(Counter.java:883) at net.bull.javamelody.Collector.<init>(Collector.java:111) at net.bull.javamelody.FilterContext.<init>(FilterContext.java:102) at net.bull.javamelody.MonitoringFilter.init(MonitoringFilter.java:111) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4650) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5306) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1100) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1618) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722)

socket C Java java.io.EOFException

问题是这样的 socket server 是Java实现的 socket 客户端是C语言实现的 当客户端发请求时,server端input.readUTF()时报java.io.EOFException,网上查了,说是读取输入流末尾还读 会报这个错,try{...} catch{java.io.EOFException e}就可以了。但是我添加了后,日志不报错,对方说还是没有响应。说明还是有问题。 不知该怎么解决了。请各位看看。 请求报文为xml格式的String 我本地自己Java写的客户端测试是可以的。 代码如下: public class SocketServer extends Thread implements Runnable { private ServletConfig sce; private WebApplicationContext appConent; //构造函数 public SocketServer(ServletConfig sce,WebApplicationContext appConent){ this.sce=sce; this.appConent=appConent; } public void run() { try{ ServerSocket listener=new ServerSocket(5555); Socket server; while(true){ //开始监听 server=listener.accept() ; NetWorkServer nwServer=new NetWorkServer(server,sce,appConent); nwServer.start(); } } catch (Exception e){ e.printStackTrace(); } } } protected Socket socket; private static final Log log = LogFactory.getLog(NetWorkServer.class); private ServletConfig sce; private WebApplicationContext appConent; public NetWorkServer(Socket sThread,ServletConfig sce,WebApplicationContext appConent){ this.socket =sThread; this.sce=sce; this.appConent=appConent; } public void run() { try{ DataInputStream input = new DataInputStream(socket.getInputStream()); DataOutputStream output = new DataOutputStream(socket.getOutputStream()); //客户端请求传过来的String(这里是可以的,能收到客户端请求的String) String paraInfoXML = input.readUTF(); /*返回结果*/ String result = "" ; SAXReader reader=new SAXReader(); StringReader sr=new StringReader(paraInfoXML); org.xml.sax.InputSource is=new org.xml.sax.InputSource(sr); try { /*业务逻辑*/ Document doc=reader.read(is); } catch (DocumentException e) { e.printStackTrace(); } output.writeUTF(result); output.flush(); output.close(); input.close(); //关闭连接 socket.close(); } catch (IOException e){ e.printStackTrace(); } }

android的访问服务器数据查询报java.io.EOFException错误

android为什么只有传递时间格式才报java.io.EOFException错误 private HttpPostUtil mHttp = null; private void refresh() { new Thread(new Runnable() { @Override public void run() { try { mHttp.clearTextParameter(); mHttp.setUrl(ConstantInfo.EVENT_QUERY_LIST_URL); mHttp.addTextParameter("item", mEventInfo); LogUtil.d("获取查询的条件", mEventInfo.getEventState()); mHttp.addTextParameter("pageSize", pageSize); LogUtil.d("获取查询的条件2", mEventInfo.getEndTime()); mHttp.addTextParameter("pageIndex", pageIndex); String result = mHttp.connect(); LogUtil.d("获取查询的条件3", result); eventList = GsonUtil.fromJsonList(result, EventInfo.class); LogUtil.d("获取查询的条件4", eventList); sendEmptyMessage(mHandler, ErrorCode.SUCCESS); } catch (ConnectException e) { LogUtil.e(TAG, e.toString()); sendEmptyMessage(mHandler, ErrorCode.ERROR_NETWORK); } catch (Exception e) { LogUtil.e(TAG, e.toString()); LogUtil.d("获取查询的条件5",e.toString()); sendEmptyMessage(mHandler, ErrorCode.ERROR_SERVICE); } } }).start(); } public String connect() throws IOException { //中断连接 this.isInterrupt = false; try { initConnection(); } catch (Exception e) { LogUtil.e(TAG, e.toString()); throw new ConnectException("连接服务器失败,可能设备没网络"); } conn.connect(); //写入流 OutputStream os = conn.getOutputStream(); LogUtil.d("获取的流是多少", os); mDataOutputStream = new DataOutputStream(os); LogUtil.d("获取的流是多少2", mDataOutputStream); //写入 writeStringParams(); writeFileParams(); paramsEnd(); LogUtil.d("获取的状态码是多少", conn.getResponseCode()); //连接成功的标志200 if(conn.getResponseCode() == HttpURLConnection.HTTP_OK) { //获取输入的流 InputStream in = conn.getInputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream(); int b = -1; while ((b = in.read()) > -1) { out.write(b); } byte[] arr = out.toByteArray(); out.close(); in.close(); mDataOutputStream.close(); os.close(); disconnect(); LogUtil.d("获取的字节的数组", arr); String result = new String(arr); if(TextUtils.isEmpty(result)) { throw new NullPointerException("服务器返回值为空"); } LogUtil.d(TAG, result); return result; } else { LogUtil.e(TAG , "响应码==> " + conn.getResponseCode()); throw new IOException("服务器异常"); } }

readUTF报错java.io.EOFException?

import java.io.*; public class DataInputstream { public static void main(String[] args) { int n; String s; try { DataInputStream dis=new DataInputStream(new FileInputStream("E:\\a.txt"));//文件夹内是“java编程”路径是绝对路径 s=dis.readUTF(); n=dis.readInt(); System.out.println(s); System.out.println(n); }catch (Exception e){ System.out.println(e); System.out.println("fail"); } } } //注销掉s=dis.readUTF();和system.out.println(s);之后输出的是-408384539 //这是哪里出问题了吗,还是语言语法错了?

ehcache使用报错java.io.EOFException DiskStorageFactory.retrieve?

项目中使用ehcache报错如下: net.sf.ehcache.CacheException: java.io.EOFException at net.sf.ehcache.store.disk.DiskStorageFactory.retrieve(DiskStorageFactory.java:938) ~[ehcache-core-2.5.0.jar:na] at net.sf.ehcache.store.disk.Segment.decode(Segment.java:167) ~[ehcache-core-2.5.0.jar:na] at net.sf.ehcache.store.disk.Segment.put(Segment.java:444) ~[ehcache-core-2.5.0.jar:na] at net.sf.ehcache.store.disk.DiskStore.put(DiskStore.java:475) ~[ehcache-core-2.5.0.jar:na] at net.sf.ehcache.store.FrontEndCacheTier.put(FrontEndCacheTier.java:221) ~[ehcache-core-2.5.0.jar:na] at net.sf.ehcache.Cache.putInternal(Cache.java:1492) ~[ehcache-core-2.5.0.jar:na] at net.sf.ehcache.Cache.put(Cache.java:1417) ~[ehcache-core-2.5.0.jar:na] at net.sf.ehcache.Cache.put(Cache.java:1382) ~[ehcache-core-2.5.0.jar:na] at org.springframework.cache.ehcache.EhCacheCache.put(EhCacheCache.java:82) ~[spring-context-support-4.2.5.RELEASE.jar:4.2.5.RELEASE] at com.order.util.base.util.EhcacheUtil.put(EhcacheUtil.java:128) at com.order.service.impl.orderServerImpl.order(orderServerImpl.java:80) at sun.reflect.GeneratedMethodAccessor111.invoke(Unknown Source) ~[na:na] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_79] at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_79] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) [spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) [spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) [spring-webmvc-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:817) [spring-webmvc-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:731) [spring-webmvc-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) [spring-webmvc-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) [spring-webmvc-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) [spring-webmvc-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:968) [spring-webmvc-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:870) [spring-webmvc-4.2.5.RELEASE.jar:4.2.5.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:661) [servlet-api.jar:na] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:844) [spring-webmvc-4.2.5.RELEASE.jar:4.2.5.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) [servlet-api.jar:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [catalina.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.23] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-websocket.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.23] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121) [spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.23] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) [catalina.jar:8.5.23] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [catalina.jar:8.5.23] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478) [catalina.jar:8.5.23] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [catalina.jar:8.5.23] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [catalina.jar:8.5.23] at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650) [catalina.jar:8.5.23] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [catalina.jar:8.5.23] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [catalina.jar:8.5.23] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) [tomcat-coyote.jar:8.5.23] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-coyote.jar:8.5.23] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-coyote.jar:8.5.23] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459) [tomcat-coyote.jar:8.5.23] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:8.5.23] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_79] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_79] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.5.23] at java.lang.Thread.run(Thread.java:745) [na:1.7.0_79] Caused by: java.io.EOFException: null at java.io.RandomAccessFile.readFully(RandomAccessFile.java:446) ~[na:1.7.0_79] at java.io.RandomAccessFile.readFully(RandomAccessFile.java:424) ~[na:1.7.0_79] at net.sf.ehcache.store.disk.DiskStorageFactory.read(DiskStorageFactory.java:372) ~[ehcache-core-2.5.0.jar:na] at net.sf.ehcache.store.disk.DiskStorageFactory.retrieve(DiskStorageFactory.java:936) ~[ehcache-core-2.5.0.jar:na] ... 55 common frames omitted

如何解决java.io.EOFException:在android 1的改造服务调用中第1行第1列路径1的输入结束?

<div class="post-text" itemprop="text"> <p>I am new to android. I am not getting why this error is coming. Error : java.io.EOFException: End of input at line 1 column 1 path $ W/System.err:at com.google.gson.stream.JsonReader.nextNonWhitespace(JsonReader.java:1393) Please help. This is my code : 1. Pojo </p> <pre><code>class ProfileEntity implements Parcelable { @SerializedName("tag") @Expose private String tag; @SerializedName("success") @Expose private Integer success; @SerializedName("error") @Expose private Integer error; @SerializedName("studentId") @Expose private String studentId; @SerializedName("pic_id") @Expose private String picId; @SerializedName("instUrl") @Expose private String instUrl; @SerializedName("course_name") @Expose private String courseName; @SerializedName("batch_name") @Expose private String batchName; @SerializedName("semester_name") @Expose private Object semesterName; @SerializedName("section_name") @Expose private String sectionName; @SerializedName("first_name") @Expose private String firstName; @SerializedName("last_name") @Expose private String lastName; @SerializedName("username") @Expose private String username; @SerializedName("groupname") @Expose private String groupname; @SerializedName("mobile") @Expose private String mobile; @SerializedName("email") @Expose private String email; @SerializedName("dob") @Expose private String dob; @SerializedName("address") @Expose private String address; @SerializedName("dbname") @Expose private String dbname; @SerializedName("Branch_id") @Expose private String branchId; @SerializedName("org_id") @Expose private String orgId; @SerializedName("cyear") @Expose private String cyear; @SerializedName("url") @Expose private String url; @SerializedName("password") @Expose private String password; public final static Creator&lt;ProfileEntity&gt; CREATOR = new Creator&lt;ProfileEntity&gt;() { @SuppressWarnings({ "unchecked" }) public ProfileEntity createFromParcel(Parcel in) { return new ProfileEntity(in); } public ProfileEntity[] newArray(int size) { return (new ProfileEntity[size]); } }; protected ProfileEntity(Parcel in) { this.tag = ((String) in.readValue((String.class.getClassLoader()))); this.success = ((Integer) in.readValue((Integer.class.getClassLoader()))); this.error = ((Integer) in.readValue((Integer.class.getClassLoader()))); this.studentId = ((String) in.readValue((String.class.getClassLoader()))); this.picId = ((String) in.readValue((String.class.getClassLoader()))); this.instUrl = ((String) in.readValue((String.class.getClassLoader()))); this.courseName = ((String) in.readValue((String.class.getClassLoader()))); this.batchName = ((String) in.readValue((String.class.getClassLoader()))); this.semesterName = ((Object) in.readValue((Object.class.getClassLoader()))); this.sectionName = ((String) in.readValue((String.class.getClassLoader()))); this.firstName = ((String) in.readValue((String.class.getClassLoader()))); this.lastName = ((String) in.readValue((String.class.getClassLoader()))); this.username = ((String) in.readValue((String.class.getClassLoader()))); this.groupname = ((String) in.readValue((String.class.getClassLoader()))); this.mobile = ((String) in.readValue((String.class.getClassLoader()))); this.email = ((String) in.readValue((String.class.getClassLoader()))); this.dob = ((String) in.readValue((String.class.getClassLoader()))); this.address = ((String) in.readValue((String.class.getClassLoader()))); this.dbname = ((String) in.readValue((String.class.getClassLoader()))); this.branchId = ((String) in.readValue((String.class.getClassLoader()))); this.orgId = ((String) in.readValue((String.class.getClassLoader()))); this.cyear = ((String) in.readValue((String.class.getClassLoader()))); this.url = ((String) in.readValue((String.class.getClassLoader()))); this.password = ((String) in.readValue((String.class.getClassLoader()))); } public ProfileEntity() {} public String getCyear() { return cyear; } public void setCyear(String cyear) { this.cyear = cyear; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getOrgId() { return orgId; } public void setOrgId(String orgId) { this.orgId = orgId; } public String getBranchId() { return branchId; } public void setBranchId(String branchId) { this.branchId = branchId; } public String getDbname() { return dbname; } public void setDbname(String dbname) { this.dbname = dbname; } public String getTag() { return tag; } public void setTag(String tag) { this.tag = tag; } public Integer getSuccess() { return success; } public void setSuccess(Integer success) { this.success = success; } public Integer getError() { return error; } public void setError(Integer error) { this.error = error; } public String getStudentId() { return studentId; } public void setStudentId(String studentId) { this.studentId = studentId; } public String getPicId() { return picId; } public void setPicId(String picId) { this.picId = picId; } public String getInstUrl() { return instUrl; } public void setInstUrl(String instUrl) { this.instUrl = instUrl; } public String getCourseName() { return courseName; } public void setCourseName(String courseName) { this.courseName = courseName; } public String getBatchName() { return batchName; } public void setBatchName(String batchName) { this.batchName = batchName; } public Object getSemesterName() { return semesterName; } public void setSemesterName(Object semesterName) { this.semesterName = semesterName; } public String getSectionName() { return sectionName; } public void setSectionName(String sectionName) { this.sectionName = sectionName; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getGroupname() { return groupname; } public void setGroupname(String groupname) { this.groupname = groupname; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getDob() { return dob; } public void setDob(String dob) { this.dob = dob; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public void writeToParcel(Parcel dest, int flags) { dest.writeValue(tag); dest.writeValue(success); dest.writeValue(error); dest.writeValue(studentId); dest.writeValue(picId); dest.writeValue(instUrl); dest.writeValue(courseName); dest.writeValue(batchName); dest.writeValue(semesterName); dest.writeValue(sectionName); dest.writeValue(firstName); dest.writeValue(lastName); dest.writeValue(username); dest.writeValue(groupname); dest.writeValue(mobile); dest.writeValue(email); dest.writeValue(dob); dest.writeValue(address); dest.writeValue(dbname); dest.writeValue(branchId); dest.writeValue(orgId); dest.writeValue(cyear); dest.writeValue(url); dest.writeValue(password); } public int describeContents() { return 0; } } </code></pre> <ol start="2"> <li><p>ApiInterface</p> <pre><code> @Headers("Content-Type: application/json") @POST("profile.php") Call&lt;ProfileEntity&gt; getProfile(@Body ProfileEntity profileEntity); </code></pre></li> </ol> <p>3.Impl</p> <pre><code>@Override public void profileCall(ProfileEntity profileEntity) { ApiInterface controller = ApiClient.getClient(null).create(ApiInterface.class); Call&lt;ProfileEntity&gt; call = controller.getProfile(profileEntity); call.enqueue(new Callback&lt;ProfileEntity&gt;() { @Override public void onResponse(Call&lt;ProfileEntity&gt; call, Response&lt;ProfileEntity&gt; response) { if (response.body() != null) { ProfileEntity entity = response.body(); if (entity.getSuccess().toString().equalsIgnoreCase("1")) { profilePresentor.onProfileSuccess(entity); } else { profilePresentor.onLogFailedMessage(response.message()); } } else { profilePresentor.onLogFailedMessage(response.message()); } } @Override public void onFailure(Call&lt;ProfileEntity&gt; call, Throwable t) { Log.d("FAILURE....",t.toString()); t.printStackTrace(); profilePresentor.onProfileFailure(HttpURLConnection.HTTP_INTERNAL_ERROR,"Oops! Something went wrong. Please try again"); } }); } } </code></pre> <p>4.ApiClient</p> <pre><code> class ApiClient { public static String BASE_URL = "http://xxxx.xxxxxx.com/appAPI_v2/"; static Retrofit retrofit = null; public static Retrofit getClient(Map&lt;String, String&gt; headerMap) { Gson gson = new GsonBuilder() .setLenient() .create(); Retrofit.Builder builder = new Retrofit.Builder(); builder.baseUrl(BASE_URL); builder.addConverterFactory(GsonConverterFactory.create(gson)); if (headerMap != null) { builder.client(getHeader(headerMap)); } else { HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor() .setLevel(HttpLoggingInterceptor.Level.BODY); OkHttpClient.Builder httpClient = new OkHttpClient.Builder(); httpClient.readTimeout(60, TimeUnit.SECONDS); httpClient.connectTimeout(60, TimeUnit.SECONDS); if (BuildConfig.DEBUG) httpClient.addInterceptor(interceptor); builder.client(httpClient.build()); } retrofit = builder.build(); return retrofit; } @NonNull private static OkHttpClient getHeader(final Map&lt;String, String&gt; header) { HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor() .setLevel(HttpLoggingInterceptor.Level.BODY); OkHttpClient.Builder httpClient = new OkHttpClient.Builder(); httpClient.addInterceptor(new Interceptor() { @Override public Response intercept(Interceptor.Chain chain) throws IOException { Request original = chain.request(); Request.Builder builder = original.newBuilder(); for (Map.Entry&lt;String, String&gt; entry : header.entrySet()) { builder.addHeader(entry.getKey(), entry.getValue()); } builder.method(original.method(), original.body()); return chain.proceed(builder.build()); } }); if (BuildConfig.DEBUG) //hides exposing web service call in logcat when app is released httpClient.addInterceptor(interceptor); return httpClient.build(); } } </code></pre> <p>Thanks in advance.</p> </div>

MYSQL+MYBATIS连接池 java.io.eof

MYSQL + MYBATIS 初步判定是MYSQL 8小时自动断开连接,MYBATIS 启动了连接池导致 连接池那边已经做了检验sql 不知道为什么依然出现问题,求解决方案! ![图片说明](https://img-ask.csdn.net/upload/201509/01/1441070457_563860.jpg) _ps:不用连接池观察2天没问题_ java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost. at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2926) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3344) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3334) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3774) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2447) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2594) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2541) at com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4882)

Android工作室说volley.NoConnectionError:java.io.EOFException,这是什么?

<div class="post-text" itemprop="text"> <p>I have a super basic register script in android studio. Im trying to get it to connect to a php file located in the Localhost of XAMMP. My question is unique because i directing my script to a specific localhost url, not searching on the internet. The URL is accurate too, unless it has to be changed BACK to being localhost(not ip). The error code is </p> <blockquote> <p>E/Create User: com.android.volley.NoConnectionError: java.io.EOFException</p> </blockquote> <p>here is the register request;</p> <pre><code>public class RegisterRequest extends StringRequest { private static final String REGISTER_REQUEST_URL = "http://(ip address):3306/testing/Register.php"; private Map&lt;String, String&gt; params; public RegisterRequest(String username, String password,String isAdmin, Response.Listener&lt;String&gt; listener, Response.ErrorListener errListener){ super(Method.POST, REGISTER_REQUEST_URL,listener,errListener); params = new HashMap&lt;&gt;(); params.put("username",username); params.put("password",password); params.put("isAdmin",isAdmin+""); } public Map&lt;String, String&gt; getparams() { return params; } } </code></pre> <p>here is the CreateUser class;</p> <pre><code>public class CreateUser extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_create_user); this.setTitle("Create User"); final EditText username1 = findViewById(R.id.Createusername); final EditText password1 = findViewById(R.id.CreatePassword); final Switch isAdmin = findViewById(R.id.isadmin); final Button createuser = findViewById(R.id.createuserbtn); if (getIntent().hasExtra("com.example.northlandcaps.crisis_response")){ isAdmin.setVisibility(View.GONE); } createuser.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final String username = username1.getText().toString(); final String password = password1.getText().toString(); final String isadmin = isAdmin.getText().toString(); Response.Listener&lt;String&gt; responseListener = new Response.Listener&lt;String&gt;() { @Override public void onResponse(String response) { try { JSONObject jsonResponse = new JSONObject(response); boolean success = jsonResponse.getBoolean("success"); if (success){ Intent intent = new Intent(CreateUser.this, MainActivity.class); startActivity(intent); }else{ AlertDialog.Builder builder = new AlertDialog.Builder(CreateUser.this); builder.setMessage("Register Failed") .setNegativeButton("Retry",null) .create() .show(); } } catch (JSONException e) { e.printStackTrace(); } } }; RegisterRequest registerRequest = new RegisterRequest(username,password,isadmin,responseListener,errorListener); RequestQueue queue = Volley.newRequestQueue(CreateUser.this); queue.add(registerRequest); } }); } Response.ErrorListener errorListener = new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Toast.makeText(getApplicationContext(), String.valueOf(error), Toast.LENGTH_SHORT).show(); Log.e("Create User", error+""); } }; </code></pre> <p>The php file, like i said, is inside htdocs inside of XAMMP. both apache and mysql are running, however, someone said i may not have my php script invoked by apache. Or that php even enabled on my Apache server. </p> </div>

org.apache.catalina.connector.ClientAbortException: java.io.IOException

问题描述 : 1. 仅当静态资源请求时触发 2. 仅是火狐浏览器触发 3. 仅当Tomcat7以上触发 4. 有个类似的项目不触发此异常 其中触发错误的请求: /livestock/res/assets/ico/apple-touch-icon-152x152.png /livestock/res/assets/vendor/font-awesome/fonts/fontawesome-webfont.woff2 神奇的bug ``` org.apache.catalina.connector.ClientAbortException: java.io.IOException: APR error: -730053 at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:393) at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:426) at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:339) at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:418) at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:406) at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:97) at org.springframework.util.StreamUtils.copy(StreamUtils.java:138) at org.springframework.http.converter.ResourceHttpMessageConverter.writeContent(ResourceHttpMessageConverter.java:110) at org.springframework.http.converter.ResourceHttpMessageConverter.writeInternal(ResourceHttpMessageConverter.java:102) at org.springframework.http.converter.ResourceHttpMessageConverter.writeInternal(ResourceHttpMessageConverter.java:45) java.io.IOException: APR error: -730053 at org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:226) at org.springframework.web.servlet.resource.ResourceHttpRequestHandler.handleRequest(ResourceHttpRequestHandler.java:480) at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:51) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2463) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2452) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) ```

ClientAbortException: java.io.IOException异常

项目在部署后,一直出现这个异常。 原因是手机浏览器在访问时 server返回的是response.getOutputStream().write(byte[]), 手机会当成是下载文件,随即调用了手机内置的下载进程去下载该文件,而浏览器在此时中止了接收http响应,这就导致了server出现了ClientAbortException异常。 而使用电脑Chrome浏览器进行访问的时候,它会自动下载,不会出现该异常 。 原因是找到了,但是不知道怎么解决?

websocket不知什么原因莫名断开

``` java.io.EOFException at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1167) at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1107) at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:72) at org.apache.tomcat.websocket.server.WsFrameServer.doOnDataAvailable(WsFrameServer.java:171) at org.apache.tomcat.websocket.server.WsFrameServer.notifyDataAvailable(WsFrameServer.java:151) at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.upgradeDispatch(WsHttpUpgradeHandler.java:148) at org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:54) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:53) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1376) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) ``` 补充点信息,大部分情况下是没有问题,只是偶尔会出现这种情况,直接onError里面了,这个异常信息就是onError里面输出的,但是看异常信息并不是我写的代码出现的

java中用DataInputStream读取数据的是后老是出现这样的问题?怎么解决?

流改关的我也关了啊。代码太多我就不全贴出来了 java.io.EOFException at java.io.DataInputStream.readFully(Unknown Source) at java.io.DataInputStream.readLong(Unknown Source) at cn.deos.client.FileDownLoad.run(FileDownLoad.java:183) at java.lang.Thread.run(Unknown Source) 提示这行有问题,有没有遇到相同类型问题的小伙伴啊! ![图片说明](https://img-ask.csdn.net/upload/201804/28/1524895291_167396.png)

java中用readObject()方法,用while遍历时报EOFException

package sequenceDamo; import java.io.EOFException; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; public class SequenceDemo { public static void main(String[] args) throws IOException, ClassNotFoundException { File s=new File("d:/Mydoc/123.txt"); Students zhan=new Students("张三",21,true); Students li=new Students("李三",22,true); Students liu=new Students("刘三",20,true); ObjectOutputStream dos=new ObjectOutputStream(new FileOutputStream(s)); dos.writeObject(zhan); dos.writeObject(li); dos.writeObject(liu); System.out.println("序列化完成"); dos.flush(); dos.close(); ObjectInputStream fos=new ObjectInputStream(new FileInputStream(s)); Students m=null; try{ while((m=(Students)fos.readObject())!=null){ System.out.println("名字:"+m.getName()+ "\t年龄:"+m.getAge()+"\t性别:"+ (m.isGender()?"男":"女")); } }catch(EOFException e){ System.out.println("输出结束"); } fos.close(); } } 运行结果 ![图片说明](https://img-ask.csdn.net/upload/201509/16/1442372027_580502.jpg)

Spark读取错误PrematureEOFfrominputStream

:主要问题java.io.EOFException: Premature EOF from inputStream 使用textFile或者newAPIHadoopFile都出现这个错误 写spark读取数据的时候一直报这个错误。 连count,repartition都过不去。数据读的比平常慢的多。 看数据文件,应该是很均匀的,应该不是数据倾斜的问题了吧。 下面是报错信息: ``` 16/09/15 23:27:57 ERROR yarn.ApplicationMaster: User class threw exception: org.apache.spark.SparkException: Job aborted due to stage failure: Task 41 in stage 0.0 failed 4 times, most recent failure: Lost task 41.3 in stage 0.0 (TID 5736, dn076179.heracles.sohuno.com): java.io.EOFException: Premature EOF from inputStream at com.hadoop.compression.lzo.LzopInputStream.readFully(LzopInputStream.java:75) at com.hadoop.compression.lzo.LzopInputStream.readHeader(LzopInputStream.java:114) at com.hadoop.compression.lzo.LzopInputStream.<init>(LzopInputStream.java:54) at com.hadoop.compression.lzo.LzopCodec.createInputStream(LzopCodec.java:83) at org.apache.hadoop.mapreduce.lib.input.LineRecordReader.initialize(LineRecordReader.java:102) at org.apache.spark.rdd.NewHadoopRDD$$anon$1.<init>(NewHadoopRDD.scala:133) at org.apache.spark.rdd.NewHadoopRDD.compute(NewHadoopRDD.scala:104) at org.apache.spark.rdd.NewHadoopRDD.compute(NewHadoopRDD.scala:66) at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:277) at org.apache.spark.rdd.RDD.iterator(RDD.scala:244) at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:35) at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:277) at org.apache.spark.rdd.RDD.iterator(RDD.scala:244) at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:70) at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:41) at org.apache.spark.scheduler.Task.run(Task.scala:70) at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:213) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) Driver stacktrace: org.apache.spark.SparkException: Job aborted due to stage failure: Task 41 in stage 0.0 failed 4 times, most recent failure: Lost task 41.3 in stage 0.0 (TID 5736, dn076179.heracles.sohuno.com): java.io.EOFException: Premature EOF from inputStream at com.hadoop.compression.lzo.LzopInputStream.readFully(LzopInputStream.java:75) at com.hadoop.compression.lzo.LzopInputStream.readHeader(LzopInputStream.java:114) at com.hadoop.compression.lzo.LzopInputStream.<init>(LzopInputStream.java:54) at com.hadoop.compression.lzo.LzopCodec.createInputStream(LzopCodec.java:83) at org.apache.hadoop.mapreduce.lib.input.LineRecordReader.initialize(LineRecordReader.java:102) at org.apache.spark.rdd.NewHadoopRDD$$anon$1.<init>(NewHadoopRDD.scala:133) at org.apache.spark.rdd.NewHadoopRDD.compute(NewHadoopRDD.scala:104) at org.apache.spark.rdd.NewHadoopRDD.compute(NewHadoopRDD.scala:66) at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:277) at org.apache.spark.rdd.RDD.iterator(RDD.scala:244) at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:35) at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:277) at org.apache.spark.rdd.RDD.iterator(RDD.scala:244) at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:70) at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:41) at org.apache.spark.scheduler.Task.run(Task.scala:70) at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:213) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) ```

spark shell在存运算结果到hdfs时报java.io.IOException: Not a file: hdfs://mini1:9000/spark/res

scala> sc.textFile("hdfs://mini1:9000/spark").flatMap(_.split(" ")).map((_,1)).reduceByKey(_+_).saveAsTextFile("hdfs://mini1:9000/spark/res2") 执行上面的代码出错,这个目录在hdfs下是有的,而且就算没有也会创建。还有就是我运行的代码中是保存到res2目录 ,这里为什么报没有res目录 18/11/05 19:06:44 WARN SizeEstimator: Failed to check whether UseCompressedOops is set; assuming yes java.io.IOException: Not a file: hdfs://mini1:9000/spark/res at org.apache.hadoop.mapred.FileInputFormat.getSplits(FileInputFormat.java:320) at org.apache.spark.rdd.HadoopRDD.getPartitions(HadoopRDD.scala:199) at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239) at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237) at scala.Option.getOrElse(Option.scala:120) at org.apache.spark.rdd.RDD.partitions(RDD.scala:237) at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35) at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239) at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237) at scala.Option.getOrElse(Option.scala:120) at org.apache.spark.rdd.RDD.partitions(RDD.scala:237) at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35) at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239) at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237) at scala.Option.getOrElse(Option.scala:120) at org.apache.spark.rdd.RDD.partitions(RDD.scala:237) at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35) at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239) at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237) at scala.Option.getOrElse(Option.scala:120) at org.apache.spark.rdd.RDD.partitions(RDD.scala:237) at org.apache.spark.Partitioner$.defaultPartitioner(Partitioner.scala:65) at org.apache.spark.rdd.PairRDDFunctions$$anonfun$reduceByKey$3.apply(PairRDDFunctions.scala:331) at org.apache.spark.rdd.PairRDDFunctions$$anonfun$reduceByKey$3.apply(PairRDDFunctions.scala:331) at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:150) at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:111) at org.apache.spark.rdd.RDD.withScope(RDD.scala:316) at org.apache.spark.rdd.PairRDDFunctions.reduceByKey(PairRDDFunctions.scala:330) at $iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC.<init>(<console>:28) at $iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC.<init>(<console>:33) at $iwC$$iwC$$iwC$$iwC$$iwC$$iwC.<init>(<console>:35) at $iwC$$iwC$$iwC$$iwC$$iwC.<init>(<console>:37) at $iwC$$iwC$$iwC$$iwC.<init>(<console>:39) at $iwC$$iwC$$iwC.<init>(<console>:41) at $iwC$$iwC.<init>(<console>:43) at $iwC.<init>(<console>:45) at <init>(<console>:47) at .<init>(<console>:51) at .<clinit>(<console>) at .<init>(<console>:7) at .<clinit>(<console>) at $print(<console>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.spark.repl.SparkIMain$ReadEvalPrint.call(SparkIMain.scala:1065) at org.apache.spark.repl.SparkIMain$Request.loadAndRun(SparkIMain.scala:1346) at org.apache.spark.repl.SparkIMain.loadAndRunReq$1(SparkIMain.scala:840) at org.apache.spark.repl.SparkIMain.interpret(SparkIMain.scala:871) at org.apache.spark.repl.SparkIMain.interpret(SparkIMain.scala:819) at org.apache.spark.repl.SparkILoop.reallyInterpret$1(SparkILoop.scala:857) at org.apache.spark.repl.SparkILoop.interpretStartingWith(SparkILoop.scala:902) at org.apache.spark.repl.SparkILoop.command(SparkILoop.scala:814) at org.apache.spark.repl.SparkILoop.processLine$1(SparkILoop.scala:657) at org.apache.spark.repl.SparkILoop.innerLoop$1(SparkILoop.scala:665) at org.apache.spark.repl.SparkILoop.org$apache$spark$repl$SparkILoop$$loop(SparkILoop.scala:670) at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1.apply$mcZ$sp(SparkILoop.scala:997) at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1.apply(SparkILoop.scala:945) at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1.apply(SparkILoop.scala:945) at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135) at org.apache.spark.repl.SparkILoop.org$apache$spark$repl$SparkILoop$$process(SparkILoop.scala:945) at org.apache.spark.repl.SparkILoop.process(SparkILoop.scala:1059) at org.apache.spark.repl.Main$.main(Main.scala:31) at org.apache.spark.repl.Main.main(Main.scala) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:731) at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:181) at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:206) at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:121) at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)

Hadoop序列化问题,实现WritableComparable,readFields报错EOFException

``` public class MyKey implements WritableComparable<MyKey> { //flag == 1 : user //flag == 0 : shopping private Integer flag; private Integer u_id; private Integer s_id; private Integer s_u_id; private String u_info; private String s_info; @Override public int compareTo(MyKey o) { if (flag.equals(1)){ //user return u_id - o.u_id; }else { //shopping return s_id - o.s_id; } } @Override public void write(DataOutput out) throws IOException { out.writeInt(flag); out.writeInt(u_id); out.writeInt(s_id); out.writeInt(s_u_id); out.writeUTF(u_info); out.writeUTF(s_info); } @Override public void readFields(DataInput in) throws IOException { flag = in.readInt(); u_id = in.readInt(); s_id = in.readInt(); s_u_id = in.readInt(); u_info = in.readUTF(); s_info = in.readUTF(); } } ``` 报错异常 2018-10-08 19:55:15,246 INFO Configuration.deprecation: mapred.skip.on is deprecated. Instead, use mapreduce.job.skiprecords 2018-10-08 19:55:15,250 INFO mapred.LocalJobRunner: reduce task executor complete. 2018-10-08 19:55:15,253 WARN mapred.LocalJobRunner: job_local85671337_0001 java.lang.Exception: java.lang.RuntimeException: java.io.EOFException at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:492) at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:559) Caused by: java.lang.RuntimeException: java.io.EOFException at org.apache.hadoop.io.WritableComparator.compare(WritableComparator.java:165) at org.apache.hadoop.mapreduce.task.ReduceContextImpl.nextKeyValue(ReduceContextImpl.java:158) at org.apache.hadoop.mapreduce.task.ReduceContextImpl.nextKey(ReduceContextImpl.java:121) at org.apache.hadoop.mapreduce.lib.reduce.WrappedReducer$Context.nextKey(WrappedReducer.java:302) at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:170) at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:628) at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:390) at org.apache.hadoop.mapred.LocalJobRunner$Job$ReduceTaskRunnable.run(LocalJobRunner.java:347) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.io.EOFException at java.io.DataInputStream.readInt(DataInputStream.java:392) at sortjoin.MyKey.readFields(MyKey.java:43) at org.apache.hadoop.io.WritableComparator.compare(WritableComparator.java:158) ... 12 more 2018-10-08 19:55:15,962 INFO mapreduce.Job: Job job_local85671337_0001 running in uber mode : false 2018-10-08 19:55:15,964 INFO mapreduce.Job: map 100% reduce 0%

hessian远程访问异常,已尝试过解决方法均无效(下附注),在线等

org.springframework.remoting.RemoteAccessException: Cannot access Hessian remote service at [http://localhost:8080/sso-service/hessian/tempTokenService]; nested exception is java.io.EOFException: r adObject: unexpected end of file at org.springframework.remoting.caucho.HessianClientInterceptor.convertHessianAccessException(HessianClientInterceptor.java:293) at org.springframework.remoting.caucho.HessianClientInterceptor.invoke(HessianClientInterceptor.java:265) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) at com.sun.proxy.$Proxy100.getTempTokenByTicketId(Unknown Source) at com.mango.service.passport.api.TempTokenApi.getTempTokenByTicketId(TempTokenApi.java:24) at com.mango.passport.interceptor.SecurityInterceptor.getTicketIdAndSetCookie(SecurityInterceptor.java:135) at com.mango.passport.interceptor.SecurityInterceptor.preHandle(SecurityInterceptor.java:64) at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:134) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:958) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.ecog.tingjia.base.CaseInsensitiveParametersFilter.doFilterInternal(CaseInsensitiveParametersFilter.java:20) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2503) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2492) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source) Caused by: java.io.EOFException: readObject: unexpected end of file at com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:2164) at com.caucho.hessian.io.AbstractMapDeserializer.readObject(AbstractMapDeserializer.java:67) at com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1835) at com.caucho.hessian.io.Hessian2Input.readReply(Hessian2Input.java:382) at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:195) at com.sun.proxy.$Proxy99.getTempTokenByTicketId(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.remoting.caucho.HessianClientInterceptor.invoke(HessianClientInterceptor.java:248); ***以上是在服务器上抓取的异常.所有依赖的hessian版本4.0.37, jdk1.7/1.8都尝试,据网上查找资料,重载方式已经设置为true, 地址在本地访问显示405是正常.

关于EOFException异常的问题,调用良田高拍仪遇到的问题 SpringMVC后台

大家好,咨询个问题, 我在做 java web系统获取良田高拍仪 拍的图片 上传至服务端时 在服务端获取图片数据后通过http请求 将图片的数据发送到后台,后台 读数据的时候报异常 **代码还没到 关闭那行就报错了 在 in.readFully(dataOrigin); 这块就报错了** 异常如下: ![图片说明](https://img-ask.csdn.net/upload/201711/17/1510928686_673880.png) 严重: Servlet.service() for servlet [SpringMVC] in context with path [/deploy-web] threw exception java.io.EOFException at java.io.DataInputStream.readFully(DataInputStream.java:197) 有没有知道这个是什么情况?, 后台框架 用的 springMVC

YOLOv3目标检测实战:训练自己的数据集

YOLOv3目标检测实战:训练自己的数据集

150讲轻松搞定Python网络爬虫

150讲轻松搞定Python网络爬虫

实用主义学Python(小白也容易上手的Python实用案例)

实用主义学Python(小白也容易上手的Python实用案例)

我说我不会算法,阿里把我挂了。

不说了,字节跳动也反手把我挂了。

立方体线框模型透视投影 (计算机图形学实验)

计算机图形学实验 立方体线框模型透视投影 的可执行文件,亲测可运行,若需报告可以联系我,期待和各位交流

2019 AI开发者大会

2019 AI开发者大会

组成原理课程设计(实现机器数的真值还原等功能)

实现机器数的真值还原(定点小数)、定点小数的单符号位补码加减运算、定点小数的补码乘法运算和浮点数的加减运算。

C/C++跨平台研发从基础到高阶实战系列套餐

一 专题从基础的C语言核心到c++ 和stl完成基础强化; 二 再到数据结构,设计模式完成专业计算机技能强化; 三 通过跨平台网络编程,linux编程,qt界面编程,mfc编程,windows编程,c++与lua联合编程来完成应用强化 四 最后通过基于ffmpeg的音视频播放器,直播推流,屏幕录像,

MFC一站式终极全套课程包

该套餐共包含从C小白到C++到MFC的全部课程,整套学下来绝对成为一名C++大牛!!!

软件测试2小时入门

软件测试2小时入门

三个项目玩转深度学习(附1G源码)

三个项目玩转深度学习(附1G源码)

计算机图形学-球的光照模型课程设计

计算机图形学-球的光照模型,有代码完美运行,有课程设计书

Linux常用命令大全(非常全!!!)

Linux常用命令大全(非常全!!!) 最近都在和Linux打交道,感觉还不错。我觉得Linux相比windows比较麻烦的就是很多东西都要用命令来控制,当然,这也是很多人喜欢linux的原因,比较短小但却功能强大。我将我了解到的命令列举一下,仅供大家参考: 系统信息 arch 显示机器的处理器架构 uname -m 显示机器的处理器架构 uname -r 显示正在使用的内核版本 d...

因为看了这些书,我大二就拿了华为Offer

四年了,四年,你知道大学这四年我怎么过的么?

深度学习原理+项目实战+算法详解+主流框架(套餐)

深度学习系列课程从深度学习基础知识点开始讲解一步步进入神经网络的世界再到卷积和递归神经网络,详解各大经典网络架构。实战部分选择当下最火爆深度学习框架PyTorch与Tensorflow/Keras,全程实战演示框架核心使用与建模方法。项目实战部分选择计算机视觉与自然语言处理领域经典项目,从零开始详解算法原理,debug模式逐行代码解读。适合准备就业和转行的同学们加入学习! 建议按照下列课程顺序来进行学习 (1)掌握深度学习必备经典网络架构 (2)深度框架实战方法 (3)计算机视觉与自然语言处理项目实战。(按照课程排列顺序即可)

fakeLocation13.5.1.zip

fakeLocation13.5.1 虚拟定位 ios13.5.1的最新驱动下载,iPhone/iPad免越狱虚拟定位工具Location-cleaned驱动已更新

UnityLicence

UnityLicence

Python可以这样学(第一季:Python内功修炼)

Python可以这样学(第一季:Python内功修炼)

Python+OpenCV计算机视觉

Python+OpenCV计算机视觉

土豆浏览器

土豆浏览器可以用来看各种搞笑、电影、电视剧视频

【数据结构与算法综合实验】欢乐连连看(C++ & MFC)案例

这是武汉理工大学计算机学院数据结构与算法综合实验课程的第三次项目:欢乐连连看(C++ & MFC)迭代开发代码。运行环境:VS2017。已经实现功能:开始游戏、消子、判断胜负、提示、重排、计时、帮助。

php+mysql学生成绩管理系统

学生成绩管理系统,分三个模块:学生,教师和管理员。 管理员模块:负责学生、老师信息的增删改;发布课程信息的增删改,以便让学生选课;审核老师提交的学生成绩并且打印成绩存档;按照课号查询每个课号的学生成绩

多功能数字钟.zip

利用数字电子计数知识设计并制作的数字电子钟(含multisim仿真),该数字钟具有显示星期、24小时制时间、闹铃、整点报时、时间校准功能

推荐24个国外黄色网站欣赏

在中国清朝,明黄色的衣服只有皇子才有资格穿,慢慢的黄色在中国就成了高贵的颜色。在人们的色彩印象中,黄色也表现为暂停。所以当你的网页设计采用黄色的时候,会让人们在你的网页前停留。 黄色,就像橙色和红色,黄色也是一个暖色。它有大自然、阳光、春天的涵义,而且通常被认为是一个快乐和有希望的色彩。黄色是所有色相中最能发光的颜色,给人轻快,透明,辉煌,充满希望的色彩印象。 黄色是一个高可见的色...

u-boot-2015.07.tar.bz2

uboot-2015-07最新代码,喜欢的朋友请拿去

一学即懂的计算机视觉(第一季)

一学即懂的计算机视觉(第一季)

学生成绩管理系统(PHP + MYSQL)

做的是数据库课程设计,使用的php + MySQL,本来是黄金搭配也就没啥说的,推荐使用wamp服务器,里面有详细的使用说明,带有界面的啊!呵呵 不行的话,可以给我留言!

Windows版YOLOv4目标检测实战:训练自己的数据集

Windows版YOLOv4目标检测实战:训练自己的数据集

C++语言基础视频教程

C++语言基础视频教程

玩转Python-Python3基础入门

玩转Python-Python3基础入门

相关热词 c# cad插入影像 c#设计思想 c#正则表达式 转换 c#form复制 c#写web c# 柱形图 c# wcf 服务库 c#应用程序管理器 c#数组如何赋值给数组 c#序列化应用目的博客园
立即提问