2012-09-19 63 views
2

我有以下問題:的NFSv4 - EOFException類

此代碼...

try { 
     fis = new FileInputStream(serializedKeyIndex); 
     in = new ObjectInputStream(fis); // this line throws the EOFException (and IOException) 
     keys = (HashMap<String, String>) in.readObject(); 
     in.close(); 
    } catch (FileNotFoundException e) { 
     // create the key index 
     keys = new HashMap<String, String>(); 
     storeKeyIndex(bucket, keys); 
    } catch (IOException e) { 
     throw new DataAccessResourceFailureException(
       "Unable to store Bucket: " + bucket, e); 
    } catch (ClassNotFoundException e) { 
     throw new DataAccessResourceFailureException(
       "Unable to store Bucket: " + bucket, e); 
    } 

的littles3服務器實現(http://code.google.com/p/littles3/source/browse/trunk/modules/filesystem/src/main/java/com/jpeterson/littles3/dao/filesystem/FileS3ObjectDao.java,在直線474)的...拋出一個安裝NFS的EOFException類版本4驅動器。

的GlassFish報告顯示我:

[#|2012-09-19T10:46:00.277+0200|WARNING|oracle-glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID 
java.io.EOFException 
    at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2298) 
    at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2767) 
    at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:798) 
    at java.io.ObjectInputStream.<init>(ObjectInputStream.java:298) 
    at com.jpeterson.littles3.dao.filesystem.FileS3ObjectDao.retrieveKeyIndex(FileS3ObjectDao.java:474) 
    at com.jpeterson.littles3.dao.filesystem.FileS3ObjectDao.loadS3Object(FileS3ObjectDao.java:63) 
    at com.jpeterson.littles3.service.impl.FileStorageServiceImpl.load(FileStorageServiceImpl.java:89) 
    at com.jpeterson.littles3.StorageEngine.methodPut(StorageEngine.java:823) 
    at com.jpeterson.littles3.StorageEngine.doService(StorageEngine.java:233) 
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:475) 
    at org.springframework.web.servlet.FrameworkServlet.doPut(FrameworkServlet.java:450) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:691) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:770) 
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1542) 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281) 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) 
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655) 
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595) 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161) 
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331) 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231) 
    at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317) 
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195) 
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849) 
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746) 
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045) 
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228) 
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) 
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) 
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) 
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) 
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) 
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) 
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71) 
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) 

奇怪的是,它正常工作與通常的本地文件系統。那裏沒有例外。

如果我想在存儲桶下創建第二個S3Object(文件夾或文件),該錯誤只會在NFSv4中發生。看來它只能在那裏創建一個S3Object。正如我已經說過的,它在正常的文件系統上工作正常。

可能文件鎖定導致該問題?已經有人在這裏獲得了經驗?

非常感謝提前!

+0

更新:我獲得了將某些信息存儲在本地文件系統而不是掛載的NFS驅動器的權限。也許我可以用這種方式解決問題。 –

回答

0

錯誤消息提示該文件爲空。

+0

非常感謝,我同時將HashMap密鑰(元信息)存儲到另一個文件系統位置(本地文件系統,如ext4)。它在那裏工作得很好。所以我真的認爲這是NFSv4的文件鎖定。它只允許在那裏創建和刪除文件,但它不允許在那裏更改文件。這沒關係,而且很有必要。 這意味着存儲區被存儲在NFS中,元信息存儲在別處。 –