Question

I have the maven plug in installed on my Eclipse and added Esper jar to my library. I tried to ran a simple example with Esper but I failed on the following code:

EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider();
String expression = "select avg(price) from org.myapp.event.OrderEvent.win:time(30 sec)";
EPStatement statement = epService.getEPAdministrator().createEPL(expression);

And I got exception at createEPL(expression):

Exception in thread "main" java.lang.NoClassDefFoundError: org/antlr/v4/runtime/tree/Tree
at com.espertech.esper.core.service.EPAdministratorHelper.<clinit>  (EPAdministratorHelper.java:43)     
at com.espertech.esper.core.service.EPAdministratorImpl.createEPLStmt(EPAdministratorImpl.java:116)
at com.espertech.esper.core.service.EPAdministratorImpl.createEPL(EPAdministratorImpl.java:66)
at Main.main(Main.java:57)
Caused by: java.lang.ClassNotFoundException: org.antlr.v4.runtime.tree.Tree
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 4 more

It seems like that esper failed to find org/antlr/v4/runtime but I am pretty sure that this package is in the library. Did I miss anything to run the code?

Was it helpful?

Solution

The jar file that is not in your classpath is antlr-runtime-4.1.jar, a required Esper dependency.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top