NotSerializableException: java.io.FileInputStream [yinelenen]
Sep 30 2020
Uygulamam şu hatayı veriyor:
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: java.io.FileInputStream
at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:194)
at java.rmi/java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:209)
at java.rmi/java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:161)
at com.sun.proxy.$Proxy40.getEntityBlob(Unknown Source)
at com.mycompany.backend.repository.EntityRepositoryImpl.getEntityBlob(EntityRepositoryImpl.java:260)
RMI yönteminin "istemci" tarafı şudur:
Registry registry = LocateRegistry.getRegistry();
EntityRepository repository =
(EntityRepository) registry.lookup(EntityRepository.class.getName());
return repository.getEntityBlob(appId, namespace, entityType, entityId, blobKey);
Ve "sunucu" tarafı bu
public InputStream getEntityBlob(
String appId,
String namespace,
String entityType,
final String entityId,
final String blobKey) throws RemoteException {
final InputStream[] inputStream = new InputStream[1];
manager.transactPersistentEntityStore(xodusRoot, appId, true, txn -> {
EntityId idOfEntity = txn.toEntityId(entityId);
final Entity entity = txn.getEntity(idOfEntity);
inputStream[0] = entity.getBlob(blobKey);
});
return inputStream[0];
}
FileInputStreamRMI ile çalışamayacağı anlamına mı geliyor ? Ya da çalışmalı ve kodumla ilgili bir sorun mu var?
Yanıtlar
quarks Oct 01 2020 at 00:55
InputStreamRMI üzerinden iletmek mümkün değil
Bkz: RMI üzerinden bir akışı iletme stratejisi
Gene Simmons, KISS Çizgi Romanlarının Potansiyel Olarak "İnsanlığı Yeniden Yaratabileceğini" Söyledi
Donovan, Şarkılarından 1'ini The Beatles'ın "Lucy in the Sky with Diamonds" şarkısıyla karşılaştırdı
Tom Girardi Dolandırıcılık Suçlamalarından Yargılanma Yetkisinin Belirlenmesi İçin Duruşmaya Katıldı