commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karl Stenerud <k...@webartjapan.com>
Subject call-method-rule no longer working
Date Fri, 23 Jul 2004 09:06:14 GMT
I'm having problems trying to upgrade from Digester 1.3 to 1.5 (1.4 and 1.4.1 also don't work).

I've built a web app that runs under Tomcat (5.0.16).  I use Digester to parse the controller
configuration.
With Digester 1.3, all works fine.  With any digester after that, it fails when it tries to
load the controller rules file:

(digester.Digester                   1060) End event threw exception
java.lang.NoSuchMethodException: No such accessible method: add() on object: org.apache.commons.digester.CallMethodRule
        at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:250)
        at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:256)
        at org.apache.commons.digester.Rule.end(Rule.java:276)
        at org.apache.commons.digester.Digester.endElement(Digester.java:1058)
        at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
        at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown
Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.commons.digester.Digester.parse(Digester.java:1567)
        at org.apache.commons.digester.xmlrules.FromXmlRuleSet.addRuleInstances(FromXmlRuleSet.java:149)
        at org.apache.commons.digester.Digester.addRuleSet(Digester.java:1663)
        at org.apache.commons.digester.xmlrules.DigesterLoader.createDigester(DigesterLoader.java:91)
        at com.zergsoft.common.webapp.ControllerConfig.load(ControllerConfig.java:153)
        at com.zergsoft.common.webapp.ControllerConfig.load(ControllerConfig.java:143)
        at com.zergsoft.common.webapp.ControllerServlet.init(ControllerServlet.java:45)
        at javax.servlet.GenericServlet.init(GenericServlet.java:256)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1044)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:887)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3948)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4271)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:850)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
        at org.apache.catalina.core.StandardHostDeployer.addChild(StandardHostDeployer.java:832)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:252)
        at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:256)
        at org.apache.commons.digester.Rule.end(Rule.java:276)
        at org.apache.commons.digester.Digester.endElement(Digester.java:1058)
        at org.apache.catalina.util.CatalinaDigester.endElement(CatalinaDigester.java:123)
        at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.commons.digester.Digester.parse(Digester.java:1567)
        at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:512)
        at org.apache.catalina.core.StandardHost.install(StandardHost.java:890)
        at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:523)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:468)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1002)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:393)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1133)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:816)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1125)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:518)
        at org.apache.catalina.core.StandardService.start(StandardService.java:519)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:2343)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:297)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:398)



com.zergsoft.common.webapp.ControllerConfig.load:
line        code
----        ----
 15         private static final String CONFIG_RULES_FILE = "/controller-config-rules.xml";
...
152         URL rules = ControllerConfig.class.getResource(CONFIG_RULES_FILE);
153         Digester digester = DigesterLoader.createDigester(rules);


I've checked the controller-config-rules.xml file and it is no longer valid under the dtd
that is provided with the new digester.
A DTD check fails on call-method-rule with error: The content of element type "call-method-rule"
must match "EMPTY"
Here is the offending fragment:
    <pattern value="security-manager">
      <call-method-rule pattern="property" methodname="addProperty" paramcount="2">
        <call-param-rule paramnumber="1" attrname="name"/>
        <call-param-rule paramnumber="2" attrname="value"/>
      </call-method-rule>
    </pattern>

And sure enough, the DTD does not allow call-param-rules inside of call-method-rules:
<!-- CallMethodRule -->
<!ELEMENT call-method-rule EMPTY>
<!ATTLIST call-method-rule
    pattern    CDATA #IMPLIED
    methodname CDATA #REQUIRED
    paramcount CDATA #IMPLIED
    paramtypes CDATA #IMPLIED>

<!-- CallParamRule -->
<!ELEMENT call-param-rule EMPTY>
<!ATTLIST call-param-rule
    pattern  CDATA #IMPLIED
    paramnumber CDATA #REQUIRED
    attrname CDATA #IMPLIED>


The release notes mention that 1.4 broke compatibility with older versions, but there wasn't
anything mentioned about call-method-rule being changed.
Is there something else I can use in its place to get the same effect?


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message