Some JDeveloper 10g users have encountered intermittent JSP page compilation errors like:
- java.lang.ExceptionInInitializerError
- java.lang.NoClassDefFoundError
while compiling JSP pages. User's complained that sometimes the error would occur, but then after seemingly random things like exiting JDeveloper and restarting, the problem would go away. Working over the last few days with a very helpful customer who had the patience and perseverance to narrow down a set of reproducible steps, we cornered the problem today and traced it to a classloading issue regarding the Jakarta commons-logging libraries and Log4J inside the JDeveloper 10g environment. The problem occurs because JDeveloper includes commons-logging in its base IDE classpath, while Log4J was only part of the customer's project classpath (and they have a dependency on each other when used). We tracked down the "random" problem, where exiting the IDE and restarting would make the problem go away, to the fact that if the JSP Visual Editor was open when you exited JDeveloper, and so it was open again upon restarting JDeveloper 10g the next time, the order of initializing and loading classes changed and the problem then didn't reproduce. We'll include a definitive fix for 9.0.5.2, but in the interim here is the simple solution.
The Solution: Add Log4J to the JDeveloper 10g IDE Classpath
Assuming you have downloaded log4j version 1.2.8 from the Apache logging website, and that you've extracted the distribution into a directory like C:/apache, then to avoid these compilation errors you need to add the log4j jar file to JDeveloper 10g's design time CLASSPATH. This is accomplished by adding a directive to the jdev.conf file as described below:
-
Exit JDeveloper 10g
-
After making a backup, edit the JDEVHOME/jdev/bin/jdev.conf file
- Add the following line to the end of the jdev.conf file, and save it:
AddJavaLibFile C:/apache/jakarta-log4j-1.2.8/dist/lib/log4j-1.2.8.jar
- Restart JDeveloper 10g
After performing these steps, your Log4J related JSP compilation errors should be no more.
NOTE: Adding this library to jdev.conf only eliminates the classloader issue with the JSP compilation noted above. It does not once-and-for-all include the Log4J library into the classpath of every project that you build. If you import/use Log4J classes in your code, then like any library that you use in your project, you need to still include a library for it in your project properties "Library" list.
6:52:20 PM
|