Install Esper in Eclipse - java

I'm struggling to install Esper in Eclipse. I'm not good at technical issues, so please I need all details to do so.
In fact, I added all jar files of esper-5.4.0.zip in Java build path of my project. I have got the following error messages:
log4j:WARN No appenders could be found for logger (com.espertech.esper.util.ObjectInputStreamWithTCCL).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" com.espertech.esper.client.EPStatementException: Failed to resolve event type: Event type or class named 'Deposit' was not found [every A=Deposit]
at com.espertech.esper.core.service.StatementLifecycleSvcImpl.compile(StatementLifecycleSvcImpl.java:1162)
at com.espertech.esper.core.service.StatementLifecycleSvcImpl.createStopped(StatementLifecycleSvcImpl.java:298)
at com.espertech.esper.core.service.StatementLifecycleSvcImpl.createStoppedAssignName(StatementLifecycleSvcImpl.java:202)
at com.espertech.esper.core.service.StatementLifecycleSvcImpl.createAndStart(StatementLifecycleSvcImpl.java:156)
at com.espertech.esper.core.service.EPAdministratorImpl.createPatternStmt(EPAdministratorImpl.java:108)
at com.espertech.esper.core.service.EPAdministratorImpl.createPattern(EPAdministratorImpl.java:58)
at test.CEP_start.main(CEP_start.java:39)

When you create a statement like select * from Deposit that requires that you tell the engine what a "Deposit" is. That is done by adding an event type.
The documentation and tutorials have plenty of introductory examples or you could review the examples that comes with the Esper download.

Related

Logstash unable to start pipeline

I am working with Logstash v7.15.1 and when I am trying to run it, I am getting below error which I am unable to figure out. Will someone help me to fix this?
Note - I have removed several plugins comes bundled with Logstash as all were not part of my requirement.
[2021-11-10T11:38:45.045Z][ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:logstash, :exception=>"Java::JavaLang::NoSuchMethodError", :message=>"java.nio.MappedByteBuffer.position(I)Ljava/nio/MappedByteBuffer;", :backtrace=>["org.logstash.ackedqueue.io.MmapPageIOV2.create(MmapPageIOV2.java:194)", "org.logstash.ackedqueue.Queue.newCheckpointedHeadpage(Queue.java:352)", "org.logstash.ackedqueue.Queue.openPages(Queue.java:209)", "org.logstash.ackedqueue.Queue.open(Queue.java:176)", "org.logstash.ackedqueue.ext.JRubyAckedQueueExt.open(JRubyAckedQueueExt.java:123)", "org.logstash.ackedqueue.ext.JRubyWrappedAckedQueueExt.initialize(JRubyWrappedAckedQueueExt.java:65)", "org.logstash.ackedqueue.QueueFactoryExt.create(QueueFactoryExt.java:62)", "org.logstash.execution.AbstractPipelineExt.openQueue(AbstractPipelineExt.java:205)", "org.logstash.execution.AbstractPipelineExt$INVOKER$i$0$0$openQueue.call(AbstractPipelineExt$INVOKER$i$0$0$openQueue.gen)", "org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:355)", "org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:144)", "org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:345)", "org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)", "org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:86)", "org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:73)", "org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:85)", "org.jruby.RubyClass.newInstance(RubyClass.java:939)", "org.jruby.RubyClass$INVOKER$i$newInstance.call(RubyClass$INVOKER$i$newInstance.gen)", "org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:207)", "opt.logstash.logstash_minus_core.lib.logstash.pipeline_action.create.RUBY$method$execute$0(/opt/logstash/logstash-core/lib/logstash/pipeline_action/create.rb:52)", "opt.logstash.logstash_minus_core.lib.logstash.pipeline_action.create.RUBY$method$execute$0$__VARARGS__(/opt/logstash/logstash-core/lib/logstash/pipeline_action/create.rb)", "org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:80)", "org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:70)", "org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:207)", "opt.logstash.logstash_minus_core.lib.logstash.agent.RUBY$block$converge_state$2(/opt/logstash/logstash-core/lib/logstash/agent.rb:391)", "org.jruby.runtime.CompiledIRBlockBody.callDirect(CompiledIRBlockBody.java:138)", "org.jruby.runtime.IRBlockBody.call(IRBlockBody.java:58)", "org.jruby.runtime.IRBlockBody.call(IRBlockBody.java:52)", "org.jruby.runtime.Block.call(Block.java:139)", "org.jruby.RubyProc.call(RubyProc.java:318)", "org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:105)", "java.lang.Thread.run(Thread.java:748)"]}
warning: thread "Converge PipelineAction::Create<logstash>" terminated with exception (report_on_exception is true):
LogStash::Error: Don't know how to handle `Java::JavaLang::NoSuchMethodError` for `PipelineAction::Create<logstash>`
create at org/logstash/execution/ConvergeResultExt.java:135
Apologies for posting incomplete information. After hours of troubleshooting, I was able to fix the issue. It was related to using different version of ruby and java. FYI, I am running Logstash in container and then deploying it on K8s cluster. I have removed plugins from Logstash source code itself and then build it.

Embedding GATE and trying to compile and run StandAloneAnnie

I've been trying to learn GATE specifically ANNIE and TwitIE. I've seen a stand alone ANNIE java code found in the GATE website (https://gate.ac.uk/wiki/code-repository/src/sheffield/examples/StandAloneAnnie.java). I am trying to run the java file but I always get this error message (because I really don't understand how to embed GATE, please tell me how to step by step):
log4j:WARN No appenders could be found for logger (gate.Gate).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" gate.util.GateRuntimeException: Could not infer installed plug-ins home!
Please set it manually using the -Dgate.plugins.home option in your start-up script.
at gate.Gate.initLocalPaths(Gate.java:303)
at gate.Gate.init(Gate.java:163)
at StandAloneAnnie.main(StandAloneAnnie.java:81)
Java Result: 1
The problem comes from the statement:
Gate.init();
Please help, I badly need it. and thank you :)
I temporarily solved the problem by including in the code before the initialization of GATE:
Gate.init()
these set of codes:
Properties props2 = System.getProperties();
props2.setProperty("gate.plugins.home", "C:\\Program Files\\GATE_Developer_8.0\\plugins");
Properties props3 = System.getProperties();
props3.setProperty("gate.site.config", "C:\\Program Files\\GATE_Developer_8.0\\gate.xml");
I hope this will also help others :)

Easily disable log4j for applet?

I am building Java Desktop and Java Applet from the same code. Log4j is in use so almost every class in desktop version (which is original) has line like
private static final Logger LOG = LoggerFactory.getLogger(EachClassName.class);
Because Applet is not supposed to perform any io operations I had to exclude this configuration code:
InputStream is = Log4jConfigurator.class.getClassLoader().getResourceAsStream(path);
properties.load(is);
is.close();
PropertyConfigurator.configure(properties);
But now I get warnings because getLogger is still in place
log4j:WARN No appenders could be found for logger (org.game.client.Client).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
What would be the most elegant solution to avoid this warnings and use logger only in desktop version?
In your "Applet App" try to configure log4j programmatically:
turn off logging
LogManager.getRootLogger().setLevel(Level.OFF);
Add NullAppender (if setting Level.OFF is not enough)
LogManager.getRootLogger().addAppender(new NullAppender())

Unable to run Mahout 20newsgroups example under Cygwin

I was able to verify that the input directory (under /tmp) exists with the newsgroup data. Not sure why I am getting a file not found exception.
$ sh classify-20newsgroups.sh
Please select a number to choose the corresponding task to run
1. naivebayes
2. sgd
3. clean -- cleans up the work area in /tmp/mahout-work-rsrinivasan
Enter your choice : 1
ok. You chose 1 and we'll use naivebayes
creating work directory at /tmp/mahout-work-rsrinivasan
Preparing Training Data
MAHOUT_LOCAL is not set; adding HADOOP_CONF_DIR to classpath.
no HADOOP_HOME set, running locally
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/cygwin/usr/local/mahout/examples/target/mahout-examples-0.6-job.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/cygwin/usr/local/mahout/examples/target/dependency/slf4j-jcl-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/cygwin/usr/local/mahout/examples/target/dependency/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
12/05/14 09:13:44 WARN driver.MahoutDriver: No org.apache.mahout.classifier.bayes.PrepareTwentyNewsgroups.props found on classpath, will use command-line arguments only
Exception in thread "main" java.io.FileNotFoundException: Can't find input directory \tmp\mahout-work-rsrinivasan\20news-bydate\20news-bydate-train
at org.apache.mahout.classifier.bayes.PrepareTwentyNewsgroups.main(PrepareTwentyNewsgroups.java:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.hadoop.util.ProgramDriver$ProgramDescription.invoke(ProgramDriver.java:68)
at org.apache.hadoop.util.ProgramDriver.driver(ProgramDriver.java:139)
at org.apache.mahout.driver.MahoutDriver.main(MahoutDriver.java:188)
You probably have to edit that script before it works on Windows. I imagine the paths are wrong for Cygwin/Windows.
it is probably best to run the example under a unix environment. When I was trying the oscon2011 reuters example I ran into similar issues; although I was using the git bash console for doing the work. It seems that the classification and clustering examples hdfs local to run properly.
I managed to get a virtualbox up and running using vagrant and the process was relatively straightforward. Yes it does add to the learning cycle but after some initial investment I was able to complete the reuters example in a couple of hours.
thanks
anand

log4j:WARN Please initialize the log4j system properly

How to resolve these following errors... Am I missing some jar file???
log4j:WARN No appenders could be found for logger (smslib).
log4j:WARN Please initialize the log4j system properly.
org.smslib.GatewayException: Comm library exception: java.lang.RuntimeException: javax.comm.PortInUseException: Port currently owned by Unknown Windows Application
at org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:97)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:110)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:158)
at org.smslib.Service$1Starter.run(Service.java:252)
WaitCommEvent: Error 31
WaitCommEvent: Error 31
My first thought was that your log4j XML or properties file wasn't picked up when log4j initialized. Make sure one of them is in your CLASSPATH.
A more careful reading of your exception suggests that you're trying to use a port that a Windows app already has taken control of.
Do a "netstat -a" to see what ports are currently in use and what's attached to them. Pick another one for your log4j appender to use.
Have you written a custom appender to write log messages to SMS? Something else is using the port you've chosen.
EDIT:
The jre/lib directory is not in the CLASSPATH. You should not be putting any of your code in that directory. It should end up in the directory where your compiled .class files are written to.

Categories