Main-Issue: - 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, do these classes have to be in a package? I am trying to avoid having to make a lot of changes to the app. If they do have to be in packages, then I have re-compile a lot of class files, add import statements to jsps, etc.
You can move your classes into packages, or you can continue to have problems. Your choice.
Joined: Nov 28, 2005
Yes, sorry it is WEB-INF, not web-inf. I have it as WEB-INF.
Also, the application is working fine on JRUN. The classes can be seen even though they are not in packages and even though import statements are missing in the jsp files.
I get the "class not found" error when I try to run the application on OC4J.
I created a small j2ee application just for testing. I am seeing that the jsp's that are within sub-directories are not able to see the classes in the web-inf\classes directory, if the classes are not in packages and there are no import statements for those classes in the jsps. But the jsps that are at the top-level directory of the web-app are able to see those classes.
So, I'm wondering why the jsps in the top-level directory can see the classes, but the jsps in the sub-directories cannot.