xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "PENPRAPA MUNKID" <miss_no...@hotmail.com>
Subject Re: applet AccessControlException loading Rhino (js.jar is in archive)
Date Fri, 23 Jan 2004 05:38:12 GMT

more info
www.naraicoms.com

>From: "ECS Engineering" <engineering@energycontrolsystems.com>
>Reply-To: "Batik Users" <batik-users@xml.apache.org>
>To: "Batik Users" <batik-users@xml.apache.org>
>Subject: Re: applet AccessControlException loading Rhino (js.jar is in 
>archive)
>Date: Thu, 22 Jan 2004 18:52:27 -0500
>
>That worked in my applet on both the Linux console and my Windows PC.  All 
>I
>changed was the 1st line of the RhinoInterpreter constructor per your
>suggestion as follows:
>
>public RhinoInterpreter(URL documentURL) {
>     rhinoClassLoader = new RhinoClassLoader(documentURL,
>getClass().getClassLoader());
>
>=> changed to:
>
>public RhinoInterpreter(URL documentURL) {
>     try {
>         rhinoClassLoader = new RhinoClassLoader(documentURL,
>getClass().getClassLoader());
>     } catch (Exception ex) {
>         rhinoClassLoader = null;
>     }
>
>I did not change "return rhinoClassLoader.getAccessControlContext();", etc.
>I then displayed the "3D.svg" sample.  I tried switching back to "js.jar"
>with the "optimizer" directory and got a NullPointerException.
>
>Thanks for the help.
>
>Stan Dickerson
>----- Original Message -----
>From: "Thomas DeWeese" <Thomas.DeWeese@Kodak.com>
>To: "Batik Users" <batik-users@xml.apache.org>
>Sent: Thursday, January 22, 2004 8:30 AM
>Subject: Re: applet AccessControlException loading Rhino (js.jar is in
>archive)
>
>
> > ECS Engineering wrote:
> >
> > > I'm missing something.  I ran "jar xf js.jar" to extract the files, 
>then
> > > deleted the org/mozilla/javascript/optimizer directory. [...]
> > > I'm still getting:
> > >
> > > java.security.AccessControlException: access denied
> > > (java.lang.RuntimePermission createClassLoader)
> > > at java.security.AccessControlContext.checkPermission(Unknown Source)
> > > at java.security.AccessController.checkPermission(Unknown Source)
> > > at java.lang.SecurityManager.checkPermission(Unknown Source)
> > > at java.lang.SecurityManager.checkCreateClassLoader(Unknown Source)
> > > at java.lang.ClassLoader.<init>(Unknown Source)
> > > at java.security.SecureClassLoader.<init>(Unknown Source)
> > > at java.net.URLClassLoader.<init>(Unknown Source)
> > > at org.apache.batik.script.rhino.RhinoClassLoader.<init>(Unknown 
>Source)
> > > at org.apache.batik.script.rhino.RhinoInterpreter.<init>(Unknown 
>Source)
> >
> >     Yup, you need to change some code in RhinoInterpreter.  It
> > 'nakedly' constructs the RhinoClassLoader - it shouldn't do this
> > it should wrap it in a try catch block - checking for the
> > SecurityException.  If you catch this then it should probably
> > be set to 'this.getClass().getClassLoader()'.
> >
> >     Then a small amount of tweaking is likely to be needed to
> > 'fix' the fact that this is null. There are four lines that use
> > it the only one that will need changing is:
> >
> >    204:        return rhinoClassLoader.getAccessControlContext();
> >
> >     This should just return null I think in the case that we couldn't
> > create the rhinoClassLoader.  If you get this working I would
> > really appreciate a patch that is known to work for Applets (I've
> > considered make these changes myself but w/o setting up the whole
> > Applet mess to test it didn't seem like a good idea).
> >
> > >
> > >  > William Billingsley wrote:
> > >  > > I'm using Batik in a couple of applets I'm developing (
> > >  > > http://www.cl.cam.ac.uk/~whb21/svgDraw/svgCircuit.html is one
> > > example; the
> > >  > > applet is near the foot of the page)
> > >  > >
> > >  > > At startup an AccessControlException occurs when Batik tries to
> > > create a
> > >  > > Rhino Interpreter from the InterpreterPool (exception trace at 
>foot
>of
> > >  > > email).  js.jar is included in the archive attribute for the 
>applet
> > > on the
> > >  > > page, and is available in the same directory as the applet.
> > >  > >>From what I can see delving into the code, RhinoClassLoader
> > > specifically
> > >  > > extends URLClassLoader, so I'm not sure if this a "can't find the
> > > class on
> > >  > > the server and not allowed to look elsewhere" (as if I had not
>included
> > >  > > js.jar) or if this exception is coming straight out of the way
>Batik is
> > >  > > written, and will always produce this error if the applet is
>unsigned?
> > >  >
> > >  > I had what sounds like the same problem using Rhino in an unrelated
> > > project.
> > >  >
> > >  > The problem is that Rhino tries to 'compile' some of the functions
>from
> > >  > javascript into java as an optimization, and load it via a custom
> > >  > ClassLoader.  There is supposed to be a resource setting somewhere
>that
> > >  > controls the optimization behavior, but I couldn't make it work.  
>My
> > >  > solution?  Remove all the classes in 
>org.mozilla.javascript.optimizer
> > >  > packages from js.jar.
> > >  >
> > >  > Hope this helps,
> > >
> > >  > - josh
> > > at
> > >
>org.apache.batik.script.rhino.RhinoInterpreterFactory.createInterpreter(Unkn
>own
> > > Source)
> > > at org.apache.batik.script.InterpreterPool.createInterpreter(Unknown
> > > Source)
> > > at org.apache.batik.bridge.BridgeContext.getInterpreter(Unknown 
>Source)
> > > at
> > > 
>org.apache.batik.bridge.BaseScriptingEnvironment.getInterpreter(Unknown
> > > Source)
> > > at 
>org.apache.batik.bridge.BaseScriptingEnvironment.loadScripts(Unknown
> > > Source)
> > > at org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(Unknown
> > > Source)
> > > at org.apache.batik.swing.svg.SVGLoadEventDispatcher.run(Unknown 
>Source)
> > >
> > > It's not critical but I would like to enable javascript in Batik in an
> > > applet (without signing or changing policies).  Any ideas?
> > >
> > > Stan Dickerson
> > > engineering@energycontrolsystems.com
> > > <mailto:engineering@energycontrolsystems.com>
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-users-help@xml.apache.org
> >
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: batik-users-help@xml.apache.org
>

_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message