plugin-dotcms-timed-content-unlock not working in dotCMS 4

61 views
Skip to first unread message

dile...@gmail.com

unread,
Aug 24, 2017, 6:16:36 AM8/24/17
to dotCMS User Group
Hi,

We've been always using the timed content unlock plugin in dotCMS 3.X (see https://github.com/dotCMS/plugin-dotcms-timed-content-unlock)

Since dotCMS 4 this plugin isn't working anymore, even though we are deploying the version that should be compatible with dotCMS 4 (see branch master-4.0)

When the job tries to run the following error is thrown:

[24/08/17 11:13:00:080 BST]  INFO job.UnlockContentTimer: Timed Unlock: ------------------------------------------
[24/08/17 11:13:00:093 BST] ERROR core.JobRunShell: Job OSGi Jobs.Unlock locked content based on a timer threw an unhandled Exception: 
java.lang.NoClassDefFoundError: com/dotcms/job/OSGiPluginProperties
at com.dotcms.job.UnlockContentTimer.execute(UnlockContentTimer.java:29) ~[?:?]
at org.quartz.core.JobRunShell.run(JobRunShell.java:223) [dot.quartz-all-1.8.6_2.jar:?]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549) [dot.quartz-all-1.8.6_2.jar:?]
Caused by: java.lang.ClassNotFoundException: com.dotcms.job.OSGiPluginProperties
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1285) ~[catalina.jar:8.5.15]
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119) ~[catalina.jar:8.5.15]
... 3 more

Any advice?

Thank you!

Nathan Keiter

unread,
Aug 24, 2017, 9:21:10 AM8/24/17
to dot...@googlegroups.com

3.x plugins are not compatible with 4.x.

 

You will need to update the build.gradle to point at the correct maven source repo.

 

Also, you will likely need to update imports due to “repackage” class location changes. (Yet again. Hopefully they’ve made up their mind and these won’t move again.)

 

Nathan I. Keiter | Lead Network Applications Programmer | Benefits Advisory Council Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/ff9422e9-4820-4b15-b1e1-07917335559a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nathan Keiter

unread,
Aug 24, 2017, 9:38:40 AM8/24/17
to dot...@googlegroups.com

Oh, my mistake.  Looking at the link you provided it seems you are using the 4.0 version.

 

Did you try uploading it in eclipse to check dependencies?

 

Also, I’d stay away from OSGI quartz jobs.  They are unreliable.

 

Restarting the server might give you a temporary fix, but it could go silly again.  Something having to do with the quartz engine running in core, but the classes for OSGI sometimes get “lost” or inaccessible to quartz over time.  You have to really stay on top of it, or you could go a whole month without realizing your job isn’t firing anymore.

 

cron fired servlets are much more reliable. I don’t have a 4.x example uploaded yet., but here’s a 3.x example: https://github.com/nkeiter/generic-dotCMS-plugin-code-examples/tree/master/dotcms3.5.1/osgi/org.example.nkeiter.ip.restricted.servlet

 

Basically from the context of the server, you hit the URL.  The server’s own IP should be the only one that works. (You have to configure that.) https://github.com/nkeiter/generic-dotCMS-plugin-code-examples/blob/master/dotcms3.5.1/osgi/org.example.nkeiter.ip.restricted.servlet/src/main/java/org/example/nkeiter/ip/restricted/servlet/servlet/IpRestrictedServlet.java

 

Nathan I. Keiter | Lead Network Applications Programmer | Benefits Advisory Council Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

dile...@gmail.com

unread,
Aug 24, 2017, 10:33:45 AM8/24/17
to dotCMS User Group
The plugin can't find his own class, while the class is there. Which dependencies should I check in this case?

Tnx

Op donderdag 24 augustus 2017 15:38:40 UTC+2 schreef Nathan Keiter:

Nathan Keiter

unread,
Aug 24, 2017, 10:36:52 AM8/24/17
to dot...@googlegroups.com

Does a restart fix the issue?  If it does, then you are chasing a quartz ghost.

 

I mean just make sure there’s no red lines in eclipse, meaning eclipse thinks it should compile.

 

Nathan I. Keiter | Lead Network Applications Programmer | Benefits Advisory Council Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

Nathan Keiter

unread,
Aug 24, 2017, 10:37:59 AM8/24/17
to dot...@googlegroups.com

If it’s inconvenient to restart the dotCMS, you could try restarting the OSGI framework as a pre-test.

 

Nathan I. Keiter | Lead Network Applications Programmer | Benefits Advisory Council Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

dile...@gmail.com

unread,
Aug 25, 2017, 3:14:56 AM8/25/17
to dotCMS User Group
The project is compiling and there are no errors or red lines.

I've tried restarting dotCMS and the OSGI framework, unfortunately with no result.



Op donderdag 24 augustus 2017 16:37:59 UTC+2 schreef Nathan Keiter:

Jason Tesser

unread,
Aug 25, 2017, 8:36:56 AM8/25/17
to dotCMS User Group
Yea our plugins aren't always updated on release of the CMS. It happens over time. It was removed because we are making some 4.x fixes to it.  It should be back with a working 4.x version pretty soon 

Will Ezell

unread,
Aug 25, 2017, 8:42:44 AM8/25/17
to dot...@googlegroups.com
So we updated the master branch and it should now work on 4.x.  


Please try that and let us know your results.

Thanks,

Will

To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+unsubscribe@googlegroups.com.

To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/05bda630-c6ed-41b0-b230-44b27db725d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+unsubscribe@googlegroups.com.

To post to this group, send email to dot...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--






3059 Grand Avenue
Suite 410-B
Miami FL 33133
Main: 
305-900-2001 | Direct: 978.294.9429

   

dile...@gmail.com

unread,
Aug 28, 2017, 7:23:47 AM8/28/17
to dotCMS User Group
Hi Will,

I've just checked the GitHub page and I noticed that build.gradle file points to an older dotCMS (3.2) version, see https://github.com/dotCMS/plugin-dotcms-timed-content-unlock/blob/master/build.gradle

Maybe it isn't pushed yet?

Thanks!

Op vrijdag 25 augustus 2017 14:42:44 UTC+2 schreef Will Ezell:

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.

Jason Tesser

unread,
Aug 28, 2017, 9:02:19 AM8/28/17
to dotCMS User Group
should be 4.1 BUT this is just compile time for what it is worth and won't effect much 

dile...@gmail.com

unread,
Aug 28, 2017, 11:21:07 AM8/28/17
to dotCMS User Group
Unable to deploy the repo to dotCMS 4.1.1

When I change the dotCMS version in the gradle build file to 4.1.1 and update the OSGi framework imports I'm able to deploy it, but that still doesn't work...

Op maandag 28 augustus 2017 15:02:19 UTC+2 schreef LORDs_diakonos:

Nathan Keiter

unread,
Aug 28, 2017, 11:23:08 AM8/28/17
to dot...@googlegroups.com

Did you re-compile first?

dile...@gmail.com

unread,
Aug 29, 2017, 4:43:45 AM8/29/17
to dotCMS User Group
Yes

Op maandag 28 augustus 2017 17:23:08 UTC+2 schreef Nathan Keiter:

Jason Tesser

unread,
Aug 29, 2017, 9:04:50 AM8/29/17
to dotCMS User Group
would need to help us by telling us exactly what problems you are getting. When you deploy what errors are you getting?  

Chris Falzone

unread,
Aug 29, 2017, 10:34:37 AM8/29/17
to dotCMS User Group
So, I have heard a lot of hate on QUARTZ lately.  QUARTZ runs in the main classloader, it would make perfect sense that it cannot "see" classes deployed to your OSGI Bundle's Classloader.  You have to expose those classes to the main classloader in order for it work.  The process for exposing classes in OSGI is what is unreliable, not QUARTZ itself.  It goes against the philosophy of Felix OSGI to allow things outside of your bundle to "see" things inside your bundle, so that sort of makes sense when you keep that in mind.  

I do feel, however, that the process of exposing classes inside your bundle to the main classloader is much more stable with the move to ByteBuddy in the latest version.  

Nathan's solution of using cron to hit a servlet is similar to what we do.  We use QUARTZ to hit the servlet instead and that has been working flawlessly since OSGI was introduced back in 2x.  Another option to resolve the issue of classloading for quartz jobs is to deploy your own quartz instance inside of your bundle.  Perhaps a little overkill, but it would resolve the issue I think.

Just wanted to clear the air there ... QUARTZ is not unreliable, it is used in many cases around the world, is hardened in a lot of environments and it highly community supported.  The instability of this is how dotCMS is using Felix OSGI to expose classes as a convenience to us as developers, which is not a thing that Felix OSGI wants you to do.  The whole philosophy there is that everything is contained and protected in your bundle.  

Rant Over :P


Jason Tesser

unread,
Aug 29, 2017, 10:43:37 AM8/29/17
to dotCMS User Group
I hear you Chris. It really isn't that OSGi and Quartz is unreliable as much as the classpath is complex and it requires understanding of what is happening which can be confusing in the case of Quartz.  

We made some improvements here and have tested this plugin. So it should work 

Nathan Keiter

unread,
Aug 29, 2017, 11:01:08 AM8/29/17
to dot...@googlegroups.com

Yes Chris. Quartz is fine, I was just speaking to the combination of dotCMS + OSGI + Quartz.  In fact static plugins should work fine with Quartz.  In our experience the OSGI ones mysteriously stop firing after random time intervals. At this point I try to do everything in OSGI, and only have configuration plugins be static.

 

I’d love to see uptime stats on OSGI quartz for 4.x.  Perhaps a job that writes to the DB once per day, then it could be audited to see if it’s still firing.

 

Nathan I. Keiter | Lead Network Applications Programmer | Benefits Advisory Council Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

Maarten Daalder

unread,
Aug 29, 2017, 11:02:21 AM8/29/17
to dotCMS User Group
Perhaps the situation could be improved by creating a go-between/bridge service between the Quartz and OSGi classloaders?
The OSGi plugin could retrieve the service and then register a class (that the plugin loaded itself) with Quartz to run. The binding could probably also listen for plugin deactivation to remove the job.

It's been a while since I implemented embedded Quartz in a dotCMS plugin. :)

With kind regards,
Maarten Daalder
ISAAC

Chris Falzone

unread,
Aug 29, 2017, 2:58:05 PM8/29/17
to dot...@googlegroups.com
I’d love to see uptime stats on OSGI quartz for 4.x.  Perhaps a job that writes to the DB once per day, then it could be audited to see if it’s still firing.

My Quartz Jobs enter something in the logs every time they runs\.  I write a message when the job starts and when it ends.  I just queried the logs for our 2 Quartz Jobs that run every 30 mins each.   They have not missed a single run in 120 days on either production node. 96 runs each every day (2 times per hour / 2 servers).  Granted we are currently running 3.7 not 4.x and all they do is make an http request over localhost to the servlet that does all the work.  In fact, I cannot recall an instance where our importer or integrity checker jobs failed to run because of quartz failing to run the job.


Nathan Keiter

unread,
Aug 29, 2017, 3:34:54 PM8/29/17
to dot...@googlegroups.com

Cool.  Is that on Windows JVM or Linux JVM?

 

I’m wondering if a more complex job with more classes to load would cause issues?

 

Anyway, glad to hear it’s stable for you on 3.7. Maybe I’ll try it in the future on something not mission critical.

 

Nathan I. Keiter | Lead Network Applications Programmer | Benefits Advisory Council Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

Will Ezell

unread,
Aug 29, 2017, 5:59:23 PM8/29/17
to dot...@googlegroups.com
FWIW, I made some commits.  The Timed Unlock Content plugin should work now in the 4.x series:

https://github.com/dotCMS/plugin-dotcms-timed-content-unlock

To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+unsubscribe@googlegroups.com.


To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/5f0bb389-1d55-408e-a595-a7b5d462a537%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.

To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+unsubscribe@googlegroups.com.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+unsubscribe@googlegroups.com.

To post to this group, send email to dot...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

dile...@gmail.com

unread,
Aug 30, 2017, 11:02:40 AM8/30/17
to dotCMS User Group
I ran a fresh dotCMS instance on my local pc, checked out the master repo with the changes for dotCMS4, but still getting the same exception?


Op dinsdag 29 augustus 2017 23:59:23 UTC+2 schreef Will Ezell:

To post to this group, send email to do...@googlegroups.com.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.

To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.

jonathan...@dotcms.com

unread,
Aug 30, 2017, 12:37:00 PM8/30/17
to dotCMS User Group
Hi, 

I suspect you had the plugin previously installed, the previous cron probably were wired to a different class name, my advise is to delete the current cron job and try to install the plugin again, if you see the classpath on master has changed to

com/dotcms/job/OSGiPluginProperties is not longer valid

Best,

dile...@gmail.com

unread,
Sep 11, 2017, 4:54:37 AM9/11/17
to dotCMS User Group
Hi,

I tried the master branch on a new dotCMS installation (fresh download), and it still doesn't work :(

Op woensdag 30 augustus 2017 18:37:00 UTC+2 schreef jonathan...@dotcms.com:
Reply all
Reply to author
Forward
0 new messages