Я пытаюсь запустить проект Vaadin в облачной платформе Google, используя Google Cloud Platform (плагин в Eclipse).После запуска я получаю следующее исключение:
WARNING: Error in serialization of the application: Class
rand.TestProject.AutoCrudView$1 must implement serialization.
2019-03-02 15:54:06.159:WARN:oejs.session:qtp1757676444-19:
java.io.NotSerializableException: java.lang.ref.WeakReference
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at java.util.LinkedList.writeObject(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)
at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
Это класс AutoCrudView:
@SuppressWarnings("serial")
public class AutoCrudView extends Window implements Serializable{
private static final long serialVersionUID = 1L;
public AutoCrudView(String PERSISTENCE_UNIT) {
final HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel();
Tree navTree = new Tree();
navTree.addListener(new Property.ValueChangeListener() {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void valueChange(ValueChangeEvent event) {
@SuppressWarnings("rawtypes")
BasicCrudView cv = (BasicCrudView) event.getProperty()
.getValue();
cv.refreshContainer();
horizontalSplitPanel.setSecondComponent(cv);
}
});
navTree.setSelectable(true);
navTree.setNullSelectionAllowed(false);
navTree.setImmediate(true);
horizontalSplitPanel.setSplitPosition(200,
HorizontalSplitPanel.UNITS_PIXELS);
horizontalSplitPanel.addComponent(navTree);
setContent(horizontalSplitPanel);
// add a basic crud view for all entities known by the JPA
// implementation, most often this is not desired and developers
// should just list those entities they want to have editors for
Metamodel metamodel = JPAContainerFactory
.createEntityManagerForPersistenceUnit(PERSISTENCE_UNIT)
.getEntityManagerFactory().getMetamodel();
Set<EntityType<?>> entities = metamodel.getEntities();
for (EntityType<?> entityType : entities) {
Class<?> javaType = entityType.getJavaType();
@SuppressWarnings({ "rawtypes", "unchecked" })
BasicCrudView view = new BasicCrudView(javaType,
PERSISTENCE_UNIT);
navTree.addItem(view);
navTree.setItemCaption(view, view.getCaption());
navTree.setChildrenAllowed(view, false);
if(javaType == Person.class) {
view.setVisibleTableProperties("firstName","lastName", "boss");
view.setVisibleFormProperties("firstName","lastName", "phoneNumber", "street", "city", "zipCode", "boss");
}
}
// select first entity view
navTree.setValue(navTree.getItemIds().iterator().next());
}
}
Как вы можете видеть, я реализовал Serializable, но без успеха.Это изображение, которое я получил из окна App Engine: здесь