Привет. Я новичок в java и GWT. У меня есть вызов RPC для получения значений из Filenet, я использую GWT, где я использую вызов RPC,Исключение при отправке вызова RPC
У меня есть 3 метода в FcInterface.java, который расширяет возможности remoteservices. 2 метода в интерфейсе работают нормально, возвращая значения клиенту из севера. Но проблема с 3-м методом, я не могу вернуть значение с серверной стороны на клиентскую сторону.
Прикрепление кода n трассировки стека.
Code:
public class FilenetCmisServiceImpl extends RemoteServiceServlet implements FcInterface {
...
...Some codes
public Map<String, Object> getContentOfRootFolder(String RepositoryId) {
Map<String, Object> ContentOfRootFolder = new HashMap<String, Object>();
ItemIterable<CmisObject> children = root.getChildren();
for (CmisObject o : children) {
FilenetFolderImpl folder= new FilenetFolderImpl();
folder.setFolderName(o.getName());
folder.setFolderId(o.getId());
folder.setFolderModifiedBy(o.getLastModifiedBy());
folder.setFolderClass(o.getBaseTypeId().toString());
folder.setFolderModifiedOn(o.getLastModificationDate());
System.
out.println("name : " + o.getName());
ContentOfRootFolder.put(o.getName(), folder);
}// every thing is fine till here
return ContentOfRootFolder;
}
}
Код для класса FilenetFolderImpl
public class FilenetFolderImpl {
private String FolderName;
private String FolderSize;
private String FolderModifiedBy;
private GregorianCalendar FolderModifiedOn;
Folder root;
private String FolderId;
private String FolderClass;
public FilenetFolderImpl(String Foldername){
this.FolderName=Foldername;
}
public FilenetFolderImpl(String name, String id, String baseTypeId,
GregorianCalendar lastModificationDate, String lastModifiedBy) {
// TODO Auto-generated constructor stub
this.FolderName = name;
this.FolderId = id;
this.FolderClass = baseTypeId;
this.FolderModifiedBy = lastModifiedBy;
this.FolderModifiedOn = lastModificationDate;
}
public FilenetFolderImpl() {
// TODO Auto-generated constructor stub
}
public String getFolderName() {
return FolderName;
}
public void setFolderName(String FolderName) {
this.FolderName=FolderName;
}
public String getFolderId() {
return FolderId;
}
public void setFolderId(String FolderId) {
this.FolderId=FolderId;
}
public String getFolderClass() {
return FolderClass;
}
public void setFolderClass(String FolderClass){
this.FolderClass=FolderClass;
}
public String getFolderModifiedBy() {
return FolderModifiedBy;
}
public void setFolderModifiedBy(String FolderModifiedBy) {
this.FolderModifiedBy=FolderModifiedBy;
}
public GregorianCalendar getFolderModifiedOn() {
return FolderModifiedOn;
}
public void setFolderModifiedOn(GregorianCalendar gregorianCalendar) {
this.FolderModifiedOn=gregorianCalendar;
}
protected Map<String, String> addFolder(){
Map<String, String> newFolderProperties = new HashMap<String, String>();
newFolderProperties.put(PropertyIds.OBJECT_TYPE_ID,"cmis:folder");
newFolderProperties.put(PropertyIds.NAME,FolderName);
return newFolderProperties;
}
}
StackTrace
Exception while dispatching incoming RPC call
Type 'com.filenet.cmis.server.FilenetFolderImpl' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.: instance [email protected]
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(
ServerSerializationStreamWriter.java:619)
at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(
AbstractSerializationStreamWriter.java:126)
at com.google.gwt.user.client.rpc.core.java.util.Map_CustomFieldSerializerBase.serialize(
Map_CustomFieldSerializerBase.java:53)
at com.google.gwt.user.client.rpc.core.java.util.HashMap_CustomFieldSerializer.serialize(
HashMap_CustomFieldSerializer.java:39)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(
RemoteServiceServlet.java:208)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(
RemoteServiceServlet.java:248)
Type 'com.filenet.cmis.server.FilenetFolderImpl' was not included in the set of
types which can be serialized by this SerializationPolicy or its Class object
could not be loaded. For security purposes, this type will not
be serialized.: instance = [email protected]
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(
ServerSerializationStreamWriter.java:619)
at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(
AbstractSerializationStreamWriter.java:126)
at com.google.gwt.user.client.rpc.core.java.util.Map_CustomFieldSerializerBase.serialize(
Map_CustomFieldSerializerBase.java:53)
at com.google.gwt.user.client.rpc.core.java.util.HashMap_CustomFieldSerializer.serialize(
HashMap_CustomFieldSerializer.java:39)
at com.google.gwt.user.client.rpc.core.java.util.HashMap_CustomFieldSerializer.serializeInstance(HashMap_CustomFieldSerializer.java:51)
at com.google.gwt.user.client.rpc.core.java.util.HashMap_CustomFieldSerializer.serializeInstance(
HashMap_CustomFieldSerializer.java:28)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(
ServerSerializationStreamWriter.java:740)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(
ServerSerializationStreamWriter.java:621)
at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(
AbstractSerializationStreamWriter.java:126)
Я предполагаю, что есть проблема с сериализации или я не могу отправить obect из FilenetFolderImpl с помощью ContentOfRootFolder, который имеет тип Map<String, Object> ContentOfRootFolder = new HashMap<String, Object>();
В любом случае мне нужно вернуть значения FilenetFolderImpl
.
Пожалуйста, помогите мне решить эту проблему. Спасибо.