开发者

Unable to create a new instance of type 'some class'. Types cannot be instantiated without a public, no arguments constructor

I have a class with constructor and overloaded methods in it. When i try to import that class using blazeds i get an error saying

[RPC Fault faultString="Unable to create a new instance of type '开发者_如何学编程some class'." faultCode="Server.ResourceUnavailable"

faultDetail="Types cannot be instantiated without a public, no arguments constructor."]

How to import class having overloaded methods using blazeds


You must provide a "no args"-constructor. See Converting data from ActionScript to Java.

public class SomeClass
{
    // no-args constructor is required for BlazeDS
    public SomeClass() {}

    public SomeClass(int arg) {}
}

public class SomeService
{
    public Connection getConnection()
    {
        // implement to create or get a connection
    }

    public void saveSomeClass(SomeClass sc) throws SQLException
    {
        Connection conn = getConnection();
        Statement stmt = conn.createStatement();
        String sql = "INSERT INTO some_table (...) VALUES (...)";
        stmt.executeUpdate(sql);
        stmt.close();
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜