0
從ObjectOutputStream中讀取對象()時出現問題。從ObjectInputStream中讀取對象時出現ClassNotFoundException異常
我想在服務器端讀取對象。我在客戶端和服務器項目中都有相同的Message類。我讀過,我需要在客戶端和服務器上具有完全相同的Message類(使用相同的包),但我不知道如何在NetBeans中執行此操作。
我試圖Libraries-到服務器項目添加到庫中的客戶端>添加項目 - >我選擇的server.jar,但現在我得到了異常:
ant -f C:\\Users\\Piotr\\Documents\\NetBeansProjects\\FXClient jfxsa-run
init:
Deleting: C:\Users\Piotr\Documents\NetBeansProjects\FXClient\build\built-clean.properties
deps-clean:
Updating property file: C:\Users\Piotr\Documents\NetBeansProjects\FXClient\build\built-clean.properties
Duplicated project name in import. Project jfx-impl defined first in C:\Users\Piotr\Documents\NetBeansProjects\FXClient\nbproject\jfx-impl.xml and again in C:\Users\Piotr\Documents\NetBeansProjects\FXServer2\nbproject\jfx-impl.xml
FXServer2.init:
FXServer2.deps-clean:
Updating property file: C:\Users\Piotr\Documents\NetBeansProjects\FXClient\build\built-clean.properties
Deleting directory C:\Users\Piotr\Documents\NetBeansProjects\FXServer2\build
C:\Users\Piotr\Documents\NetBeansProjects\FXClient\nbproject\jfx-impl.xml:3767: The following error occurred while executing this line:
C:\Users\Piotr\Documents\NetBeansProjects\FXClient\nbproject\build-impl.xml:1400: The following error occurred while executing this line:
C:\Users\Piotr\Documents\NetBeansProjects\FXClient\nbproject\build-impl.xml:1430: The following error occurred while executing this line:
C:\Users\Piotr\Documents\NetBeansProjects\FXServer2\nbproject\build-impl.xml:1395: Unable to delete file C:\Users\Piotr\Documents\NetBeansProjects\FXServer2\dist\run532287538\FXServer2.jar
Message類實現Serializable,我還加 protected static final long serialVersionUID = 111L;
之前和這兩個消息類都沒有改變任何東西。
如何導入Message類到Server和Client項目?
確定它的工作原理THX – Piotter