Grape
Grape

Reputation: 1

java.lang.NoSuchMethodError: org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor.addTimeoutObject

Code:

public class ComputeScheduleExample {
/**
 * Executes example.
 *
 * @param args Command line arguments, none required.
 * @throws IgniteException If example execution failed.
 */
public static void main(String[] args) throws IgniteException {
    try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
        System.out.println();
        System.out.println("Compute schedule example started.");

        // Schedule output message every minute.
        SchedulerFuture<?> fut = ignite.scheduler().scheduleLocal(
            new Callable<Integer>() {
                private int invocations;

                @Override public Integer call() {
                    invocations++;

                    ignite.compute().broadcast(
                        new IgniteRunnable() {
                            @Override public void run() {
                                System.out.println();
                                System.out.println("Howdy! :)");
                            }
                        }
                    );

                    return invocations;
                }
            },
            // Callable object broadcasts a phrase to all cluster nodes every minute
            // three times with initial scheduling delay equal to five seconds.
            // https://apacheignite.readme.io/docs/cron-based-scheduling#syntax-extension
            "{5, 3} * * * * *" // Cron expression.
        );

        while (!fut.isDone())
            System.out.println(">>> Invocation #: " + fut.get());

        // In case the Cron expression is invalid, SchedulerFuture will be immediately completed with an error,
        // that provides additional details.
        fut.get();

        System.out.println();
        System.out.println(">>> Schedule future is done and has been unscheduled.");
        System.out.println(">>> Check all nodes for hello message output.");
    }
}
}

Dependencies:

    <dependency>
        <groupId>org.apache.ignite</groupId>
        <artifactId>ignite-core</artifactId>
        <version>2.12.0</version>
    </dependency>



    <dependency>
        <groupId>org.apache.ignite</groupId>
        <artifactId>ignite-schedule</artifactId>
        <version>1.0.0</version>
        <exclusions>
            <exclusion>
                <artifactId>ignite-core</artifactId>
                <groupId>org.apache.ignite</groupId>
            </exclusion>
        </exclusions>
    </dependency>

Upvotes: 0

Views: 296

Answers (1)

Igor Belyakov
Igor Belyakov

Reputation: 885

The issue happens due to use of incompatible ignite-schedule dependency version.

As was discussed here, ignite-schedule is an optional LGPL dependency and it's not published to the apache maven repository.

As a workaround, you can build the module using the source code, which is available here.

Upvotes: 1

Related Questions