CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Cron Job problems
Pages: [1] 2 3

Author Topic: Cron Job problems  (Read 23520 times)

EdP

  • I post frequently
  • ***
  • Posts: 260
  • Karma: 7
  • CiviCRM version: 4.4
  • CMS version: Joomla 2.5.x
Cron Job problems
June 07, 2012, 02:22:06 pm
Hi,
Since I moved over to 4.1 I haven't had much luck with getting the central cron job to run. I'm on CiviHosting and had a conversation with Hershel at the time, so there is nothing obviously wrong with the set-up. However, on installing 4.1.3 (and deleting and reinstalling the Joomla plugin) I'm getting a different error message which may help.

Symptoms:
1. I can manually run the cron jobs (all or individually) from within the Admin menu. That works fine and the logs look normal.
2. Automated cron shows in the civi cron log as commencing the cron run, but none of the scheduled tasks show as occurring and it doesn't record it closing. The cron is
Code: [Select]
#!/bin/sh
GET 'http://www.marlowrowingclub.org.uk/administrator/components/com_civicrm/civicrm/bin/cron.php?name=NAME&pass=PASS&key=KEY'
3. The cron returns the following error message:

Code: [Select]
<br />
<b>Fatal error</b>:  Call to undefined method JException::triggerEvent() in <b>/home/marlow/www/www/administrator/components/com_civicrm/civicrm/CRM/Utils/Hook/Joomla.php</b> on line <b>58</b><br />

It's true that there is no "triggerEvent()" method of JException listed in the documentation (http://docs.joomla.org/JException/11.1), though line 58 of the ../Joomla.php file is -

Code: [Select]
$result = $app->triggerEvent($fnSuffix, array(&$arg1, &$arg2, &$arg3, &$arg4, &$arg5));

with the "$app" being set just above as:

Code: [Select]
// get app based on cli or web
      if (PHP_SAPI != 'cli') {
        $app = JFactory::getApplication('administrator');
      }
      else {
        $app = JCli::getInstance();
      }

The "triggerEvent" referred to seems to be a function for JCli (http://docs.joomla.org/JCli::triggerEvent/11.1) and JApplication (http://docs.joomla.org/JApplication::triggerEvent/11.1).

 The "JFactory" referred to doesn't seem to apply to Joomla 2.5/Framework 11.1 (http://docs.joomla.org/JFactory) so presumably the JError is coming from a reference to JFactory (not supported in 11.1) and then the line quoted is trying to apply the "triggerEvent" method to JError and we get the message we do.

Looking at what JFactory::getApplication('administrator') did (returned the JApplication object) the nearest replacement looks like JApplication::getPathway   .... but I'm now out of my depth so if anyone understand the workings of the Joomla Framework...?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Cron Job problems
June 07, 2012, 02:35:40 pm

what version of joomla? r u on the latest version, 2.5.4?

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

EdP

  • I post frequently
  • ***
  • Posts: 260
  • Karma: 7
  • CiviCRM version: 4.4
  • CMS version: Joomla 2.5.x
Re: Cron Job problems
June 07, 2012, 03:28:13 pm
Quote from: Donald Lobo on June 07, 2012, 02:35:40 pm

what version of joomla? r u on the latest version, 2.5.4?

lobo

Yes.

bigtalljv

  • I post occasionally
  • **
  • Posts: 32
  • Karma: 1
Re: Cron Job problems
June 19, 2012, 01:08:13 pm
any more information on this?  I am getting the same error.  Upgraded site to civicrm 4.1.3 and j 2.5.4

Thanks,
Jason

effex100

  • I’m new here
  • *
  • Posts: 15
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: Joomla 2.5.9
  • MySQL version: 5.0.96-community
  • PHP version: 5.3
Re: Cron Job problems
June 19, 2012, 01:37:51 pm
I'm having this issue as well - civicrm 4.1.3 and j 2.5.5. It existed using j 2.5.4 as well before upgrade.

I'm using cli.php instead of the URL method so I don't think it's related to the method being used.

effex100

  • I’m new here
  • *
  • Posts: 15
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: Joomla 2.5.9
  • MySQL version: 5.0.96-community
  • PHP version: 5.3
Re: Cron Job problems
June 22, 2012, 01:38:24 pm
This is getting frustrating.

A few people on this forum have reported this problem. Has anyone found a solution? Have an idea what the solution may be? Where to start looking?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Cron Job problems
June 22, 2012, 02:20:17 pm

Unfortunately we dont have too many civicrm + joomla developers contributing towards improving the code / features / fixing bugs with regard to the joomla integration

To make it less frustrating, we need more developers from the joomla ecosystem to help debug and trace issues. If you or your org can help with this issue that would be great. If you dont have developers, consider funding someone to improve and work on the joomla - civi integration.

To help debug this, you should read the developer book: http://book.civicrm.org/developer/

and then potentially trace the cron script

Brian S who does most of the joomla integration work reports that it works on most of his 2.5.x sites but fails on one. So there is something influencing this error


lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

crawdaddyFL

  • I’m new here
  • *
  • Posts: 11
  • Karma: 2
  • CiviCRM version: 4.1.3
  • CMS version: Joomla 2.5.6
  • MySQL version: 5.1.63
  • PHP version: 5.2.17
Re: Cron Job problems
June 23, 2012, 10:12:22 am
I'm new here, but a PHP developer with moderate Joomla/little CiviCRM framework expertise.  I'm in the early stages of a Joomla 2.5.6/CiviCRM 4.1.3 installation, and have run into this error as well while trying to set up the bounce mail processing cron job.

I started tracking the problem down, and am somewhat disturbed to find larger (but possibly unrelated) problems upstream.  Looking at civicrm/CRM/Core/Config.php line 291, this references "global $mainframe" in an attempt to get the database prefix.  This convention was removed in Joomla 1.6, something I learned while porting my site from Joomla 1.5 to the latest 2.5 series.  Therefore, the default prefix value of "jos_" is returned; not applicable to Joomla 2.5.  I haven't looked to see how this is used downstream. 

Back to the issue at hand; because JFactory::getApplication is returning a JException object instead, something about the expected context isn't right. I'll continue on with a root cause analysis to see if I can figure it out.


crawdaddyFL

  • I’m new here
  • *
  • Posts: 11
  • Karma: 2
  • CiviCRM version: 4.1.3
  • CMS version: Joomla 2.5.6
  • MySQL version: 5.1.63
  • PHP version: 5.2.17
Re: Cron Job problems
June 23, 2012, 12:55:43 pm
Found and I think corrected a few things, I think.  Caveats:

1. my site is located in a subdirectory in public_html, and I haven't investigated if that contributed to the issues.
2. This gets me past the "PHP Fatal error:  Call to undefined method JException::triggerEvent()" people are experiencing, but I haven't explored correctness past that. I don't want to spread misinformation so I'd recommend NOT IMPLEMENTING the below until an expert (Brian S?) can vet these changes.

I can't post code snippets as a newbie, I guess (why?) so I'll include the changes inline. I know this isn't the right process - I should formally submit a bug report. Hopefully Brian S can take a look at what I've done here first to see if I'm way off-base.  If I'm not, I'll post a bug report.

civicrm/CRM/Utils/System/Joomla.php function loadBootStrap

1. line 533: joomlaBase needs a trailing slash or it loses the final path component (again, my site's in a subdirectory so maybe that's why)
$joomlaBase = dirname(dirname(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))))) . "/";

2. line 540: JPATH_BASE is set as the administrator path. When JFactory::getApplication("administrator") is later called in civicrm/CRM/Utils/Hook/Joomla.php, if I trace the instantiation through to the JApplication::getInstance method, the path to the JAdministrator application.php has "administrator" twice in it (e.g. "<JPATH_BASE>/administrator/administrator/includes/application.php"). That, of course, fails.  I redefined JPATH_BASE to be the base Joomla path, without "/administrator".  This may be something I don't understand about Joomla and a red herring.
define('JPATH_BASE', $joomlaBase);

3. after line 544: To instantiate the JAdministrator class (e.g. through JFactory::getApplication in Hook/Joomla.php), the JURI class needs to be defined, which it was not. Include that after libraries/import.php:
require $joomlaBase . '/libraries/joomla/environment/uri.php';

That seems to now correctly boostrap Joomla when running the cron script via REST, getting past the 500 error. 



The separate issue I mentioned with the user database prefix seems to be benign for Joomla; doesn't seem to get used.  But a step towards fixing it is:

civicrm/CRM/Core/Config.php function _setUserFrameworkConfig

1. Around line 58, when attempting to set the user table name, change the "global $mainframe" line to:
$mainframe = null;
if(class_exists("JFactory")) $mainframe = & JFactory::getApplication();

This is only a step towards fixing it, not a final solution, since it only applies when running CiviCRM through the Joomla admin console - not when running the cron script directly via URL.  Just wanted to point out that this code is wrong but can be fixed, provided it's not vestigial or unneeded for Joomla.

Regards,
Andy
 

effex100

  • I’m new here
  • *
  • Posts: 15
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: Joomla 2.5.9
  • MySQL version: 5.0.96-community
  • PHP version: 5.3
Re: Cron Job problems
June 25, 2012, 06:00:20 am
Donald, I'm not sure if I have the skills to be much use on that kind of development level but I'll look into it. I know enough about PHP to make basic tweaks and do some debugging. This may be a good excuse to learn more.

I can confirm that crawdaddyFL's fix does seem to work for both the URL and cli.php method.

I'm currently only processing 3 jobs: Send Scheduled Mailings, Process Inbound Emails, Fetch Bounces

I'll post here if I encounter any side effects to the changes in other parts of the system.

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: Cron Job problems
June 27, 2012, 02:28:16 pm
for those getting the triggerEvent error:

# did you move your site recently?
# can you look in: /administrator/components/com_civicrm/civicrm/civicrm.config.php -- and confirm that the location is correct?
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

EdP

  • I post frequently
  • ***
  • Posts: 260
  • Karma: 7
  • CiviCRM version: 4.4
  • CMS version: Joomla 2.5.x
Re: Cron Job problems
June 28, 2012, 06:29:51 am
1. No, haven't moved recently.
2. That file looks fine.

The only thing, on that topic, is that to log into the administrator area of my site isn't just /administrator - you have to put in something else on top (just a plugin to discourage minor hacking efforts). That does not make any difference to most things, but I just mention it if you are worried about paths being correct.

Ed

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Cron Job problems
June 28, 2012, 07:46:27 am

what plugin are you using to do this?

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

EdP

  • I post frequently
  • ***
  • Posts: 260
  • Karma: 7
  • CiviCRM version: 4.4
  • CMS version: Joomla 2.5.x
Re: Cron Job problems
July 01, 2012, 11:30:51 am
We use Admin Exile http://www.richeyweb.com/development/joomla-plugins/71-adminexile-for-joomla-16
and Admin Tools has similar effects: http://extensions.joomla.org/extensions/access-a-security/site-security/site-protection/14087

...but we having been using both of those for a while before the cron job problems (although I may have updated or something).

effex100

  • I’m new here
  • *
  • Posts: 15
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: Joomla 2.5.9
  • MySQL version: 5.0.96-community
  • PHP version: 5.3
Re: Cron Job problems
July 03, 2012, 11:04:54 am
I implemented crawdaddyfl's changes and it worked for a bit.

I upgraded to J 2.5.6 and now I'm getting a different error:


Fatal error: Class 'JDispatcher' not found in .../public_html/libraries/joomla/plugin/helper.php on line 180

any ideas?

Pages: [1] 2 3
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Cron Job problems

This forum was archived on 2017-11-26.