commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <robertburrelldon...@blueyonder.co.uk>
Subject Re: help with digester in weblogic
Date Tue, 17 Dec 2002 18:35:41 GMT
hi marco

i think i can give you an explanation. weblogic runs under restrictive 
security environment. this prevents one of the pre-java 1.4 reflection bug 
workarounds from working. what you can see should be just a warning 
(rather than an error).

digester should still run fine after this warning but if you're running 
java 1.3 and things break when you run in weblogic, then you might need to 
upgrade since the reflection code in java 1.4 has far fewer bugs in.

unfortunately, the last release of beanutils repeats the warning message 
every time. you'd be well advised to upgrade to a recent nightly build - 
or CVS HEAD - of beanutils since this will only issue the warning once.

- robert

On Tuesday, December 17, 2002, at 11:00 AM, <Marco.Mistroni@nokia.com> 
wrote:

> hi all,
> 	i have downloaded digester 1.3 and i would like to use
> it inside my application in weblogic 5.1.
>
> i have written following XML file
>
> <?xml version="1.0"?>
>  <myServices>
>   <serviceGroup name="My Personal Data">
>     <service name="Current Position">
>       <joltservice>
>          <jolt name="Current1"  isHB="true"/>
>          <jolt name="Current2"  isHB="true"/>
>       </joltservice>
>       <configtool>
>          <config name="CurrentPos"/>
> 	   <config name="DateSpec"/>
>       </configtool>
>       <field name="ADDRESS_CONAME"/>
>       <field name="ADDRESS_NAMEOFCOUNTRY"/>
>       <field name="ADDRESS_EMPLOYEENO"/>
>     </service>
>   </serviceGroup>
> </myServices
>
>
> for this XML file, i have written following classes part
> of the com.xml package
> - MyServices
> - ServiceGroup
> - Service
> - JoltService
> - Jolt
> - ConfigTool
> - Config
> - Field
>
>
> i am using this simple class for getting servicegroups/fields etc
>  based on rules
>
>
> public class DigesterTest {
>
>     private Digester digester;
>     private String configFile;
>
>     public DigesterTest(String fileName) {
>         digester = new Digester();
>         digester.setValidating(false);
>         setRules(digester);
>         configFile = fileName;
>     }
>
>     /**
>      *  Set the rules to be used to parse
>      *  the XML file.
>      */
>     private void setRules(Digester digester) {
>         /** Whenever we need to change rules, we must
>          *  edit following section.
>          */
>
>         // Adding rules to be used when <myService> element is 
> encountered.
>         digester.addObjectCreate( "myServices", MyServices.class );
>         // Adding rules to be used when <serviceGroup> element is 
> encountered.
>         digester.addObjectCreate( "myServices/serviceGroup", ServiceGroup.
> class );
>         digester.addSetProperties( "myServices/serviceGroup", "name", 
> "name" );
>         digester.addSetNext("myServices/serviceGroup", "addServiceGroup" 
> );
>
>         // Adding rules to be used when <service> element is encountered.
>         digester.addObjectCreate("myServices/serviceGroup/service", 
> Service.class);
>         digester.addSetProperties("myServices/serviceGroup/service","name"
> , "name");
>         digester.addSetNext("myServices/serviceGroup/service" , 
> "addService");
>
>         }
>
>     /**
>      * @return all services available in the
>      *      configuration file.
>      */
>     public MyServices getAllServices() throws Exception {
>         MyServices mp = (MyServices)digester.parse("myProfile.xml");
>         return  mp;
>     }
>
> but when i run this program in a servlet under weblogic 5.1 i got 
> following exception
>
> Dec 17, 2002 12:50:43 PM org.apache.commons.beanutils.MethodUtils 
> getMatchingAcc
> essibleMethod
> WARNING: Cannot setAccessible on method. Therefore cannot use jvm access 
> bug wor
> karound.
> java.security.AccessControlException: access denied 
> (java.lang.reflect.ReflectPe
> rmission suppressAccessChecks)
>         at 
> java.security.AccessControlContext.checkPermission(AccessControlConte
> xt.java:270)
>         at 
> java.security.AccessController.checkPermission(AccessController.java:
> 401)
>         at java.lang.SecurityManager.checkPermission(SecurityManager.java:
> 542)
>         at 
> java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.jav
> a:107)
>         at 
> org.apache.commons.beanutils.MethodUtils.getMatchingAccessibleMethod(
> MethodUtils.java:578)
>         at 
> org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.jav
> a:243)
>         at 
> org.apache.commons.digester.SetNextRule.end(SetNextRule.java:260)
>         at org.apache.commons.digester.Digester.endElement(Digester.java:
> 1036)
>         at 
> org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXPar
> ser.java:568)
>         at 
> org.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBind
> er.java:646)
>         at 
> org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDVal
> idator.java:3006)
>         at 
> org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator
> .java:930)
>         at 
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.handleEndElemen
> t(XMLDocumentFragmentScannerImpl.java:1145)
>         at 
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(
> XMLDocumentFragmentScannerImpl.java:988)
>         at 
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
> Dispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1446)
>         at 
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XM
> LDocumentFragmentScannerImpl.java:333)
>         at 
> org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardP
> arserConfiguration.java:525)
>         at 
> org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardP
> arserConfiguration.java:581)
>         at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
>         at 
> org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.j
> ava:1157)
>         at org.apache.commons.digester.Digester.parse(Digester.java:1552)
>         at com.xml.DigesterTest.getAllServices(Unknown Source)
>         at com.nokia.servlet.MyProfileServlet.init(Unknown Source)
>         at 
> weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubIm
> pl.java:474)
>         at 
> weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStub
> Impl.java:432)
>         at 
> weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
> mpl.java:421)
>         at 
> weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.
> java:181)
>         at 
> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
> pl.java:118)
>         at 
> weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletCon
> textImpl.java:761)
>         at 
> weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletCon
> textImpl.java:708)
>         at weblogic.servlet.internal.ServletContextManager.invokeServlet(
> Servlet
> ContextManager.java:252)
>         at 
> weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.jav
> a:346)
>         at 
> weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:246)
>
>         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:135)
>
>
> However, if i run the DigesterTest class as standalone, everything works 
> fine.
>
> can anyone help me?
>
> thanx in advance and regards
> 	marco
>
> --
> To unsubscribe, e-mail:   <mailto:commons-user-unsubscribe@jakarta.apache.
> org>
> For additional commands, e-mail: <mailto:commons-user-help@jakarta.apache.
> org>
>


Mime
View raw message