【发布时间】:2014-02-19 11:33:45
【问题描述】:
我遇到了 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 序列化的类型集中,或者无法加载其 Class 对象。出于安全考虑,此类型不会被序列化。: instance = com.mi.hu.server.server.TestImpl$dateils2@33cb8da5
我想将 Celltable 的数据作为 Return typ.(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;
}
}
【问题讨论】: