DB2 - L

 View Only
Expand all | Collapse all

DB2 zOS : error loading JDBC driver toString string from error is: java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver

  • 1.  DB2 zOS : error loading JDBC driver toString string from error is: java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver

    Posted Jul 08, 2022 10:25 AM
    Hi, Good day, 
    I am running an SQL containing a function which invokes a WLM java stored proc. 

    I am just currently setting up the JAVAENV, so getting the error in the WLM env. 

    Any idea how to resolve this ?

    error loading JDBC driver toString string from error is: java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver

    Regard
    Eswar

    ------------------------------
    Eswar PrasadChandrasekaranA
    ------------------------------


  • 2.  RE: DB2 zOS : error loading JDBC driver toString string from error is: java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver

    Posted Jul 10, 2022 04:09 PM
    Sounds like the JVM isn't able to load some piece of your JDBC driver.

    Make sure your JDBC JAR (typically db2jcc4.jar these days) is in your CLASSPATH. Good to have the license_cisuz JAR in there too, but I'm not sure if it's still necessary.

    Since it's a JAVA SP, I'm assuming it's Type 2 JDBC, so make sure the /lib path for your JDBC driver (what is the default, /usr/lpp/db2nnn/jdbc/lib) is in your LIBPATH, and both SDSNLOAD and SDSNLOD2 need to be in your STEPLIB. The "libraries" in /lib are actually symbolic links that load the modules from LOD2. (we put LOD2 in the linklist)


    ------------------------------
    Mark Wieczorkowski
    ------------------
    Db2 Systems Programmer, SSA/DCS
    Principal - Solipsistic, LLC
    ------------------------------



  • 3.  RE: DB2 zOS : error loading JDBC driver toString string from error is: java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver

    Posted Sep 08, 2022 01:43 AM
    Hi, Good day, 
    We are having all these as shown below
    JCC_HOME=/usr/lpp/db2c10/jdbc
    JAVA_HOME=/usr/lpp/java/J8.0_64
    RESET_FREQ=-1
    JDBCSTD=4
    JVMPROPS=/sharedapps/inv/java/properties/jvmsp
    WORK_DIR=/sharedapps/inv/tmp
    CLASSPATH=/usr/lpp/db2c10/jdbc/classes:/sharedapps/inv/java:/u/home/DB2SWLMJ
    LIBPATH=/usr/lpp/db2c10/jdbc/lib:/sharedapps/inv/java:/usr/lib/java_runtime
    STEPLIB=DB2.SSID.SDSNEXIT:DB2.SSID.SDSNLOAD:DB2.SSID.SDSNLOD2
    LD_LIBRARY_PATH=/usr/lpp/db2c10/jdbc/lib
    DB2_BASE=/usr/lpp/db2c10/base

    All Paths are available and still the noclass found error comes. 
    Should there be some class defined or the .jar file takes care of it. 
    Because this happens only when the function with lang java invoking the WLM 
    But when we compile and run a java program, everything works ok 

    Error :
    +DSNX961I DSNX9WL6 ATTEMPT TO PERFORM OPERATION FindClass 277
    FAILED FOR ROUTINE . . SSN= DB2S PROC= DB2SWLMJ ASID= 00BF
    CLASS= METHOD= ERROR INFO= java.lang.NoClassDefFoundError:
    com.ibm.db2.jcc.DB2Driver

    ------------------------------
    Eswar PrasadChandrasekaranA
    ------------------------------



  • 4.  RE: DB2 zOS : error loading JDBC driver toString string from error is: java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver

    Posted Sep 08, 2022 05:34 AM
    Try
    CLASSPATH=/usr/lpp/db2c10/jdbc/classes/db2jcc4.jar:/usr/lpp/db2c10/jdbc/classes/db2jcc_license_cisuz.jar:/sharedapps/inv/java:/u/home/DB2SWLMJ

    ------------------------------
    Jørn Thyssen
    Rocket Software
    2022 IBM Champion
    ------------------------------



  • 5.  RE: DB2 zOS : error loading JDBC driver toString string from error is: java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver

    Posted Sep 08, 2022 06:09 AM
    Thank you for looking into it. 
    We tried what you asked, still the same error. 

    Do you have a setup like this in your shop ? If yes, can you share details if possible ?

    Regards
    Eswar

    ------------------------------
    Eswar PrasadChandrasekaranA
    ------------------------------



  • 6.  RE: DB2 zOS : error loading JDBC driver toString string from error is: java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver

    Posted Sep 08, 2022 07:33 AM
    Hello,

    I am referring DSNTIJMJ member which gives Java WLM  setup instructions.

    For the wlm  stc where does  JAVAENV  DD points and what does file contains.

    On OMVS you can run env shell command to see what environment variables are set if the JAVA_HOME variable is legit setting.

    Regards,
    Manoj K Jadwani




    ------------------------------
    ManojJadwaniBMC
    ------------------------------



  • 7.  RE: DB2 zOS : error loading JDBC driver toString string from error is: java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver

    Posted Sep 08, 2022 09:17 AM
    Hi Manoj, Good day, 
    I did not understand this "On OMVS you can run env shell command to see what environment variables are set if the JAVA_HOME variable is legit setting." 
    Do you want me to provide the JAVA_HOME path ?

    Regards
    Eswar


    ------------------------------
    Eswar PrasadChandrasekaranA
    ------------------------------



  • 8.  RE: DB2 zOS : error loading JDBC driver toString string from error is: java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver

    Posted Sep 09, 2022 08:00 AM
    Validate that the STC user has permission on the USS path.

    ------------------------------
    Robin Kempema
    Northwestern Mutual
    ------------------------------



  • 9.  RE: DB2 zOS : error loading JDBC driver toString string from error is: java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver

    Posted Sep 09, 2022 08:33 AM
    Hi Manoj, Good day, 
    The env command has the below
    JAVA_HOME=/usr/lpp/java/J8.0_64:/usr/lpp/java/J8.0_64

    Hi Robin, Good day, 
    The WLM user has the below OMVS div and segment.
    OMVS / DB2SWLMJ LAST CHANGED BY xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    HOME(/u/home/DB2SWLMJ) OMVSPGM(bin/sh) UID(4,338)

    Regards
    Eswar

    ------------------------------
    Eswar PrasadChandrasekaranA
    ------------------------------



  • 10.  RE: DB2 zOS : error loading JDBC driver toString string from error is: java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver

    Posted Sep 12, 2022 04:27 PM
    Hi Eswar, 

    Why do you have two directories in JAVA_HOME? 

    I'd try JAVA_HOME=/usr/lpp/java/J8.0_64

    Also, don't assume that whatever environment variables are set for you also applies to the userid under which the java wlm application environment runs.

    ------------------------------
    Jørn Thyssen
    Rocket Software
    2022 IBM Champion
    ------------------------------



  • 11.  RE: DB2 zOS : error loading JDBC driver toString string from error is: java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver

    Posted Sep 13, 2022 03:02 AM
    Hi, Good day, 
    We have tried everything. Nothing seems to be working 

    Regards
    Eswar

    ------------------------------
    Eswar PrasadChandrasekaranA
    ------------------------------



  • 12.  RE: DB2 zOS : error loading JDBC driver toString string from error is: java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver

    Posted Sep 13, 2022 03:22 AM
    Sounds like it is time to open a case with IBM Db2 for z/OS support

    ------------------------------
    Jørn Thyssen
    Rocket Software
    2022 IBM Champion
    ------------------------------



  • 13.  RE: DB2 zOS : error loading JDBC driver toString string from error is: java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver

    Posted Sep 13, 2022 08:25 AM
    Hi, Good day, 
    We have been working with IBM for 4 months now. They are also not able to figure out. 
    Do you create a jar file of the function before using them in SQL ?

    Regards
    Eswar

    ------------------------------
    Eswar PrasadChandrasekaranA
    ------------------------------



  • 14.  RE: DB2 zOS : error loading JDBC driver toString string from error is: java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver

    Posted Sep 13, 2022 09:12 AM
    I agree with Jorn.  You need to open a ticket with IBM to validate your setup and install.
    Regards,
    Robin

    ------------------------------
    Robin Kempema
    Northwestern Mutual
    ------------------------------



  • 15.  RE: DB2 zOS : error loading JDBC driver toString string from error is: java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver

    Posted Sep 14, 2022 02:44 AM
    Have you looked at the examples on page 181ff https://www.redbooks.ibm.com/redbooks/pdfs/sg247604.pdf ?

    Page 188 has a Java environment example that looks very different from what you posted

    ------------------------------
    Jørn Thyssen
    Rocket Software
    2022 IBM Champion
    ------------------------------



  • 16.  RE: DB2 zOS : error loading JDBC driver toString string from error is: java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver

    Posted Sep 14, 2022 03:23 AM
    Hi, Good day, 
    We did this as well. What i have pasted is one of the examples of what we have done 

    Regards
    Eswar


    ------------------------------
    Eswar PrasadChandrasekaranA
    ------------------------------



  • 17.  RE: DB2 zOS : error loading JDBC driver toString string from error is: java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver

    Posted Sep 14, 2022 03:38 AM
    Can you post the exact contents of the data set referenced in DD JAVAENV?
    If this points to a USS file, then post the exact contents of that USS file.

    Here's the file from my system:

    ENVAR("_CEE_ENVFILE=/proj/db2wlm/ids2/nolimit.txt",
    "JVMPROPS=/proj/db2wlm/ids2/jvmprop.txt",
    "JAVA_HOME=/rsusr/java/IBM/J8.0",
    "JCC_HOME=/rsusr/db2/db2d10/jdbc",
    "DB2_BASE=/rsusr/db2/db2d10/base"),
    MSGFILE(JSPDEBUG,,,,ENQ),
    XPLINK(ON)

    The total size is 236 bytes which is less than the max of 245 bytes.

    Notice the reference to /proj/db2wlm/ids2/nolimit.txt
    The contents of this USS file is

    STEPLIB=DSN.IDS2.SDSNEXIT:DSN.VD10.SDSNLOAD:DSN.VD10.SDSNLOD2
    DB2_BASE=/rsusr/db2/db2d10/base
    LIBPATH=$JAVA_HOME/include:$JCC_HOME/lib:/usr/lib:/lib:/rsusr/db2/db2d10/base/lib
    CLASSPATH=.:$JCC_HOME/classes/db2jcc.jar:$JCC_HOME/classes/db2jcc_license_cisuz.jar:$JCC_HOME/classes/db2jcc_javax.jar:$JCC_HOME/classes/sqlj.zip:/rsusr/grpr/egfv1r1/egfsproc.jar:$JAVA_HOME/lib/charsets.jar:$DB2_BASE/classes/db2javasp.jar:$DB2_BASE/classes/DSNNVBCT.jar
    PATH=$JAVA_HOME/bin:$JCC_HOME/bin
    TMSUFFIX=.
    WORK_DIR=/proj/db2wlm/ids2
    DB2JCCPROPERTIES=/proj/db2wlm/ids2/DB2JccConfiguration.properties
    PATH=.:/bin:/usr/local/bin:$JCC_HOME/bin:$JAVA_HOME/bin:$DB2_BASE/bin

    ------------------------------
    Jørn Thyssen
    Rocket Software
    2022 IBM Champion
    ------------------------------



  • 18.  RE: DB2 zOS : error loading JDBC driver toString string from error is: java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver

    Posted Sep 14, 2022 07:41 AM
    As stated before, we got this issue when the permissions on one of the paths was changed.   Make sure that the user has permissions on the file.  Go to =3.4 and put in your path like /rsusr/java/IBM/J8.0 .  This will show permissions and you want r-x .  To check on a file like $JCC_HOME/classes/db2jcc.jar go to $JCC_HOME/classes.  My file context is the same as Jorn's.  You could also turn on the debug feature if it is not on which adds a little more information to the WLM space.   
    Robin 


    ------------------------------
    Robin Kempema
    Northwestern Mutual
    ------------------------------



  • 19.  RE: DB2 zOS : error loading JDBC driver toString string from error is: java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver

    Posted Sep 14, 2022 10:31 AM
    Thank you. I will give this a try 

    How to enable the DEBUG ? We have a JSPDEBUG DD in the WLM PROC, would that be enough ?

    Regards
    Eswar

    ------------------------------
    Eswar PrasadChandrasekaranA
    ------------------------------



  • 20.  RE: DB2 zOS : error loading JDBC driver toString string from error is: java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver

    Posted Nov 05, 2022 12:56 AM
    Thank you Everyone. 
    We were able to fix the issue. 

    Robin was correct in saying it was an access issue. The WLM user required an ACF2 auditor access to be provided 
    We found it using a CA broadcom forum and confirm with CA on the same 

    Thank you for all the help and patience

    ------------------------------
    Eswar PrasadChandrasekaranA
    ------------------------------