我遇到了RPC问题,所以不可能使用seri。静态级槽RPC
我在我的:...Impl.java里找到了这个
public static class dateils2 {
private final String be;
private final String name;
public dateils2(String name, String be) {
this.name = name;
this.be= be;
}
}它抛出:
类型“com.mi.hu.server.TestImpl$dateils2”未包含在可由此SerializationPolicy序列化的类型集中,否则无法加载其类对象。出于安全考虑,这种类型不会被序列化.:instance = com.mi.hu.server.server.TestImpl$dateils2@33cb8da5
我想把Celltable的数据作为返回类型。(Mi)在这里,我的整个代码:
@SuppressWarnings("serial")
public class TestIml extends RemoteServiceServlet implements TestService{
public static class dateils2 {
private final String bestellung;
// private final Date datum;
private final String name;
public dateils2(String name, String bestellung) {
this.name = name;
//this.datum = datum;
this.bestellung = bestellung;
}
}
Connection con=null;
Statement st=null;
ResultSet rs=null;
String query;
public ArrayList<dateils2> mi = new ArrayList<dateils2>();
String url="jdbc:sqlserver://hp-compaq;instanceName=E;databaseName=Ba";
public void call()
{
try
{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
}
catch(ClassNotFoundException e)
{
System.out.print(e.getMessage());
}
try
{
con=DriverManager.getConnection(url, "f", "f");
st=con.createStatement();
}
catch(SQLException e)
{
System.out.println(e.getMessage());
}
}
/**
* Query
*/
@Override
public ArrayList show() {
call();
try
{
rs = st.executeQuery("SELECT * FROM BES");
while(rs.next()){
mi.add( new dateils2(rs.getString("NA"), rs.getString("BS")));
}
con.commit();
}
catch (Exception e)
{
System.err.println("Error: " + e.getMessage());
e.printStackTrace();
}
finally {
try {
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
// TODO Auto-generated method stub
return mi;
}}
发布于 2014-01-28 10:23:19
dateils2不能序列化,因为:
final字段)或CustomFieldSerializer。Serializableserver包中,可能在客户端代码中是不可见的(通常会将DTO放在shared包中,或者可能放在client包中;假设您遵循GWT项目布局约定)。请参阅http://www.gwtproject.org/doc/latest/DevGuideServerCommunication.html#DevGuideSerializableTypes
https://stackoverflow.com/questions/21401023
复制相似问题