Saturday, August 4, 2012

Quartz: java.lang.ClassNotFoundException: org.slf4j.Logger while running embedded Weblogic on JDev 11.1.2.2.0

VIP: The post is updated with the original cause.

After working on Oracle Jdeveloper 11.1.2.2.0 for a while, today when I am running my application on embedded Weblogic.
Suddenly I have stuck with the following error in Weblogic deployment stage of my application:


There is no other applications could run. So what is the solution?

I have deleted the embedded Weblogic defaultDomain folder of jdeveloper, and created it again via jdeveloper, but this procedure not succeeds.

The other option is to uninstall jdeveloper and install it again, but this issue is time consuming, it is expanded from installing jdeveloper, configuring the libs, and your applications (There is a work around for this by coping the o.ide and o.jdeveloper folders of your jdeveloper system11.x.x.x.x.x.x.x folder, and past them again in newly created folder.), and I have critical delivery time and I didn’t to this procedure.

After googleing for the problem and reason for a while, I didn't find exact or reason or solution for problem.

So after investigation, the slf4j-api library is not available anymore for Weblogic to start normally, I don't know the reason, but any way here is the solution:

Note: While writing this post the slf4j api library version is 1.6.6.

Solution:
  1. Download the slf4j-1.6.6.zip library from the following site http://www.slf4j.org/download.html.

  2. Extract the zip, to C:\ slf4j-1.6.6

  3. In slf4j-16.6 folder locate the following 2 libs: slf4j-api-1.6.6.jar and slf4j-nop-1.6.6.jar.

  4. Locate the folder called "system11.1.2.2.39.61.83.1". On windows it will be in the following path: "C:\Users\mohamed_taman\AppData\Roaming\JDeveloper\system11.1.2.2.39.61.83.1"

  5. Inside this folder locate folder called " DefaultDomain " inside it locate " lib " folder.

  6. Copy and paste in lib folder the previously mentioned 2 jars "slf4j-api-1.6.6.jar and slf4j-nop-1.6.6.jar".

  7. You can past then in any folder that is visible to Weblogic classpath.

  8. Run your application and it will run now and Weblogic will be happy now.

VIP: Update: the original cause:

After working for another day I found the team has the same error after updating from SVN, and then I realized that the problem is not in JDeveloper, there is a certain library that needs this lib.

I have scanned my project and reviewed what is newly added to the project and libs used, I found that the Quartz Scheduler API lib is used in web by injecting the following line into the web.xml:

First:
I have reverted the above solution to get stuck with the original error.

Second:
I went to folder " C:\Users\mohamed_taman\AppData\Roaming\JDeveloper\system11.1.2.2.39.61.83.1\o.j2ee\drs " and delete my application.

I tried to run other applications, they are runs successfully. So the problem is in my application not JDeveloper.

Note: I used the quartz 2.0.2 this this happens after migration from version 1.x.x to 2.x.x.

Another VIP note: I used Quartz 2.x in normal scheduling and it works normal, the problem raised when I used it in the web.

Note: While writing this post the Quartz library version is 2.0.2.

Solution:
  1. Under your extracted Quartz folder; for example if you extracted the folder like this: " E:\Utilities\Quartz 2.0.2 ", locate folder called " lib (E:\Utilities\Quartz 2.0.2\lib)".

  2. In " lib " folder locate the following 3 libs: slf4j-api-1.6.1.jar , slf4j-log4j12-1.6.1.jar and log4j-1.2.14.jar.

  3. When you add quartz-all-2.0.2.jar to your web project as library, add also all the 3 libs located in step 2.

  4. Run your application and it will run now, and Weblogic will be happy now.

For any help just leave your comment.