2
votes

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

1

1 Answers

4
votes

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();
    }
}