Search code examples
osgiliferayquartz-graphics

Problem using Quartz library in Liferay/Glassfish with Vaadin


I am facing a weird problem to get the Quartz library run in my liferay portal in Glassfish server. The application is divided into two parts a Vaadin based web app which will start/stop the quartz job and another which contains the jobs logic.

As the job logic part is dependent on the Job interface I have to deploy the Quartz as an osgi library. By doing that everything works fine and my web application can see the installed job module but at the time of starting the job it gives following error.

previously initiated loading for a different type with name "org/quartz/Trigger"

I guess this comes because I have given the Quartz library in my web-inf/lib as well. But if I remove that it throws another error for Quartz dependencies.

The only possible solution I have right now is to remove the Quartz dependencies from the second component which has the job business logic (rather implements org.quartz.Job; create another interface).

Is there any other way to sort this out???


Solution

  • Trying fixing your quartz dependencies in the WAR file - use import-package and remove the 2nd quartz from WEB-INF/lib.

    Also make sure the quartz dependency is actually a bundle or that you are dynamically wrapping it.

    It sounds like you have classloading issues due to multiple copies of Trigger. The error message is quartz telling you it's loaded Trigger from a different classloader than previously. You definitely don't want two identical versions of a jar in your app.