Ignore my last few messages.<look type="embarassed"/> I made a mistake when converting from getResource() to getResourceAsStream(). I forgot to remove the ".toString()" from the end of the request. The rest of the messages just followed that rabbit trail.
Once I corrected that, things appear to be working as expected. I need to remove the debug code I've put in various places and try it again. Do you want to see this? I don't know if it would qualify as generally useful, or if it just a patch for the weird thing I'm trying to do. Thanks again for your help. G. Wade Thomas E Deweese wrote: > > >>>>> "GWJ" == G Wade Johnson <[EMAIL PROTECTED]> writes: > > GWJ> Well...this at least generated a different exception. > GWJ> java.io.IOException: access denied (java.util.PropertyPermission > GWJ> user.dir read) at > GWJ> > org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:355) > GWJ> ... > > This looks to be another wrapped exception, so you would need to > figure out where it's really comming from. The good thing is that > this appears to have gotten past the locating of the DTD. However I > don't know who would be looking for the users's home directory. > > GWJ> Thanks for the help so far. > > GWJ> I may need to either post-process my incoming SVG to remove the > GWJ> DOCTYPE or try the suggestion from others of putting the > GWJ> libraries on my server as well. > > Ok, but I think you are close to solving the issues here. > > GWJ> I'll look at the other options. > > GWJ> G. Wade > > GWJ> 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 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
