I'm trying to set up a transaction listening stream. I have taken the Java snippet directly from the docs. Below is the part that is giving me an issue.

Server server = new Server("https://horizon-testnet.stellar.org");

PaymentsRequestBuilder paymentsRequest = server.payments().forAccount(account);

paymentsRequest.stream(new EventListener<OperationResponse>() {
    public void onEvent(OperationResponse payment) { ... }

I'm getting an error on the OperationResponse as the type parameter in the EventListener, specifically stating:

Type java.util.EventListener does not have type parameters

Also, the @Override is not overriding a method from its superclass and onEvent is never used.

I can't think what I am missing as this is taken straight from the docs and I know that the Stellar SDK is correctly setup in my app as I am already performing successful transactions.

FYI, this code snippet is sitting within the following method:

public void StellarTransactionListner(){

1 Answer 1


Please check your import statements. You may have the wrong EventListener in scope. The SDK's EventListener is type parameterised and declares the method void onEvent(T object).

  • 1
    Simple but effective! Thank you. It turns out I had import java.util.* as an import statement, which was 'blocking' the import prompt on the EventListener . Commented Dec 13, 2018 at 9:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.