Topic
11 replies Latest Post - ‏2010-08-12T11:11:39Z by JonathanPLawrence
gp1man
gp1man
6 Posts
ACCEPTED ANSWER

Pinned topic catalog.php sample

‏2009-01-29T19:58:35Z |
I am attempting to run the catalog.php sample, but keep running into "Fatal error: Class 'DFH0XCMN' not found ". I have tried using the supplied catalog.jar, and recreating the class files. I put the class files I created into the ca1s/work/example/class directory to be available in the CLASSPATH and have added the catalog.jar directory into the CLASSPATH. I have run info.php to examine the CLASSPATH to besure that the JVM is picking up the correct profile, which it is. Any hints as to what else to try?
Thanks
Updated on 2010-08-12T11:11:39Z at 2010-08-12T11:11:39Z by JonathanPLawrence
  • SystemAdmin
    SystemAdmin
    23 Posts
    ACCEPTED ANSWER

    Re: catalog.php sample

    ‏2009-02-02T11:40:35Z  in response to gp1man
    Hi Gp1man,

    Sorry for the late reply. Seems like you have already made a very good start at investigating this problem. So far, I have not been able to reproduce it using the catalog.jar supplied with the SupportPac. Here are a few questions and suggestions that might help us get to the bottom of this:

    1. Are there other errors or warnings before the Fatal Error? I suspect the error you mentioned is occurring on the line of PHP code which attempts to new up an instance of the class, after the class should have been loaded into the runtime through the java_import() function. But if the Java class is not being loaded at all, we should also see an earlier message emanating from the java_import() call itself. If present, this message could give us more information on what is going on.

    2. Could you confirm that the catalog.jar file pointed to by your classpath (as visible in the phpinfo() table) is present, has the appropriate read permissions, and is a valid jar file (e.g. try running 'jar tf catalog.jar' to ensure its contents can be listed, ensuring the file is not corrupt)?

    3. For general diagnostic purposes, would you be able to supply any relevant JVM stderror logs, the content of your php.ini file and the full CLASSPATH entry in your phpinfo() table?

    4. Finally, you could try enabling debug level internal tracing and sending us the binary trace file so we can analyse it. For more information on how to do this, see section 11.4 of the manual. In summary, you'd need to create a file named 'p8logging.properties' on your classpath, containing the following:
    traceLevel = DEBUG
    traceToFile = true
    Then phase out your JVMs and issue a request to the URL that provokes the error. A binary file named p8trace.<hashcode>.0 will be generated in your JVM's working directory - please send us that file.
    Many thanks,
    Robin Fernandes
    PHP runtime development
  • gp1man
    gp1man
    6 Posts
    ACCEPTED ANSWER

    Re: catalog.php sample

    ‏2009-02-02T14:43:06Z  in response to gp1man
    Hello Robin,
    Thanks for the response. I have gathered most of the info you mentioned.
    Text from webpage:

    CICS Example Catalog Application

    Warning: Class definition not found exception 'sample.DFH0XCMN'
    in /sysapps/cicsapps/ca1s/work/examples/CICS/catalog/catalog.php on line 16
    Fatal error: Class 'DFH0XCMN' not found
    in /sysapps/cicsapps/ca1s/work/examples/CICS/catalog/catalog.php on
    line 49
    Item Description Cost Stock On Order
    Text from phpinfo()

    PHP Version 5.2.3-p8

    Runtime Driver p8-zOS-20081204224222
    Runtime Version $Revision: 20232 $
    Server API CICS Web Support (CA1S 1.0-20081204-2247)
    Loaded Configuration File /sysapps/cicsapps/ca1s/config/ini/php.ini

    <snip>

    Environment
    Variable Value
    _EDC_ADD_ERRNO2 1
    _EDC_PTHREAD_YIELD -2
    IDLE_TIMEOUT 10
    STDOUT dfhjvmout -generate
    _EDC_STOR_INITIAL 4K
    JAVA_DUMP_OPTS ONANYSIGNAL(JAVADUMP,CEEDUMP,SYSDUMP),ONINTERRUPT(NONE)
    DISPLAY_JAVA_VERSION NO
    LIBPATH /master/cicssys/cics32/lib:/usr/lpp/java/J5.0/bin:/usr/lpp/java/J5.0/bin/classic:/master/cicssys/cics32/lib:/usr/lpp/java/J5.0/bin:/usr/lpp/java/J5.0/bin/j9vm:/usr/lpp/db2910/lib:/sysapps/cicsapps/ca1s/p8/lib
    WORK_DIR /tmp/CICSIV21
    GC_HEAP_THRESHOLD 85
    CLASSPATH_SUFFIX /sysapps/cicsapps/ca1s/work/examples/jars/catalog.jar
    _CREATE_LAYOUT Y
    STDIN dfhjvmin
    CLASSPATH_PREFIX /sysapps/cicsapps/ca1s/config/ini:/sysapps/cicsapps/ca1s/p8/jars/p8api.jar:/sysapps/cicsapps/ca1s/p8/jars/p8.jar:/sysapps/cicsapps/ca1s/p8/jars/p8cics.jar:/sysapps/cicsapps/ca1s/work/classes:/usr/lpp/db2910/classes/db2jcc.jar:/usr/lpp/db2910/classes/db2jcc_javax.jar:/usr/lpp/db2910/classes/db2jcc_license_cisuz.jar
    CICS_HOME /master/cicssys/cics32
    STDERR dfhjvmerr -generate
    LIBPATH_SUFFIX /usr/lpp/db2910/lib:/sysapps/cicsapps/ca1s/p8/lib
    CLASSPATH -Djava.class.path=/sysapps/cicsapps/ca1s/config/ini:/sysapps/cicsapps/ca1s/p8/jars/p8api.jar:/sysapps/cicsapps/ca1s/p8/jars/p8.jar:/sysapps/cicsapps/ca1s/p8/jars/p8cics.jar:/sysapps/cicsapps/ca1s/work/classes:/usr/lpp/db2910/classes/db2jcc.jar:/usr/lpp/db2910/classes/db2jcc_javax.jar:/usr/lpp/db2910/classes/db2jcc_license_cisuz.jar:/master/cicssys/cics32/lib/dfjcicsras.jar:/master/cicssys/cics32/lib/ras.jar:/master/cicssys/cics32/lib/dfjwrap.jar:/master/cicssys/cics32/lib/dfjorb.jar:/master/cicssys/cics32/lib/dfjcont.jar:/master/cicssys/cics32/lib/dfjcsi.jar:/master/cicssys/cics32/lib/dfjcics.jar:/master/cicssys/cics32/lib/dfjcdmn.jar:/master/cicssys/cics32/lib/dfjjts.jar:/master/cicssys/cics32/lib/dfjadjr.jar:/master/cicssys/cics32/lib/omgcos.jar:/master/cicssys/cics32/lib/dfjname.jar:/master/cicssys/cics32/lib/websphere.jar:/master/cicssys/cics32/lib/dfjcci.jar:/master/cicssys/cics32/lib/dfjejbdd.jar:/master/cicssys/cics32/lib/dfjoutput.jar:/master/cicssys/cics32/lib/wsdl/dfjwsdl.jar:/master/cicssys/cics32/lib/wsdl/wsdl4j.jar:/master/cicssys/cics32/lib/wsdl/woden.jar:/master/cicssys/cics32/lib/wsdl/NamespaceContext.jar:/master/cicssys/cics32/lib/wsdl/XmlSchema.jar:/usr/lpp/java/J5.0/standard/ejb/2_0/ejb20.jar:/usr/lpp/java/J5.0/standard/jta/1_0_1/jta-spec1_0_1.jar:/usr/lpp/java/J5.0/standard/jca/connector.jar:/sysapps/cicsapps/ca1s/work/examples/jars/catalog.jar
    LIBPATH_PREFIX /master/cicssys/cics32/lib:/usr/lpp/java/J5.0/bin:/usr/lpp/java/J5.0/bin/classic
    JAVA_HOME /usr/lpp/java/J5.0

    Data from JVM stderror logs: file is empty

    Messages from 'jar tf catalog.jar' indicates jar is good.

    There are no messages in the CICS job log requarding the request.

    I have 'LOCALCCSID=1047' coded in the SIT for the CICS region.

    I think this is the only change I made to php.ini..

    unicode
    ;unicode.script_encoding = ISO-8859-1
    unicode.script_encoding = IBM1047
    ;unicode.script_encoding = IBM037
    unicode.runtime_encoding = IBM1047
    ;unicode.runtime_encoding = IBM037

    I have converted the scripts to EBCDIC using 'iconv -f ISO8859-1 -t IBM-1047 HelloCICS.php'

    the 'hellocics' and 'HelloCICS.php' samples run fine.
    I will setup system to capture the trace and give it a look to see if I see anyting there.

    Thanks,
    Michael
    • SystemAdmin
      SystemAdmin
      23 Posts
      ACCEPTED ANSWER

      Re: catalog.php sample

      ‏2009-02-02T15:52:14Z  in response to gp1man
      Michael,

      Thanks for all the info. It is significant that the error from java_import() is "Class definition not found" rather than "Class not found". This implies that the class file is being found, but the class isn't loading properly.

      I see that on your CLASSPATH, /sysapps/cicsapps/ca1s/work/classes precedes /sysapps/cicsapps/ca1s/work/examples/jars/catalog.jar - so any classes placed under the work/classes directory would take precedence over those in catalog.jar. Are the classes you generated still under the work/classes dir? If so, could you try deleting them so we can be sure the JVM trying to pick up the versions in catalog.jar? If that works, we can then investigate why your generated classes are not loading.

      Regards,
      Robin Fernandes
      PHP runtime development
  • gp1man
    gp1man
    6 Posts
    ACCEPTED ANSWER

    Re: catalog.php sample

    ‏2009-02-03T13:58:38Z  in response to gp1man
    Hello Robin,
    I have rechecked everything here, all looks correct. I ran the
    check on the jar, which looks fine. I have tried compiling the
    classes into the ../ca1s/work/classes directory, and they still
    do not work. I now have removed them and should be pulling from
    the catalog.jar. I tried moving the
    ../ca1s/work/examples/jars/catalog.jar path to the top of the
    list to be be sure that it was not being blocked by anything,
    with same results.

    In my research, I found a reference from www.projectzero.org
    which discusses the java_import function, and they indicate that
    an extension of "extension = com.ibm.p8.engine.xapi.reflection.impl.JavaExtensionLibrary"
    is needed in the php.ini. I tried this, but the object was not
    found. I was wondering if this could be a problem?

    I tried to set up the trace, but it appears that to use that
    option, access to the ICSF csfrng is required, which I do not have
    at this time. I could find no docs supporting the need for
    access to the ICSF funtions, so none have been arranged for CICS.

    If you have any other ideas, I would appreciate them.
    Thanks,
    Michael
    • SystemAdmin
      SystemAdmin
      23 Posts
      ACCEPTED ANSWER

      Re: catalog.php sample

      ‏2009-02-03T18:14:08Z  in response to gp1man
      Hi Michael,

      Hmm, this is proving to be a tough one! :)

      • So just to confirm, after removing your generated classes and restarting your JVMs, you continue to get the exact same "Class definition not found" message (and not "Class not found")?

      • There is no need to add JavaExtensionLibrary to php.ini: it is loaded by the runtime by default. Adding it causes a failure due to duplicate definitions. I have raised a bug on http://projectzero.org/bugzilla to correct the docs you found.

      • Currently, I don't quite understand the dependency you have found to be needed for tracing, but we will investigate further and make sure we document what's required.

      • To establish with certainty where the JVM is locating the Java class 'sampe.DFH0XCMN', we can try enabling verbose class loading. Add this JVM option to your JVMProfile:
        -verbose:class,dynload

        Then, restart your JVMs and issue a request to the problematic URL.
        You should get a lot of output on standard error. Search the output for 'DFH0XCMN' and let us know what comes up. If the JVM is looking in catalog.jar, you should see a line like:
        class load: sample.DFH0XCMN from: file:/u/robinf/buildTest/ca1s/work/examples/jars/catalog.jar

      • Lastly (not sure whether this is relevant), I've found that the easiest way for me to reproduce the "Class definition not found" error is by placing classes in a directory structure that doesn't correspond the their package structure, and then attempting to load them based on the directory names. In other words, say I have a class DFH0XCMN that belongs to package foo, but the class file is placed in <classpath_dir>/sample/DFH0XCMN.class (rather than <classpath_dir>/foo/DFH0XCMN.class); then, I try to load the class like java_import('sample.DFH0XCMN') (rather than java_import('foo.DFH0XCMN')). In this scenario, I get the "Class definition not found" error. Could this be applicable to your environment?

      Regards,
      Robin Fernandes
      PHP runtime development
  • gp1man
    gp1man
    6 Posts
    ACCEPTED ANSWER

    Re: catalog.php sample

    ‏2009-02-03T20:34:11Z  in response to gp1man
    Hello Robin,
    To answer your questions,I removed the classes that I generated,
    and am using the sample.jar as provided. I addes the -verbose parm
    and read through the output. I found where DFH0XCMN was loaded:

    <Loaded sample/DFH0XCMN>
    < Class size 6639; ROM size 7992; debug size 0>
    < Read time 1 usec; Load time 1126 usec; Translate time 1381 usec>
    class load: sample.DFH0XCMN from: file:/sysapps/cicsapps/ca1s/work/examples/jars/catalog.jar

    I also looked to see if I recognized any error process, but I did not
    recognize anything. My JAVA experence is limited.

    I tried the extension that I found, and saw the errors, so I removed it.

    By the way, I noticed that I gave the wrong ICSF funciton before, the
    correct function is CSNBRNG, which is the random number generator function.

    I also tried to regenerate the class files, and put them in the wrong
    directory, leaving the original catalog.jar in the CLASSPATH. I found
    that the search found the jar, and when I moved the classes to the correct
    directory, they were then picked up, with same results. But I did notice
    that the set of classes that I generated were a different size than
    the set from the jar.

    <Loaded sample/DFH0XCMN>
    < Class size 7118; ROM size 8568; debug size 0>
    < Read time 0 usec; Load time 1317 usec; Translate time 1254 usec>
    class load: sample.DFH0XCMN from: file:/sysapps/cicsapps/ca1s/work/classes/

    I will still investigate..
    Thanks
    Michael
    • SystemAdmin
      SystemAdmin
      23 Posts
      ACCEPTED ANSWER

      Re: catalog.php sample

      ‏2009-02-04T15:10:34Z  in response to gp1man
      Hi Michael,

      A question for you, just to check I understand the current situation:

      When you see "class load: sample.DFH0XCMN from: file:/sysapps/cicsapps/ca1s/work/examples/jars/catalog.jar" (meaning: we know for sure that the class is being loaded from catalog.jar, and your generated classes are not being touched), do you continue to get exactly this error message:
      "Warning: Class definition not found exception 'sample.DFH0XCMN' in /sysapps/cicsapps/ca1s/work/examples/CICS/catalog/catalog.php on line 16
      Fatal error: Class 'DFH0XCMN' not found in /sysapps/cicsapps/ca1s/work/examples/CICS/catalog/catalog.php on line 49"
      ?

      If so, this is intriguing: I'm not sure how the classes in catalog.jar could cause a "Class definition not found" exception. I wonder if the problem is reproducible with with a simpler script, like:
      <?php
      java_import('sample.DFH0XCMN');
      var_dump(new DFH0XCMN());
      ?>

      The expected output for that script is:
      object(DFH0XCMN)#1 (0) {
      }

      Perhaps it would be useful to try get the above short script working with the classes in catalog.jar as a first step.
      Then, if there are further problems when running with your generated classes or the actual catalog example itself, we can investigate those issues next.

      Thanks,
      Robin Fernandes
      PHP runtime development
  • gp1man
    gp1man
    6 Posts
    ACCEPTED ANSWER

    Re: catalog.php sample

    ‏2009-02-05T17:54:14Z  in response to gp1man
    Hello Robin,
    I was out of the office yesterday, but I got some info for you.
    I do get the same message generated to the webpage using either the jar or class. I setup the small sample program you suggested and run a test with both and copied all the data to a couple txt files which I will attach. I captured the php script, the text from the web response and the data from the -verbose option on the JVM. My file dfhjvmerr.001.txt was generated using the class files that I created, dfhjvmerr.002.txt was generated using the catalog.jar file. I also captured the html from the infophp() script as info.html.

    Just as a test on my side, I used the test php script and altered it to load the HelloCICSWorld.java sample provided by CICS as:
    <?php
    java_import('examples.HelloWorld.HelloCICSWorld');
    var_dump(new HelloCICSWorld());
    ?>

    This test gave the expected result. Thinking that there may be a path problem, I copied the catalog.jar file to the directory that the HelloCICSWorld class is in, (which is at the top of the classpath), but still got the error response. Still, I am not sure if there may be a path problem

    I hope this helps,
    Michael

    Attachments

  • JonathanPLawrence
    JonathanPLawrence
    30 Posts
    ACCEPTED ANSWER

    Re: catalog.php sample

    ‏2009-02-06T12:05:43Z  in response to gp1man
    Hello Michael,

    I believe your problem is that the JZOS fields package classes are not in your classpath as you are not running with Java 5.0 sr8 (I presume?). These classes are used by the JZOS generated code and without them the sample.DFH0XCMN class cannot be loaded.

    Although we specified Java 5.0 sr8 as a prereq in the docs, if necessary it is possible to run with earlier releases of Java 5.0, if you add the JZOS fields support to your classpath explicitly. Add jzos_recgen.jar (in the ca1s/jzos/ directory) to your CLASSPATH_SUFFIX in your JVM profile eg:
    ...
    /u/p8build/ca1s/jzos/jzos_recgen.jar:\
    /u/p8build/ca1s/work/examples/jars/catalog.jar:\
    ...

    It would be preferable to upgrade to Java 5.0 sr8 if you are able to.

    Jonathan Lawrence (Robin's colleague)
  • gp1man
    gp1man
    6 Posts
    ACCEPTED ANSWER

    Re: catalog.php sample

    ‏2009-02-06T18:13:46Z  in response to gp1man
    Hello Jonathan and Robin,
    That appears to be the problem. I thought we had the correct JAVA
    version installed, but I added the path to jzos_recgen.jar in
    the CLASSPATH list and now it works. I was sure it was a
    configuration problem, just did not see it. Thanks for all the
    help.
    Michael
  • JonathanPLawrence
    JonathanPLawrence
    30 Posts
    ACCEPTED ANSWER

    Re: catalog.php sample

    ‏2010-08-12T11:11:39Z  in response to gp1man
    Hello Michael,

    Apologies for following up on this again after so long.
    I am revisiting the dependency on ICSF which you reported when attempting to configure p8 tracing in the CA1S SupportPac.
    I have been unable to reproduce this dependency on our systems, so I'm wondering whether you are still seeing this issue.
    If you are still using the SupportPac, it would be useful to know whether you still see the requirement for ICSF when attempting to use p8 tracing with CA1S.
    Please do not go to a lot of trouble to reproduce this if inconvenient.
    You may prefer to email me directly : jlawrence@uk.ibm.com

    Jonathan Lawrence
    CICS PHP Runtimes