我正在尝试将一个对象从Serversocket发送到另一个Socket。
虽然这样做我定义了Serversocket的类正在创建它通过DataOutputStream
发送的对象。
但有时我在Serversocket没有发送对象后遇到异常,尽管在相当长的一段时间内,每5秒钟Ping
稳定ObjectOutputStream
。
连接的Serversocket和Socket beeing都在同一台计算机上运行。
问题也似乎随机发生,因为大部分时间我都没有遇到这个问题。在套接字无效一段时间后,只有大约1/10才会引发此异常。
我有什么办法可以恢复这个“损坏的缓存条目”吗?
我已经看过this SO question但是因为我刚刚清除了我的java缓存并重新启动了我的计算机,所以我不太确定原因是否相同。
java版:
JRE-Version 1.8.0_73-b02 Java HotSpot(TM) Client VM
导致问题的代码:
private ObjectOutputStream os;
...
protected void sendReportObject(int arch_id, String origin_server_path,
String origin_server_file_name, String destination_path,
String destination_file_name, String reportName, String repParam) {
if(isOpen) { // is true
try {
System.out.println("SENDING THE FOLLOWING OBJECT");
System.out.println("arch_id: " + arch_id);
System.out.println("origin_server_path: " + origin_server_path);
System.out.println("origin_server_file_name: " + origin_server_file_name);
System.out.println("destination_path: " + destination_path);
System.out.println("destination_file_name: " + destination_file_name);
System.out.println("reportName: " + reportName);
System.out.println("repParam: " + repParam);
// The line causing the exception is the initialization of the Object Archive_Report
Archive_Report rep = new Archive_Report(arch_id, origin_server_path, origin_server_file_name, destination_path, destination_file_name, reportName, repParam);
System.out.println("Writing report: " + rep);
os.writeObject(rep);
os.flush();
} catch (IOException e) {
e.printStackTrace();
}
} else {
}
}
带有打印件的Stacktrace
arch_id: 521
origin_server_path: C:\path
origin_server_file_name: Report_User_12345
destination_path: D:\Path
destination_file_name: Report_12345
reportName: Report
repParam: A
FRM-92091: unexpected fatal error in client-side Java code
Java Exception:
java.lang.RuntimeException: ERROR: Failed to recover corrupt cache entry
at com.sun.deploy.cache.CacheEntry.recover(Unknown Source)
at com.sun.deploy.cache.CacheEntry.getJarSigningData(Unknown Source)
at com.sun.deploy.cache.CachedJarFile.getSigningData(Unknown Source)
at com.sun.deploy.cache.CachedJarFile.getCodeSource(Unknown Source)
at com.sun.deploy.cache.DeployCacheJarAccessImpl.getCodeSource(Unknown Source)
at com.sun.deploy.security.CPCallbackHandler$ChildElement.checkResource(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.checkResource(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.getResource(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at applet.connecter.ApplicationServerSocket.sendReportObject(ApplicationServerSocket.java:313)
at applet.connecter.ApplicationServerSocketBean.setProperty(ApplicationServerSocketBean.java:67)
at oracle.forms.handler.ComponentItem.onUpdate(Unknown Source)
at oracle.forms.handler.JavaContainer.onUpdate(Unknown Source)
at oracle.forms.handler.UICommon.onUpdate(Unknown Source)
at oracle.forms.engine.Runform.onUpdateHandler(Unknown Source)
at oracle.forms.engine.Runform.processMessage(Unknown Source)
at oracle.forms.engine.Runform.processSet(Unknown Source)
at oracle.forms.engine.Runform.onMessageReal(Unknown Source)
at oracle.forms.engine.Runform.onMessage(Unknown Source)
at oracle.forms.engine.Runform.processEventEnd(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.redispatchEvent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)