Quartz and slf4j in Eclipse

1,287 views
Skip to first unread message

randal cobb

unread,
Sep 12, 2011, 6:46:35 PM9/12/11
to google-we...@googlegroups.com

Hello all,

I'm running into an annoying issue in DEV mode and I cant sem to properly Google a result...  I have a servlet that uses Quartz scheduler in my app and it runs fine in compiled mode.  However, if I run in EcIipse using the latest GWT Eclipse plugin in DEV mode, I get a ClassNotFound exception on the servlet's startup (it can't load org.slf4j.LoggerFactory).  I am using Maven to build the project and it DOES run succesfully and Quartz does start up if I run ”mvn jetty:deploy-war” via command-line.  I've tried explicitly adding slf4j-api.jar to the launcher's classpath, but no joy.  Anyone have any recommendations?

Cheers, and thanks in advance!
Randy

Juan Pablo Gardella

unread,
Sep 12, 2011, 8:14:26 PM9/12/11
to google-we...@googlegroups.com
Add some logger implementation and the provider to the classpath, as log4j and sl4j-log4j.

2011/9/12 randal cobb <rco...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

randal cobb

unread,
Sep 13, 2011, 9:19:42 AM9/13/11
to google-we...@googlegroups.com
Thanks for the suggestion, but that doesn't seem to help.  I've added the suggested dependencies both to the project's pom file, and as explicit "User Entries" on the Classpath tab of the "Run configuration" for "Web Application" in Eclipse.  I've confirmed that the version of slf4j I'm using is the same as the requirement for Quartz, too (via "mvn dependency:tree").  Here's some output and a screen-print:

Screen print of Classpath tab in "run configuration"
image.png

Here's the full stacktrace that gets dumped out in DEV mode:

log4j:WARN No appenders could be found for logger (org.apache.jasper.compiler.JspRuntimeContext).

log4j:WARN Please initialize the log4j system properly.

[WARN] Server class 'org.quartz.ee.servlet.QuartzInitializerServlet' could not be found in the web app, but was found on the system classpath

   [WARN] Adding classpath entry 'file:/Volumes/Disk_2/home/cobbr/.m2/repository/org/quartz-scheduler/quartz/2.0.2/quartz-2.0.2.jar' to the web app classpath for this session

   [WARN] failed QuartzInitializer

java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory

at org.quartz.impl.StdSchedulerFactory.<init>(StdSchedulerFactory.java:274)

at org.quartz.ee.servlet.QuartzInitializerServlet.init(QuartzInitializerServlet.java:185)

at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:433)

at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:256)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)

at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:616)

at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)

at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)

at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)

at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)

at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:463)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)

at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)

at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)

at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)

at org.mortbay.jetty.Server.doStart(Server.java:222)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)

at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:667)

at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:500)

at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1055)

at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:804)

at com.google.gwt.dev.DevMode.main(DevMode.java:309)

Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory

at java.net.URLClassLoader$1.run(URLClassLoader.java:202)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload$WebAppClassLoaderExtension.findClass(JettyLauncher.java:367)

at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:366)

at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)

... 23 more

   [WARN] failed com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload@ebeb918{/,/Volumes/Disk_2/home/cobbr/Workspaces/SVNTools/svntools-web/src/main/webapp}

java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory

at org.quartz.impl.StdSchedulerFactory.<init>(StdSchedulerFactory.java:274)

at org.quartz.ee.servlet.QuartzInitializerServlet.init(QuartzInitializerServlet.java:185)

at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:433)

at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:256)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)

at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:616)

at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)

at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)

at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)

at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)

at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:463)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)

at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)

at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)

at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)

at org.mortbay.jetty.Server.doStart(Server.java:222)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)

at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:667)

at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:500)

at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1055)

at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:804)

at com.google.gwt.dev.DevMode.main(DevMode.java:309)

Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory

at java.net.URLClassLoader$1.run(URLClassLoader.java:202)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload$WebAppClassLoaderExtension.findClass(JettyLauncher.java:367)

at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:366)

at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)

... 23 more

   [WARN] failed RequestLogHandler@3e7303e3

java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory

at org.quartz.impl.StdSchedulerFactory.<init>(StdSchedulerFactory.java:274)

at org.quartz.ee.servlet.QuartzInitializerServlet.init(QuartzInitializerServlet.java:185)

at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:433)

at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:256)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)

at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:616)

at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)

at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)

at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)

at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)

at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:463)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)

at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)

at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)

at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)

at org.mortbay.jetty.Server.doStart(Server.java:222)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)

at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:667)

at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:500)

at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1055)

at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:804)

at com.google.gwt.dev.DevMode.main(DevMode.java:309)

Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory

at java.net.URLClassLoader$1.run(URLClassLoader.java:202)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload$WebAppClassLoaderExtension.findClass(JettyLauncher.java:367)

at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:366)

at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)

... 23 more

   [WARN] Error starting handlers

java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory

at org.quartz.impl.StdSchedulerFactory.<init>(StdSchedulerFactory.java:274)

at org.quartz.ee.servlet.QuartzInitializerServlet.init(QuartzInitializerServlet.java:185)

at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:433)

at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:256)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)

at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:616)

at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)

at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)

at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)

at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)

at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:463)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)

at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)

at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)

at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)

at org.mortbay.jetty.Server.doStart(Server.java:222)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)

at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:667)

at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:500)

at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1055)

at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:804)

at com.google.gwt.dev.DevMode.main(DevMode.java:309)

Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory

at java.net.URLClassLoader$1.run(URLClassLoader.java:202)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload$WebAppClassLoaderExtension.findClass(JettyLauncher.java:367)

at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:366)

at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)

... 23 more

And the relevant portion of my pom file:

    <dependency>

    <groupId>org.slf4j</groupId>

    <artifactId>slf4j-api</artifactId>

    <version>1.6.1</version>

    </dependency>

    <dependency>

    <groupId>org.slf4j</groupId>

    <artifactId>slf4j-log4j12</artifactId>

    <version>1.6.1</version>

    </dependency>

    <dependency>

    <groupId>log4j</groupId>

    <artifactId>log4j</artifactId>

    <version>1.2.16</version>

    </dependency>

    <dependency>

        <groupId>org.quartz-scheduler</groupId>

        <artifactId>quartz</artifactId>

        <version>2.0.2</version>

    </dependency>

Again, it DOES run correctly in RUN/Compiled mode, it's in DEV mode from within Eclipse where it falls-down.  I wouldn't worry about it if I didn't need to debug some Quartz tasks at the moment.

Cheers!
Randy
image.png

Juan Pablo Gardella

unread,
Sep 13, 2011, 9:27:16 AM9/13/11
to google-we...@googlegroups.com
Check if you don't have two different version of slf4j or log4j in the classpath at runtime. Perhaps in your project is right, but in jetty perhaphs have other logger version.


2011/9/13 randal cobb <rco...@gmail.com>
image.png

Thomas Broyer

unread,
Sep 13, 2011, 10:43:17 AM9/13/11
to google-we...@googlegroups.com


On Tuesday, September 13, 2011 3:19:42 PM UTC+2, MadOtis wrote:
Thanks for the suggestion, but that doesn't seem to help.  I've added the suggested dependencies both to the project's pom file, and as explicit "User Entries" on the Classpath tab of the "Run configuration" for "Web Application" in Eclipse.  I've confirmed that the version of slf4j I'm using is the same as the requirement for Quartz, too (via "mvn dependency:tree").  Here's some output and a screen-print:

Server-side dependencies should be in your WEB-INF/lib when you launch the DevMode.

As you're working with Maven, see http://code.google.com/eclipse/docs/faq.html#gwt_with_maven (and follow the “If you're not able to use Eclipse for Java EE” steps for the best experience; believe me on this!)

[WARN] Server class 'org.quartz.ee.servlet.QuartzInitializerServlet' could not be found in the web app, but was found on the system classpath

   [WARN] Adding classpath entry 'file:/Volumes/Disk_2/home/cobbr/.m2/repository/org/quartz-scheduler/quartz/2.0.2/quartz-2.0.2.jar' to the web app classpath for this session

   [WARN] failed QuartzInitializer


This is a sign of the above: quartz-2.2.0.jar should be in your WEB-INF/lib at the time you launch the DevMode.
 

java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory

at org.quartz.impl.StdSchedulerFactory.<init>(StdSchedulerFactory.java:274)


And this is likely a side-effect of the above.

randal cobb

unread,
Sep 13, 2011, 11:14:35 AM9/13/11
to google-we...@googlegroups.com
For anyone following the thread, this seems to have been some sort of classpath conflict between the maven plugin for Eclipse and the GWT plugins for Eclipse.  I followed these steps:

Closed and removed the project from Eclipse
via command-line:  "mvn eclipse:clean eclipse:eclipse package"
Import the project back into Eclipse as a plain Java project
Select project and opened the project properties dialogs
Google->Web Toolkit and enabled "Use Google Web Toolkit" (and specified correct GWT SDK version)
Google->Web Application and UNCHECKED "Launch and deploy from this directory"
Right click on project and select "Run as... -> Web Application"
In the popup that displays, I selected the maven target/<web app> folder
Now runs correctly

The small trade-off is, now when I add any new dependencies to the maven pom, I need to run a "maven eclipse:eclipse" followed by a project "refresh" or F5 in Eclipse.  A small trade-off, but definitely usable.

Many thank you's to the group and especially Juan Pablo Gardella!
image.png

randal cobb

unread,
Sep 13, 2011, 11:27:44 AM9/13/11
to google-we...@googlegroups.com
Yes, and that was indeed one of the issues.  I actually had a couple of jars in the WEB-INF/lib folder that SHOULDN'T have been there as well.  I believe the steps outlined in the link you provided are what I did, I just hadn't found or read that section previously (my bad).  And that link is now bookmarked for when I make the same mistake in the future.  ;)

Again, thanks, all!


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
Reply all
Reply to author
Forward
0 new messages