Are you passing the username and password as part of the connect command?
Client side code:
var nc:NetConnection = new NetConnection();
var userName:String = "charlie";
var password:String = "mypassword";
nc.connect("rtmp://localhost/myapplication", userName, password);
The java.lang.reflect.InvocationTargetException just means that there was an error somewhere in the onConnect method that was not caught by a try/catch block. The only part of this code that is not surrounded in a try/catch blocks is the place where it resolves the userName and password from the connect command.
One other thing you can try is to surround all the code in the method with the try/catch block that looks like this:
static public void onConnect(IClient client, RequestFunction function, AMFDataList params)
{
try
{
//put all the code of the method here
}
catch (Exception e)
{
System.out.println("ERROR: "+e.toString());
e.printStackTrace();
}
}
Charlie