The error message says java.lang.NoClassDefFoundError: STAFMonitor (wrong 
name: staf_monitor/STAFMonitor) so it can't find the class name in the 
class path.  So, my guess is that STAFProcessJDBC.jar does not contain the 
STAFMonitor.class or contains it under a different prefix or something. 
What's the output from running which will list all the classes it 
contains:

jar tf STAFProcessJDBC.jar


--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




From:   Prabhat Saurabh <prabhat2...@gmail.com>
To:     staf-users@lists.sourceforge.net, 
Date:   07/12/2012 01:03 AM
Subject:        Re: [staf-users] Invoking a JAVA process 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"']]

can you please suggest me the solution for the same... 
------------------------------------------------------------------------------
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

Reply via email to