Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

[dev.icinga.com #635] AgaviConfigurationException - error validating icinga-web/app/config/settings.xml #126

Closed
icinga-migration opened this issue Jul 24, 2010 · 12 comments
Labels
Milestone

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/635

Created by Anonymous on 2010-07-24 09:57:14 +00:00

Assignee: (none)
Status: Resolved (closed on 2010-08-20 17:39:50 +00:00)
Target Version: 1.0.3
Last Update: 2010-08-20 17:39:50 +00:00 (in Redmine)


The latest revision from git gives an exception.
Git rev: ca2a09e
The following configure parameters for icinga-web: --prefix=/opt/icinga-web --with-icinga-api=/opt/icinga-core/share/icinga-api

Error:

[Sat Jul 24 11:32:13 2010] [error] [client 192.168.1.101] PHP Fatal error:  Uncaught exception 'AgaviConfigurationException' with message 'The XSL extension for PHP is used by Agavi for performing transformations in the configuration system; this may be disabled by setting
AgaviConfig::set('core.skip_config_transformations', true);
before calling
Agavi::bootstrap();
in index.php (app/config.php is not the right place for this).

As a result, you *will* have to use the latest configuration file formats and namespaces as backwards compatibility is implemented through XSLT. Also, certain additional configuration file validations implemented via Schematron will not be performed.' in /opt/icinga-web/lib/agavi/src/config/AgaviConfigCache.class.php:408
Stack trace:

#0 /opt/icinga-web/lib/agavi/src/config/AgaviConfigCache.class.php(109): AgaviConfigCache::loadConfigHandlers()
#1 /opt/icinga-web/lib/agavi/src/config/AgaviConfigCache.class.php(80): AgaviConfigCache::setupHandlers()
#2 /opt/icinga-web/lib/agavi/src/config/AgaviConfigCache.class.php(243): AgaviConfigCache::callHandler('/opt/icin in /opt/icinga-web/lib/agavi/src/config/AgaviConfigCache.class.php on line 408
@icinga-migration
Copy link
Author

Updated by Anonymous on 2010-07-24 09:57:57 +00:00

This is when I try to access the portal for the first time.

@icinga-migration
Copy link
Author

Updated by Anonymous on 2010-07-24 16:06:27 +00:00

I've gone back a few revisions, they all appear to have the issue. (or my VM for that matter).

Doing what it says, adding AgaviConfig::set('core.skip_config_transformations', true); in icinga-web/pub/index.php before bootstrap, does not solve this error. Instead I get a new error:

[Sat Jul 24 18:03:02 2010] [error] [client 192.168.1.101] PHP Fatal error:  Uncaught exception 'AgaviParseException' with message 'Validation of configuration file "/opt/icinga-web/app/config/settings.xml" failed:

XML Schema validation of configuration file "/opt/icinga-web/app/config/settings.xml" failed:

XML Schema validation with "/opt/icinga-web/lib/agavi/src/config/xsd/settings.xsd" failed due to the following errors: 

[Warning #3083] Line 14: Element '{http://www.w3.org/2001/XMLSchema}import': Skipping import of schema located at '/opt/icinga-web/lib/agavi/src/config/xsd/_envelope.xsd' for the namespace 'http://agavi.org/agavi/config/global/envelope/1.0', since this namespace was already imported with the schema located at '/opt/icinga-web/lib/agavi/src/config/xsd/settings.xsd'.

[Error #1871] Line 5: Element '{http://agavi.org/agavi/1.0/config}settings': This element is not expected. Expected is one of ( {http://agavi.org/agavi/config/parts/settings/1.0}exception_templates, {http://agavi.org/agavi/config/parts/settings/1.0}exception_template, {http://agavi.org/agavi/config/ in /opt/icinga-web/lib/agavi/src/config/AgaviXmlConfigParser.class.php on line 726

@icinga-migration
Copy link
Author

Updated by Anonymous on 2010-07-27 15:05:19 +00:00

I found a user who shared the same issue as me on the Icinga user mailinglist.

It seems related to the parameter for PHP named open_basedir, a security feature to prevent php scripts from being able to exploit scripts in other places on the same machine.

The issue for the user was solved by editing open_basedir in PHP.ini.
According to the docs, you can also do it on a virtual host basis, using the following parameter, assuming icinga-api is in /opt/icinga/share/icinga-api and that icinga-web is in /opt/icinga-web:

    php_admin_value open_basedir "/opt/icinga/share/icinga-api/:/opt/icinga-web/"

Take note of that : separates the different path's, and also take note that if you do it in PHP.ini, I suggest you append it to the existing, not overwriting, you might break some other functionality in the process on any other pages you host on the same machine.

But!
The issue has not been solved for me. open_basedir was not set, and setting it to something purposefully wrong gives errors in the log. Setting it "properly", no errors in log but the error regarding write permissions continue to flood my log for every attempt to enter the site.

@icinga-migration
Copy link
Author

Updated by Anonymous on 2010-07-28 13:49:20 +00:00

  • Subject changed from Latest git rev gives exception to AgaviConfigurationException in PHP 5.3.2

@icinga-migration
Copy link
Author

Updated by Anonymous on 2010-07-28 16:47:26 +00:00

  • Subject changed from AgaviConfigurationException in PHP 5.3.2 to AgaviConfigurationException - error validating icinga-web/app/config/settings.xml

I set up a new environment on Debian Lenny(the previous was OpenSuse 11.3 with PHP 5.3.2), a nice new error handler in the newest git revision :)

Env:
Debian Lenny 5.5, using PHP 5.2.6-1+lenny8
Fresh git revision of both core(api too) and web.
Icinga core compiled to /opt/icinga-core
Icinga API is located here: /opt/icinga-core/share/icinga-api
Icinga web installed to /opt/icinga-web

AgaviParseException






            This is an internal Agavi exception. Please consult the documentation for assistance with solving this issue.



An exception of type AgaviParseException was thrown, but did not get caught during the execution of the request. You will find information provided by the exception along with a stack trace below.






            Validation of configuration file "/opt/icinga-web/app/config/settings.xml" failed:



XML Schema validation of configuration file "/opt/icinga-web/app/config/settings.xml" failed:



XML Schema validation with "/opt/icinga-web/lib/agavi/src/config/xsd/settings.xsd" failed due to the following errors: 



[Warning #3083] Line 14: Element '{http://www.w3.org/2001/XMLSchema}import': Skipping import of schema located at '/opt/icinga-web/lib/agavi/src/config/xsd/_envelope.xsd' for the namespace 'http://agavi.org/agavi/config/global/envelope/1.0', since this namespace was already imported with the schema located at '/opt/icinga-web/lib/agavi/src/config/xsd/settings.xsd'.



[Error #1871] Line 5: Element '{http://agavi.org/agavi/1.0/config}settings': This element is not expected. Expected is one of ( {http://agavi.org/agavi/config/parts/settings/1.0}exception_templates, {http://agavi.org/agavi/config/parts/settings/1.0}exception_template, {http://agavi.org/agavi/config/parts/settings/1.0}system_action, {http://agavi.org/agavi/config/parts/settings/1.0}setting, {http://agavi.org/agavi/config/parts/settings/1.0}settings, {http://agavi.org/agavi/config/parts/settings/1.0}system_actions ).




Stack Trace




   1.           at exception origin
      in core.agavi_dir/config/AgaviXmlConfigParser.class.php line 726
       723.     }

       724.     

       725.     if($errors) {

       726.
                  throw new AgaviParseException(sprintf('Validation of configuration file "%s" failed:' . "\n\n%s", $document->documentURI, implode("\n\n", $errors)));

       727.     }

       728.   }

       729.  


   2.           at AgaviXmlConfigParser::validate([object AgaviXmlConfigDomDocument], 'development', NULL, array('relax_ng' => array(), 'schematron' => array(), 'xml_schema' => array('/opt/icinga-web/lib/agavi … c/config/xsd/settings.xsd')))
      in core.agavi_dir/config/AgaviXmlConfigParser.class.php line 437
       434.     }

       435.     

       436.     // validate post-transformation

       437.
                self::validate($this->doc, $this->environment, $this->context, $validationInfo[AgaviXmlConfigParser::STEP_TRANSFORMATIONS_AFTER]);

       438.     

       439.     // clean up the document

       440.     self::cleanup($this->doc);


   3.           at AgaviXmlConfigParser->execute(array('/opt/icinga-web/lib/agavi … c/config/xsl/settings.xsl'), array('transformations_before' => array('relax_ng' => array(), 'schematron' => array(), 'xml_schema' => array()), 'transformations_after' => array('relax_ng' => array(), 'schematron' => array(), 'xml_schema' => array('/opt/icinga-web/lib/agavi … c/config/xsd/settings.xsd'))))
      in core.agavi_dir/config/AgaviXmlConfigParser.class.php line 217
       214.     while($nextPath !== null) {

       215.       // run the single stage parser

       216.       $parser = new AgaviXmlConfigParser($nextPath, $environment, $context);

       217.
                  $doc = $parser->execute($transformationInfo[self::STAGE_SINGLE], $validationInfo[self::STAGE_SINGLE]);

       218.       

       219.       // put the new document in the list

       220.       $docs[] = $doc;


   4.           at AgaviXmlConfigParser::run('/opt/icinga-web/app/config/settings.xml', 'development', NULL, array('single' => array('/opt/icinga-web/lib/agavi … c/config/xsl/settings.xsl'), 'compilation' => array()), array('single' => array('transformations_before' => array('relax_ng' => array(), 'schematron' => array(), 'xml_schema' => array()), 'transformations_after' => array('relax_ng' => array(), 'schematron' => array(), 'xml_schema' => array('/opt/icinga-web/lib/agavi … c/config/xsd/settings.xsd'))), 'compilation' => array('transformations_before' => array('relax_ng' => array(), 'schematron' => array(), 'xml_schema' => array()), 'transformations_after' => array('relax_ng' => array(), 'schematron' => array(), 'xml_schema' => array()))))
      in core.agavi_dir/config/AgaviConfigCache.class.php line 183
       180.     if($handler instanceof AgaviIXmlConfigHandler) {

       181.       // a new-style config handler

       182.       // it does not parse the config itself; instead, it is given a complete and merged DOM document

       183.
                  $doc = AgaviXmlConfigParser::run($config, AgaviConfig::get('core.environment'), $context, $handlerInfo['transformations'], $handlerInfo['validations']);

       184.  

       185.       if($context !== null) {

       186.         $context = AgaviContext::getInstance($context);


   5.           at AgaviConfigCache::executeHandler('/opt/icinga-web/app/config/settings.xml', NULL, array('class' => 'AgaviSettingConfigHandler', 'parameters' => array(), 'transformations' => array('single' => array('/opt/icinga-web/lib/agavi … c/config/xsl/settings.xsl'), 'compilation' => array()), 'validations' => array('single' => array('transformations_before' => array('relax_ng' => array(), 'schematron' => array(), 'xml_schema' => array()), 'transformations_after' => array('relax_ng' => array(), 'schematron' => array(), 'xml_schema' => array('/opt/icinga-web/lib/agavi … c/config/xsd/settings.xsd'))), 'compilation' => array('transformations_before' => array('relax_ng' => array(), 'schematron' => array(), 'xml_schema' => array()), 'transformations_after' => array('relax_ng' => array(), 'schematron' => array(), 'xml_schema' => array())))))
      in core.agavi_dir/config/AgaviConfigCache.class.php line 94
        91.       throw new AgaviConfigurationException($error);

        92.     }

        93.     

        94.
                $data = self::executeHandler($config, $context, $handlerInfo);

        95.     self::writeCacheFile($config, $cache, $data, false);

        96.   }

        97.  


   6.           at AgaviConfigCache::callHandler('/opt/icinga-web/app/config/settings.xml', '/opt/icinga-web/app/config/settings.xml', '/opt/icinga-web/app/cache … db57c8e66ed5372fbacde.php', NULL)
      in core.agavi_dir/config/AgaviConfigCache.class.php line 243
       240.  

       241.     if(self::isModified($filename, $cache)) {

       242.       // configuration file has changed so we need to reparse it

       243.
                  self::callHandler($config, $filename, $cache, $context);

       244.     }

       245.  

       246.     return $cache;


   7.           at AgaviConfigCache::checkConfig('/opt/icinga-web/app/config/settings.xml', NULL)
      in core.agavi_dir/config/AgaviConfigCache.class.php line 339
       336.    */

       337.   public static function load($config, $context = null, $once = true)

       338.   {

       339.
                $cache = self::checkConfig($config, $context);

       340.  

       341.     if($once) {

       342.       include_once($cache);


   8.           at AgaviConfigCache::load('/opt/icinga-web/app/config/settings.xml')
      in core.agavi_dir/core/Agavi.class.php line 147
       144.       AgaviConfig::set('core.cldr_dir', AgaviConfig::get('core.agavi_dir') . '/translation/data', false, true);

       145.  

       146.       // load base settings

       147.
                  AgaviConfigCache::load(AgaviConfig::get('core.config_dir') . '/settings.xml');

       148.  

       149.       // clear our cache if the conditions are right

       150.       if(AgaviConfig::get('core.debug')) {


   9.           at Agavi::bootstrap('development')
      in /opt/icinga-web/pub/index.php line 21
        18. // | By default the 'development' environment sets Agavi into a debug mode.    |

        19. // | In debug mode among other things the cache is cleaned on every request.   |

        20. // +---------------------------------------------------------------------------+

        21.
            Agavi::bootstrap('development');

        22.  

        23. // Setting the running context to web ...

        24. AgaviConfig::set('core.default_context', 'web');






Version Information





Agavi:


    1.0.3

PHP:


    5.2.6-1+lenny8

System:


    Linux deb-icinga 2.6.26-2-686 #1 SMP Mon Jun 21 05:58:44 UTC 2010 i686

Timestamp:


    2010-07-28T16:30:54+0000

@icinga-migration
Copy link
Author

Updated by Anonymous on 2010-08-08 13:32:23 +00:00

  • Status changed from New to Resolved
  • Target Version set to 1.0.3

The issue has been solved, checked out the newest revision, which got me a bit further.

1: In httpd.conf, AllowOverride must be set to All, else the rewrite module will not work.
2: The symlink to icingaApi didnt work as intended, hardcoding the path made it work(it didnt give any errors when it was symlinked)
3: Enable shorttags!!!!!

@icinga-migration
Copy link
Author

Updated by Hawkmoon on 2010-08-20 11:16:10 +00:00

Hello,
I've just installed icinga-web v1.0.3 and I have the same issue.

First, I add this one :

PHP Fatal error:  Uncaught exception 'AgaviConfigurationException' with message 'The XSL extension for PHP is used by Agavi for performing transformations in the configuration system; this may be disabled by setting
AgaviConfig::set('core.skip_config_transformations', true);
before calling\nAgavi::bootstrap();
in index.php (app/config.php is not the right place for this).

As a result, you *will* have to use the latest configuration file formats and namespaces as backwards compatibility is implemented through XSLT. Also, certain additional configuration file validations implemented via Schematron will not be performed.' in /usr/local/icinga-web/lib/agavi/src/config/AgaviConfigCache.class.php:408\nStack trace:

#0 /usr/local/icinga-web/lib/agavi/src/config/AgaviConfigCache.class.php(109): AgaviConfigCache::loadConfigHandlers()
#1 /usr/local/icinga-web/lib/agavi/src/config/AgaviConfigCache.class.php(80): AgaviConfigCache::setupHandlers()
#2 /usr/local/icinga-web/lib/agavi/src/config/AgaviConfigCache.class.php(243): AgaviConfigCache in /usr/local/icinga-web/lib/agavi/src/config/AgaviConfigCache.class.php on line 408
I added the line
AgaviConfig::set('core.skip_config_transformations', true);

in the index.php after the require statements.

Now, the messages are

PHP Fatal error:  Uncaught exception 'AgaviParseException' with message 'Validation of configuration file "/usr/local/icinga-web/app/config/settings.xml" failed:

XML Schema validation of configuration file "/usr/local/icinga-web/app/config/settings.xml" failed:

XML Schema validation with "/usr/local/icinga-web/lib/agavi/src/config/xsd/settings.xsd" failed due to the following errors: 

[Warning #3083] Line 14: Element '{http://www.w3.org/2001/XMLSchema}import': Skipping import of schema located at '/usr/local/icinga-web/lib/agavi/src/config/xsd/_envelope.xsd' for the namespace 'http://agavi.org/agavi/config/global/envelope/1.0', since this namespace was already imported with the schema located at '/usr/local/icinga-web/lib/agavi/src/config/xsd/settings.xsd'.

[Error #1871] Line 5: Element '{http://agavi.org/agavi/1.0/config}settings': This element is not expected. Expected is one of ( {http://agavi.org/agavi/config/parts/settings/1.0}exception_templates, {http://agavi.org/agavi/config/parts/settings/1.0}exception_template, { in /usr/local/icinga-web/lib/agavi/src/config/AgaviXmlConfigParser.class.php on line 726

I checked the Allowoverride, the shorttags, changed the open_basedir in both /etc/php5/apache2/php.ini et /etc/php5/cli/php.ini, added the paragraph in the right apache conf file.

Running on Ubuntu server Lucid Lynx
PHP 5.3.2-1ubuntu4.2 with Suhosin-Patch (cli) (built: May 13 2010 20:01:00)

@icinga-migration
Copy link
Author

Updated by Anonymous on 2010-08-20 11:32:34 +00:00

using SSH or on the terminal, cd into the root dir of icinga-web

php bin/testdeps.php

That will test the dependencies.

Also, can you check if you have php-xsl (or php5-xsl) installed?

@icinga-migration
Copy link
Author

Updated by Anonymous on 2010-08-20 11:32:51 +00:00

  • Status changed from Resolved to Assigned

@icinga-migration
Copy link
Author

Updated by Hawkmoon on 2010-08-20 16:11:51 +00:00

I ran the tests. I had a lots of FAIL. They are all OK, now.

But the error remains the same, even after restarting Apache. Blank page.

@icinga-migration
Copy link
Author

Updated by Hawkmoon on 2010-08-20 16:33:09 +00:00

I must apologize. It's ok now.
I corrected all the FAIL, read the install doc (RTFM!!), remove the change I previously made in the index.php

I'm really sorry for the time wasted...

@icinga-migration
Copy link
Author

Updated by Anonymous on 2010-08-20 17:39:50 +00:00

  • Status changed from Assigned to Resolved
  • Done % changed from 0 to 100

NP, we're here to help you :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant