Have you tried running your java program via the command line using the
.jar file you created? For example:
java -cp C:/STAF/samples/demo/STAFProcessJDBC.jar;%CLASSPATH% STAFMonitor
That is the command that you're essentially running via your STAX job, If
that doesn't work, then maybe you have a problem with the .jar file you
created (or something).
In the NoClassDefFoundError it says "wrong name:
staf_monitor/STAFMonitor". What is this staf_monitor package/directory
that it is referring to?
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
From: Prabhat Saurabh <prabhat.saur...@infostretch.com>
To: "staf-users@lists.sourceforge.net"
<staf-users@lists.sourceforge.net>,
Date: 07/13/2012 07:49 AM
Subject: [staf-users] Invoking JAVA Class through STAX...
Hello Sir/Ma'am,
1. My JAVA source code is: STAFMonitor.java, which is getting executed
successfully without any error on JAVA IDE/Eclipse.
· I have created two table in mysql database as "emp" and "emp1"
with 5 columns each.
· I have created a procedure in mysql database which inserts 1000
records in emp, retrieve those 1000 records and insert back those 1000
records in emp1 (all one-by-one).
· I have created a method im my JAVA class, which is getting a
successful connection with the mysql server and calling that stored
procedure.
2. My JAVA executable is : STAFMonitor.class
3. I have created my jar file from STAFMonitor.class as
STAFProcessJDBC.jar
4. I have included this STAFProcessJDBC.jar file as
C:\STAF\samples\demo\STAFProcessJDBC.jar along with STAFMonitor.java as
C:\STAF\samples\demo\STAFMonitor.java
5. I have also included JSTAF.jar and STAFProcessJDBC.jar to the CLASSPATH
6. My stafJDBC.xml is inside C:\STAF\services\stax\samples\stafJDBC.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "stax.dtd">
<stax>
<defaultcall function="main"/>
<function name="main">
<sequence>
<process name="'Run STAF JDBC'">
<location>'local'</location>
<command mode="'shell'">'java STAFMonitor'</command>
<env>'CLASSPATH=C:/STAF/samples/demo/STAFProcessJDBC.jar;{STAF/Env/CLASSPATH}'</env>
<stderr mode="'stdout'"/>
<returnstdout/>
</process>
<if expr="RC != 0">
<log message="1">
'Process Error: RC=%s, STAFResult=%s, STAXResult=%s' % \
(RC, STAFResult, STAXResult)
</log>
<else>
<log message="1">'Process RC was 0. STAXResult=%s' %
STAXResult</log>
</else>
</if>
</sequence>
</function>
7. Now when we are submitting stafJDBC.xml as a new job through the STAX
GUI, it is giving the following message (The job id is successfully
getting generated).
Here is the Message:
Process Error: RC=1, STAFResult=None,
STAXResult=[[0,u'java.lang.NoClassDefFoundError: STAFMonitor (wrong name:
staf_monitor/STAFMonitor)\r\n\tat
java.lang.ClassLoader.defineClass1(Native Method)\r\n\tat
java.lang.ClassLoader.defineClass(ClassLoader.java:791)\r\n\tat java
security.SecureClassLoader.defineClass(SecureClassLoader.java:
142)\r\n\tat
java.net.URLClassLoader.defineClass(URLClassLoader.java:449)\r\n\tat
java.net.URLClassLoader.access$100(URLClassLoader.java:71)\r\n\tat
java.net.URLClassLoader$1.run(URLClassLoader.java:361)\r\n\tat
java.net.URLClassLoader$1.run(URLClassLoader.java:355)\r\n\tat
java.security.AccessController.doPriviledge(Native Method)\r\n\tat
java.net.URLClassLoader.findClass(URLClassLoader.java:354)\r\n\tat
java.lang.ClassLoader.loadClass(ClassLoader.java:423)\r\n\tat
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)\r\n\tat
java.lang.ClassLoader.loadClass(ClassLoader.java:356)\r\n\tat
sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:476)\r\nException
in thread "main"']]
I have also tried the command: C:\STAF\samples\demo>jar tf
STAFProcessJDBC.jar
The output is:
META-INF/
META-INF/MANIFEST.MF
STAFMonitor.class
àCan you please suggest me the solution for the same...
Thanks & Regards,
P R A B H A T
Prabhat Saurabh | Associate Software Engineer |
InfoStretch Solutions Pvt. Ltd. | Elevating Confidence |
www.infostretch.com | Cell: +91 9325649321
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users