Unable to create account using Java SDK Leave a comment

I have been successfully creating accounts for months before the reset but I am now running into a problem and not clear what the actual problem is.

I am executing the following code:

final KeyPair newAccountKeyPair = KeyPair.random();
final KeyPair sourceKeyPair = KeyPair.fromSecretSeed(seed);
final String secret = new String(newAccountKeyPair.getSecretSeed());
final AccountResponse sourceAccount = server.accounts().account(sourceKeyPair.getAccountId());

        final Transaction transaction = new Transaction.Builder(sourceAccount, network)
                .addOperation(new CreateAccountOperation.Builder(newAccountKeyPair.getAccountId(), startingBalance)
                        .build())
                .addMemo(Memo.text("CreateAccount Tx"))
                .setTimeout(STELLAR_TIMEOUT_IN_SECONDS)
                .setBaseFee(STELLAR_BASE_FEE).build();

        transaction.sign(sourceKeyPair);

        final SubmitTransactionResponse submitTransactionResponse = server.submitTransaction(transaction);

The reponse from the server:
org.stellar.sdk.requests.ErrorResponse: Error response from the server.
at org.stellar.sdk.requests.ResponseHandler.handleResponse(ResponseHandler.java:39)
at org.stellar.sdk.requests.AccountsRequestBuilder.account(AccountsRequestBuilder.java:38)
at org.stellar.sdk.requests.AccountsRequestBuilder.account(AccountsRequestBuilder.java:49)

I have ensured that I am on the latest version of the Java SDK (0.19.0). I have searched on the web and have not found any joy. What can I do to resolve this error?

Thank You!
Aubrey

Leave a Reply

Your email address will not be published. Required fields are marked *