[ 
https://issues.apache.org/jira/browse/CONFIGURATION-365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12674345#action_12674345
 ] 

Oliver Heger commented on CONFIGURATION-365:
--------------------------------------------

We have unit tests that do similar things. For instance, in 
{{TestDefaultConfigurationBuilder}} we have a test that reads a complex 
configuration file containing the following declaration:

{code:xml}
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- Test configuration definition file that demonstrates complex 
initialization -->
<configuration>
  <header>
    <result delimiterParsingDisabled="true">
      <nodeCombiner 
config-class="org.apache.commons.configuration.tree.OverrideCombiner"/>
      <expressionEngine 
config-class="org.apache.commons.configuration.tree.xpath.XPathExpressionEngine"/>
    </result>
    <combiner>
      <override>
        <list-nodes>
          <node>table</node>
          <node>list</node>
        </list-nodes>
      </override>
    </combiner>
  </header>
  ...
{code}

Can you check the code in a normal environment to make sure that the problem is 
not related to OSGi and class loading issues?

> Bean handling not allowing an XPathExpressionEngine
> ---------------------------------------------------
>
>                 Key: CONFIGURATION-365
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-365
>             Project: Commons Configuration
>          Issue Type: Bug
>         Environment: OSGi / Felix
>            Reporter: Rob Walker
>
> Trying to set an XPathExpressionEngine in the config file:
> ===
>   <xml  
>     config-name="config.product.xml" 
>     fileName="${sys:bundle.root}/etc/${sys:launch.target}.properties.xml" 
>     >
>         <expressionEngine 
> config-class="org.apache.commons.configuration.tree.xpath.XPathExpressionEngine"/>
>   </xml>
> ===
> And it throws an exception:
> ====
> Caused by: org.apache.commons.configuration.ConfigurationException: 
> org.apache.commons.configuration.ConfigurationRuntimeException:
> java.lang.IllegalArgumentException: Cannot invoke 
> org.apache.commons.configuration.HierarchicalConfiguration.setExpressionEngine
>  on
> bean class 'class org.apache.commons.configuration.XMLConfiguration' - 
> argument type mismatch - had objects of type "org.apache.comm
> ons.configuration.tree.xpath.XPathExpressionEngine" but expected signature 
> "org.apache.commons.configuration.tree.ExpressionEngine"
>         at 
> org.apache.commons.configuration.DefaultConfigurationBuilder.createConfigurationAt(DefaultConfigurationBuilder.java:752)
>         at 
> org.apache.commons.configuration.DefaultConfigurationBuilder.initCombinedConfiguration(DefaultConfigurationBuilder.java:6
> 28)
>         at 
> org.apache.commons.configuration.DefaultConfigurationBuilder.getConfiguration(DefaultConfigurationBuilder.java:560)
>         at 
> com.ascert.vt.modules.propsmgr.PropsMgrMainOSGI.<init>(PropsMgrMainOSGI.java:102)
>         ... 13 more
> Caused by: org.apache.commons.configuration.ConfigurationRuntimeException: 
> java.lang.IllegalArgumentException: Cannot invoke org.apa
> che.commons.configuration.HierarchicalConfiguration.setExpressionEngine on 
> bean class 'class org.apache.commons.configuration.XMLCon
> figuration' - argument type mismatch - had objects of type 
> "org.apache.commons.configuration.tree.xpath.XPathExpressionEngine" but e
> xpected signature "org.apache.commons.configuration.tree.ExpressionEngine"
>         at 
> org.apache.commons.configuration.beanutils.BeanHelper.createBean(BeanHelper.java:252)
>         at 
> org.apache.commons.configuration.beanutils.BeanHelper.createBean(BeanHelper.java:269)
>         at 
> org.apache.commons.configuration.beanutils.BeanHelper.createBean(BeanHelper.java:283)
>         at 
> org.apache.commons.configuration.DefaultConfigurationBuilder.createConfigurationAt(DefaultConfigurationBuilder.java:747)
>         ... 16 more
> Caused by: java.lang.IllegalArgumentException: Cannot invoke 
> org.apache.commons.configuration.HierarchicalConfiguration.setExpressio
> nEngine on bean class 'class 
> org.apache.commons.configuration.XMLConfiguration' - argument type mismatch - 
> had objects of type "org.
> apache.commons.configuration.tree.xpath.XPathExpressionEngine" but expected 
> signature "org.apache.commons.configuration.tree.Express
> ionEngine"
> ===
> Since XPathExpressionEngine implements ExpressionEngine, this looks like a 
> reflection bug to me i.e. not finding a method with a signature for 
> implemented interfaces as opposed to just subclasses.
> Not sure if this is OSGi / Felix classloading related, but don't think so

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to