Embedding GATE and trying to compile and run StandAloneAnnie - java

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 :)

Related

start Logback SimpleSocketServer to centralize logging

I'm trying to use Logback to centralize the logging of 2 microservices.
Therefore reading the documention I understood I should setup a simpleLogServer to which send the logging events of my others 2 java microservices.
https://logback.qos.ch/manual/appenders.html#serverSocketAppender
Assuming you are in the logback-examples/ directory, start SimpleSocketServer with the following command:
java ch.qos.logback.classic.net.SimpleSocketServer 6000 src/main/java/chapters/appenders/socket/server1.xml
So I've clone the git hub repo https://github.com/qos-ch/logback and from inside the logback-examples/ directory I've run the command only to get:
Error: Could not find or load main class ch.qos.logback.classic.net.SimpleSocketServer
I can't find an example of what I'm trying to achieve, and also I don't understand how can I start a SimpleSocketServer on my prod server only launching a java command and without installing anything.
Can someone clarify that for me? Thanks

Install Esper in Eclipse

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.

Error running a java program that uses log4j

So i am trying to run a java file launch.bat sdoc(launch is a small script that have the jar used, but if necessary i can post it here) and i get this error.
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: C:Users
ennasDesktopwebstorelogsvolume-server.sdoc.log
My config file is:
log4j.appender.dest.File=C:\Users\nennas\Desktop\webstore\logs\volume-server.sdoc.log
log4j.appender.dest.layout=org.apache.log4j.PatternLayout
log4j.appender.dest=org.apache.log4j.RollingFileAppender
log4j.rootCategory=INFO, dest
log4j.appender.dest.layout.ConversionPattern=%d - %m%n
I already try some solution like changing \ to / and running as admin, the path is the absolute path. The folder exist but the strange thing is that in the error the url appears all together, by the way i am using windows 7. Ty for the help
Change this
log4j.appender.dest.File=C:\Users\nennas\Desktop\webstore\logs\volume-server.sdoc.log
by
log4j.appender.dest.File=C://Users//nennas//Desktop//webstore//logs//volume-server.sdoc.log
You can try also this
log4j.appender.dest.File=C:\\Users\\nennas\\Desktop\\webstore\\logs\\volume-server.sdoc.log
There is a lot of time since I donĀ“t work with windows, but i remember similar problems with windows path and log4j

log4j not logging when using JBOSS_HOME

I am trying to configure the loggin to my web application.
This is where I want my application to put the logs:
C:\installs\JBossServer\jboss-6-0\server\default\log\kiche
If I do the following in the log4J.properties, the logs are created fine:
log4j.appender.R.File =C:\\installs\\JBossServer\\jboss-6-0\\server\\default\\log\\kiche\\kicheapp.log
I have an environment variable
JOBSS_HOME=C:\installs\JBossServer\jboss-6-0
And when I do like following in the log4J.properties, it not working.
log4j.appender.R.File=${JBOSS_HOME}\\server\\default\\log\\kiche\\kicheapp.log
Can someone please help me, I want to use JBOSS_HOME, so that its not hardcoded.
I am using JBOSS as a webserver.
Any help will be greatly appreciated.
Regards
Adofo
Maybe better is to edit jboss-log4j.xml ?
You should try :
JBOSS_HOME=C:\\installs\\JBossServer\\jboss-6-0
and also :
JBOSS_HOME=C:/installs/JBossServer/jboss-6-0 (change log4j.appender.R.File accordingly with "/" instead of "\\")
Also, is there a typo in your question or in your variable ? (JBOSS_HOME vs JOBSS_HOME)
log4J.properties cannot access the environment variables directly. Instead , you should use java system properties to do the substitution.
Tomcat 's start up script has the option -D<name>[=<value>] to set a system property .Please try to start the tomcat by using run.sh -DJBOSS_HOME=C:\installs\JBossServer\jboss-6-0

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