My guess is that you do not have all the STAF environment variables set in the environment in which you are running the Java program that uses STAF Java APIs. Your CLASSPATH probably does not contain the JSTAF.jar file. Section "2.0 Installation" in the STAF Java User's Guide at http://staf.sourceforge.net/current/STAFJava.htm#Header_Install says:
STAF's Java support is provided in the JSTAF.jar file (located in either C:\STAF\bin\JSTAF.jar (by default) on Windows systems or /usr/local/staf/lib/JSTAF.jar (by default) on Unix systems. The STAF install adds the JSTAF.jar file to the CLASSPATH environment variable (by default).
You can test that you have STAF Java support set up correctly by running TestJSTAF as decribed in section "5.0 How to Test STAF Java Support" in the STAF Java User's Guide at http://staf.sourceforge.net/current/STAFJava.htm#Header_TestSTAFJavaSupport. For example, on one of my Linux systems, I verified that the environment variables are set up correctly for STAF and then I ran TestJSTAF to verify that STAF Java support is set up correctly:
For example if on Linux:
- PATH must contain the STAF bin directory (e.g. /usr/local/staf/bin)
- LD_LIBRARY_PATH must contain the STAF lib directory (e.g. /usr/local/staf/lib)
- CLASSPATH must contain the JSTAF.jar file (e.g. /usr/local/staf/lib/JSTAF.jar)
Note that the STAF installer creates a STAFEnv script file in the root STAF install location (e.g. /usr/local/staf/STAFEnv.sh) that can be used to set the required environment variables for STAF. You can source setEnv.sh as follows to set the STAF environment variables for the shell that it is run in. For example:
cd /usr/local/staf
. ./setEnv.sh
Last edit: Sharon Lucas 2017-01-27
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I fixed the issue.. The issue was even.jar file which was present in my staf.cfg file... I think that was compiled with some older JAVA where as i was using JAVA 1.8 in my new environment... By commenting that section in my staf.cfg file fixed the issue.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I am Running STAF on Tomcat Server.. When i tried to create a Handle using JAVA, It threw error message as mentioned in Subject line.
Note :- I have put the JSTAF.jar file under my lib folder.
STAFHandle handle = new STAFHandle("MyFirstREST");
My guess is that you do not have all the STAF environment variables set in the environment in which you are running the Java program that uses STAF Java APIs. Your CLASSPATH probably does not contain the JSTAF.jar file. Section "2.0 Installation" in the STAF Java User's Guide at http://staf.sourceforge.net/current/STAFJava.htm#Header_Install says:
You can test that you have STAF Java support set up correctly by running TestJSTAF as decribed in section "5.0 How to Test STAF Java Support" in the STAF Java User's Guide at http://staf.sourceforge.net/current/STAFJava.htm#Header_TestSTAFJavaSupport. For example, on one of my Linux systems, I verified that the environment variables are set up correctly for STAF and then I ran TestJSTAF to verify that STAF Java support is set up correctly:
Also see section "7. Environment Variable Settings" in the STAF Installation Guide at http://staf.sourceforge.net/current/STAFInstall.pdf for more information.
For example if on Linux:
- PATH must contain the STAF bin directory (e.g. /usr/local/staf/bin)
- LD_LIBRARY_PATH must contain the STAF lib directory (e.g. /usr/local/staf/lib)
- CLASSPATH must contain the JSTAF.jar file (e.g. /usr/local/staf/lib/JSTAF.jar)
Note that the STAF installer creates a STAFEnv script file in the root STAF install location (e.g. /usr/local/staf/STAFEnv.sh) that can be used to set the required environment variables for STAF. You can source setEnv.sh as follows to set the STAF environment variables for the shell that it is run in. For example:
Last edit: Sharon Lucas 2017-01-27
Thanks for the reply,
I fixed the issue.. The issue was even.jar file which was present in my staf.cfg file... I think that was compiled with some older JAVA where as i was using JAVA 1.8 in my new environment... By commenting that section in my staf.cfg file fixed the issue.
Please ignore the type... It was event.jar...