Well...this at least generated a different exception.
java.io.IOException: access denied (java.util.PropertyPermission
user.dir read)
at
org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:355)
...
Thanks for the help so far.
I may need to either post-process my incoming SVG to remove the
DOCTYPE or try the suggestion from others of putting the libraries
on my server as well.
I'll look at the other options.
G. Wade
Thomas E Deweese wrote:
>
> >>>>> "GWJ" == G Wade Johnson <[EMAIL PROTECTED]> writes:
>
> GWJ> Yes.
>
> Hmm, very odd, I am unfortunately out of ideas. I haven't done much
> with Applets. I am fairly certain that this is a permissions problem
> however....
>
> Ahh, I have it! The doPriviliged did the trick but the InputStream
> ends up trying to open the URL which points into the JRE, and it must
> be doing it outside the doPrivileged block, so if fails...
>
> Can you try calling getResourceAsStream()? This should avoid the
> issue.
>
> GWJ> Thomas E Deweese wrote:
> >> >>>>> "GWJ" == G Wade Johnson <[EMAIL PROTECTED]> writes:
> >>
> GWJ> I tried the doPrivileged() thing as you suggested. I get an
> GWJ> access denied error instead of a NPE, now.
> >> Are you doing the doPrivileged in the SAXSVGDocumentFactory?
> >>
> GWJ> java.io.Exception: access denied (java.io.FilePermission
> GWJ> \C:\Program Files\Java\j2re1.4.1_01\lib\ext\batik-svg-dom.jar
> GWJ> read)
> >>
> GWJ> Thomas E Deweese wrote:
> >> >> >>>>> "GWJ" == G Wade Johnson <[EMAIL PROTECTED]> writes:
> >> >>
> GWJ> Thomas E Deweese wrote:
> >> >> >> >>>>> "GWJ" == G Wade Johnson <[EMAIL PROTECTED]>
> >> writes:
> >> >> >>
> GWJ> Thanks for the quick response.
> >> >> >>
> GWJ> I'm a little confused. I have installed the Batik libraries in
> GWJ> the JRE extension directory. They appear to be being loaded from
> GWJ> there. Wouldn't the DTD be in those JAR files or am I goofing
> GWJ> something up?
> >> >> >> Hmm, this is an odd setup, it is very possible that you can't
> >> >> >> access resources from JAR's in the JRE extension directory
> >> from >> >> your Applet's context. What type of exception does line
> >> 311 >> >> generate - a security excpetion?
> >> >>
> GWJ> <grin>It wouldn't be the first time I've been called
> GWJ> "odd".</grin> My applet is going to be deployed to known client
> GWJ> machines, so I can depend on having the libraries installed. The
> GWJ> download for the whole library set was a concern for those who
> GWJ> pay my check.<shrug/>
> >> >>
> GWJ> It's a NullPointerException all the way down.
> >> >> Hmm, I think something is gobling the Security exception. I
> >> would >> try
> >> >>
> GWJ> I'm showing that the localSystemId is "resources/svg10.dtd". That
> GWJ> exception appears to be caused by a NPE at
> GWJ> org.apache.crimson.parser.Parser2.parseInternal( Parser2.java:524
> GWJ> )
> >> >>
> GWJ> The failure (on line 311) appears to be the
> GWJ> getResource(localSystemId) call returning a null.
> >> >>
> GWJ> I'm guessing I could include "resources/svg10.dtd" in my JAR and
> GWJ> the problem would go away? It just seems awkward to have that
> GWJ> resource in two places.
> >> >>
> GWJ> Does that sound like a viable attack?
> >> >> You can try it, but I don't think this will fix it - your Jar >>
> >> isn't on the SystemClassLoader's path so I don't think it would >>
> >> find it. I think you need to do the doPrivileged thing.
> >> >>
> GWJ> G. Wade
> >> >>
> >> >> >>
> >> >> >>
> >> >> >> A potential quick fix would be to wrap the request for the >>
> >> resource >> (on line 311) with a >>
> >> java.security.AccessController.doPrivileged >> call.
> >> >> >>
> >> >> >> ----
> >> >> >>
> GWJ> Maybe I'm using a problematic DOCTYPE?
> >> >> >>
> GWJ> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
> GWJ> "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
> >> >> >>
> GWJ> Another program is generating the SVG for my app and embeds this
> GWJ> during creation.
> >> >> >>
> GWJ> I'll debug line 311 further to see what I find out.
> >> >> >>
> GWJ> Thanks again, G. Wade
> >> >> >>
> GWJ> Thomas E Deweese wrote:
> >> >> >> >> >>>>> "GWJ" == G Wade Johnson <[EMAIL PROTECTED]> >>
> >> writes:
> >> >> >> >>
> GWJ> I recently ran into a problem with NullPointExceptions when I
> GWJ> tried to deploy the applet as a JAR file. I found that the
> GWJ> application would run either way but the applet would only run as
> GWJ> separate class files. More importantly, neither applet approach
> GWJ> worked when the applet was served from a Tomcat server. (my
> GWJ> production environment.)
> >> >> >> >>
> GWJ> I got the latest CVS version (this morning) and verified that it
> GWJ> still exhibited the same behavior. I compiled with debugging on
> GWJ> and optimization off. Using that version of the Batik jars, I was
> GWJ> able to track the exception to
> >> >> >> >>
> GWJ>
> org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:353)
> >> >> >> >>
> GWJ> I added some further debugging code and tracked that exception to
> >> >> >> >>
> GWJ>
> org.apache.batik.dom.svgSAXSVGDocumentFactory.resolveEntity(SAXSVGDocumentFactory.java:311)
> >> >> >> >> It seems that your JAR file is missing the SVG DTD that >>
> >> should >> be >> bundled with Batik. Are you bundling all the stuff
> >> >> from: >> >>
> >> xml-batik/resources/org/apache/batik/dom/svg/resources/
> >> >> >> >>
> >> >> >> >> It would probably be worth your while to break up the >>
> >> >> >> 'SAXFactory.java:311' line and insert some diagnostics to see
> >> >> >> >> exactly what part of the line is failing. See if
> >> something is >> >> >> wrong with the localSystemId it finds etc...
> >> >> >> >>
> >> >> >> >> In this case Batik should not be accessing the web in any
> >> >> way, >> it >> should pull the DTD out of the JAR file.
> >> >> >> >>
> GWJ> With this in hand, I went back to some of my reference SVG and
> GWJ> removed the DOCTYPE and added the namespace for xlink. This
> GWJ> workaround appears to work without issue.
> >> >> >> >>
> GWJ> Questions: 1. Is there some way to make the code use the proxy
> GWJ> information in the browser? - That is one of the major technical
> GWJ> reasons behind doing this as an applet. (The other reasons are
> GWJ> out of my control.)
> >> >> >> >> The applet should already do this.
> >> >> >> >>
> GWJ> 2. Any idea why the class file version works and the JAR file
> GWJ> version doesn't?
> >> >> >> >> My guess is that when you run from source you are getting
> >> the >> >> >> resources, when you build the jar you miss them...
> >> >> >> >>
> GWJ> 3. Am I doing something incredibly wrong and there is an obvious
> GWJ> solution I haven't noticed? <grin/> (At the rate I'm going, I'm
> GWJ> not willing to rule this out.)
> >> >> >> >> I think this is the case :)
> >> >> >> >>
> GWJ> Thanks in advance, G. Wade
> >> >> >> >>
> GWJ> ---------------------------------------------------------------------
> GWJ> To unsubscribe, e-mail: [EMAIL PROTECTED]
> GWJ> For additional commands, e-mail: [EMAIL PROTECTED]
> >> >> >> >>
> >> >> >> >> ---------------------------------------------------------------------
> >> >> >> >> To unsubscribe, e-mail: >>
> >> [EMAIL PROTECTED] >> For >> additional >>
> >> commands, e-mail: [EMAIL PROTECTED]
> >> >> >>
> GWJ> ---------------------------------------------------------------------
> GWJ> To unsubscribe, e-mail: [EMAIL PROTECTED]
> GWJ> For additional commands, e-mail: [EMAIL PROTECTED]
> >> >> >>
> >> >> >> ---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail:
> >> [EMAIL PROTECTED] >> For >> additional
> >> commands, e-mail: [EMAIL PROTECTED]
> >> >>
> GWJ> ---------------------------------------------------------------------
> GWJ> To unsubscribe, e-mail: [EMAIL PROTECTED]
> GWJ> For additional commands, e-mail: [EMAIL PROTECTED]
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For >> additional commands, e-mail: [EMAIL PROTECTED]
> >>
> GWJ> ---------------------------------------------------------------------
> GWJ> To unsubscribe, e-mail: [EMAIL PROTECTED]
> GWJ> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED] For
> >> additional commands, e-mail: [EMAIL PROTECTED]
>
> GWJ> ---------------------------------------------------------------------
> GWJ> To unsubscribe, e-mail: [EMAIL PROTECTED]
> GWJ> For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]