• Cront tab execution error

  • We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #29819  by matt81
 
Hi Guys,
I am experiencing strange behaviour from the Cron tab process.
I upload a .jar file, and when I execute it, by clicking on the flash icon, the code is executed successfully. However when I activate it, and wait for the system to automatically call it, it doesn't work. Do yu know why they behave differently when it is the same code?

I am using com.openkm.servlet.frontend.DocumentServlet, and the following function doesn't work convertToPdf. It doesn't execute successfully

see error log below:
Code: Select all
2014-09-05 00:50:01,246 [Thread-1562] INFO  com.openkm.module.db.stuff.DbSimpleAccessManager- ***************************
2014-09-05 00:50:01,246 [Thread-1562] INFO  com.openkm.module.db.stuff.DbSimpleAccessManager- ***************************
2014-09-05 00:50:01,246 [Thread-1562] WARN  com.openkm.module.db.stuff.DbSimpleAccessManager- com.openkm.module.db.stuff.DbSimpleAccessManager -> isGranted (DbSimpleAccessManager.java:68)
2014-09-05 00:50:01,246 [Thread-1562] WARN  com.openkm.module.db.stuff.DbSimpleAccessManager- com.openkm.module.db.stuff.SecurityHelper -> checkRead (SecurityHelper.java:96)
2014-09-05 00:50:01,246 [Thread-1562] WARN  com.openkm.module.db.stuff.DbSimpleAccessManager- com.openkm.dao.NodeDocumentDAO -> findByPk (NodeDocumentDAO.java:252)
2014-09-05 00:50:01,246 [Thread-1562] WARN  com.openkm.module.db.stuff.DbSimpleAccessManager- com.openkm.dao.NodeDocumentDAO -> findByPk (NodeDocumentDAO.java:230)
2014-09-05 00:50:01,246 [Thread-1562] WARN  com.openkm.module.db.stuff.DbSimpleAccessManager- com.openkm.module.db.DbDocumentModule -> getProperties (DbDocumentModule.java:421)
2014-09-05 00:50:01,246 [Thread-1562] WARN  com.openkm.module.db.stuff.DbSimpleAccessManager- com.openkm.api.OKMDocument -> getProperties (OKMDocument.java:105)
2014-09-05 00:50:01,246 [Thread-1562] WARN  com.openkm.module.db.stuff.DbSimpleAccessManager- com.openkm.servlet.frontend.DocumentServlet -> convertToPdf (DocumentServlet.java:930)
2014-09-05 00:50:01,246 [Thread-1562] WARN  com.openkm.module.db.stuff.DbSimpleAccessManager- com.openkm.util.cl.ClassLoaderUtils -> invokeMethodFromClass (ClassLoaderUtils.java:113)
2014-09-05 00:50:01,246 [Thread-1562] WARN  com.openkm.module.db.stuff.DbSimpleAccessManager- com.openkm.util.ExecutionUtils -> runJar (ExecutionUtils.java:220)
2014-09-05 00:50:01,246 [Thread-1562] WARN  com.openkm.module.db.stuff.DbSimpleAccessManager- com.openkm.core.Cron$RunnerJar -> run (Cron.java:176)
2014-09-05 00:50:01,246 [Thread-1562] INFO  com.openkm.module.db.stuff.DbSimpleAccessManager- ***************************
2014-09-05 00:50:01,246 [Thread-1562] INFO  com.openkm.module.db.stuff.DbSimpleAccessManager- ***************************
2014-09-05 00:50:01,249 [Thread-1562] WARN  com.openkm.servlet.frontend.DocumentServlet- /okm:root/test/newone.pdf
com.openkm.core.PathNotFoundException: /okm:root/test/newone.pdf
	at com.openkm.dao.NodeBaseDAO.calculateUuidFromPath(NodeBaseDAO.java:262)
	at com.openkm.dao.NodeBaseDAO.calculateUuidFromPath(NodeBaseDAO.java:232)
	at com.openkm.dao.NodeBaseDAO.getUuidFromPath(NodeBaseDAO.java:122)
	at com.openkm.module.db.DbDocumentModule.delete(DbDocumentModule.java:300)
	at com.openkm.api.OKMDocument.delete(OKMDocument.java:96)
	at com.openkm.servlet.frontend.DocumentServlet.delete(DocumentServlet.java:208)
                at ConvertTest.deletePDFfromOpenKM(ConvertTest.java:311)
	at ConvertTest.processDocuments(ConvertTest.java:260)
	at ConvertTest.mkDirs(ConvertTest.java:140)
	at ConvertTest.cronTask(ConvertTest.java:78)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at com.openkm.util.cl.ClassLoaderUtils.invokeMethodFromClass(ClassLoaderUtils.java:113)
	at com.openkm.util.ExecutionUtils.runJar(ExecutionUtils.java:220)
	at com.openkm.core.Cron$RunnerJar.run(Cron.java:176)
	at java.lang.Thread.run(Thread.java:744)

Thanks
 #29838  by jllort
 
I supect. When you execute ( flash icon ) are using your environement user ( token= null and take your user) but when is executed internally token is still null and not user logged. In api call you should use token = systemToken
Code: Select all
Sting systemToken = DbSessionManager.getInstance().getSystemToken();
 #29847  by matt81
 
Thanks for your reply.
Yes I am using the system token, and it doesn't work. It stops when it comes to the following method ConvertToPdf from DocumentServlet class.
Not sure why that would happen, as there is no difference whether you are using an environment or system variable.

Thanks
 #29859  by pavila
 
Please, tell me which OpenKM version are you using and post the source code for testing.
 #29884  by matt81
 
Thanks for your reply.
I am using Comuunity version 6.3.0, see code below:
Code: Select all
public static void convertToPdf(String openkmPath, DocumentServlet cm){
		try {	
			cm.convertToPdf(openkmPath); 
		}catch (Exception e) {
			System.out.println("Exception: " + e.getMessage());
		}
Let me know what could be the problem, as I said it works perefectly fine when I click on the execute icon.

Thanks
 #29927  by matt81
 
Thanks for your reply.
No it didn't work with the new nightly build.
I didn't get an error in the log file, but still it didn't work.
Code: Select all
2014-09-15 23:40:00,523 [Thread-30] WARN  com.openkm.module.db.stuff.DbSimpleAccessManager- com.openkm.module.db.stuff.SecurityHelper -> checkRead (SecurityHelper.java:96)
2014-09-15 23:40:00,523 [Thread-30] WARN  com.openkm.module.db.stuff.DbSimpleAccessManager- com.openkm.dao.NodeDocumentDAO -> findByPk (NodeDocumentDAO.java:252)
2014-09-15 23:40:00,523 [Thread-30] WARN  com.openkm.module.db.stuff.DbSimpleAccessManager- com.openkm.dao.NodeDocumentDAO -> findByPk (NodeDocumentDAO.java:230)
2014-09-15 23:40:00,523 [Thread-30] WARN  com.openkm.module.db.stuff.DbSimpleAccessManager- com.openkm.module.db.DbDocumentModule -> getProperties (DbDocumentModule.java:421)
2014-09-15 23:40:00,523 [Thread-30] WARN  com.openkm.module.db.stuff.DbSimpleAccessManager- com.openkm.util.impexp.RepositoryExporter -> exportDocument (RepositoryExporter.java:269)
2014-09-15 23:40:00,523 [Thread-30] WARN  com.openkm.module.db.stuff.DbSimpleAccessManager- com.openkm.util.cl.ClassLoaderUtils -> invokeMethodFromClass (ClassLoaderUtils.java:113)
2014-09-15 23:40:00,523 [Thread-30] WARN  com.openkm.module.db.stuff.DbSimpleAccessManager- com.openkm.util.ExecutionUtils -> runJar (ExecutionUtils.java:220)
2014-09-15 23:40:00,524 [Thread-30] WARN  com.openkm.module.db.stuff.DbSimpleAccessManager- com.openkm.core.Cron$RunnerJar -> run (Cron.java:176)
2014-09-15 23:40:00,524 [Thread-30] INFO  com.openkm.module.db.stuff.DbSimpleAccessManager- ***************************
2014-09-15 23:40:00,524 [Thread-30] INFO  com.openkm.module.db.stuff.DbSimpleAccessManager- ***************************
 #29928  by pavila
 
Did you delete the $TOMCAT_HOME/webapps/OpenKM directory before starting Tomcat again?
 #29946  by matt81
 
Thanks for your reply.
I deleted the OpenKM.war file and that folder was deleted as well. And I still experience the same issue, it doesn't work.
Does OpenKM do any caching, and if so, what is the path to the folder?

Thanks

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.