OC4J - Classloading Issue from JSPs in sub-directories


General J2EE: OC4J - Classloading Issue from JSPs in sub-directories

  1. Hello:

    - I have some java-class files in the \<my-web-app>\web-inf\classes directory. These classes do not belong to any packages.
    - I have some jsps in the \<my-web-app>\ directory and also in some sub-directories in the \<my-web-app>\ directory. Example: \<my-web-app>\test\index1.jsp.
    - The jsps in the \<my-web-app>\ can invoke the classes in the \<my-web-app>\web-inf\classes directory with no issues. But, the jsps in the sub-directories CANNOT see the classes in the \<my-web-app>\web-inf\classes directory. I get a "class not found" error. (this is just in oc4j).

    First of all, just a background to the issue:
    - I am trying to port a web application from JRUN to OC4J.
    - I want to do this with minimal changes to the existing code.
    - The application has been running on JRUN for a while. I only see the above mentioned error (class not found) error when trying to run it on oc4j.
    - As a test, I created my own test application to verify:
      (-) I wrote a simple java class (test.class) with no package and placed it in the web-inf\classes directory
      (-) I wrote a jsp file (index.jsp) to invoke test.class. I placed the jsp at the top-level directory of the web-app.
      (-) I wrote another jsp file (index1.jsp) to invoke test.class as well. I placed that jsp file in a sub-directory in the top-level directory of the web-app.
      (-) index.jsp worked without any problems. index1.jsp gave the "class not found" error.

      (-) As another test, I then modified the class to be in a package (com.benny). I then changed the jsps to call "com.benny.test" rather than just "test". This time, both index.jsp and index1.jsp worked fine.

    So, I guess my question is, does OC4J require that all custom java classes be in packages for it to be used correctly by all the jsp pages that we have? Or, am i missing some configuration parameter somewhere in the oc4j config files?

    Any help/suggestion would be appreciated.

  2. couple of things :

       i. post the code (java+jsp) that causes the problem, as is.
          are you sure there wasn't some other error
          in the first cut of index1.jsp ?

       ii. try the same setup in tomcat. this is the
           reference implementation - if it works there
           and not in oc4j, then oc4j may have an issue.
  3. You have to package the imported classes in a package. I think this is due to some restrictions in JDK 1.4