You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by "G. Wade Johnson" <wa...@abbnm.com> on 2003/02/27 17:44:13 UTC
NPE in Batik in an Applet jar running behind a firewall
I am seeing a NullPointerException in parsing an SVG file that has a
DOCTYPE in an applet,
if the applet is in a jar file and I am behind a firewall.
Background:
I have an applet that will uses Batik to display SVG. To simplify
testing, I developed the
code to be run by one of two drivers: a "main" class and an "applet"
class.
I recently ran into a problem with NullPointExceptions when I tried to
deploy the applet
as a JAR file. I found that the application would run either way but the
applet would
only run as separate class files. More importantly, neither applet
approach worked when
the applet was served from a Tomcat server. (my production environment.)
I got the latest CVS version (this morning) and verified that it still
exhibited the same
behavior. I compiled with debugging on and optimization off. Using that
version of the
Batik jars, I was able to track the exception to
org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:353)
I added some further debugging code and tracked that exception to
org.apache.batik.dom.svgSAXSVGDocumentFactory.resolveEntity(SAXSVGDocumentFactory.java:311)
With this in hand, I went back to some of my reference SVG and removed
the DOCTYPE and
added the namespace for xlink. This workaround appears to work without
issue.
Questions:
1. Is there some way to make the code use the proxy information in the
browser?
- That is one of the major technical reasons behind doing this as an
applet. (The other
reasons are out of my control.)
2. Any idea why the class file version works and the JAR file version
doesn't?
3. Am I doing something incredibly wrong and there is an obvious
solution I haven't
noticed? <grin/> (At the rate I'm going, I'm not willing to rule
this out.)
Thanks in advance,
G. Wade
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: NPE in Batik in an Applet jar running behind a firewall
Posted by "G. Wade Johnson" <wa...@abbnm.com>.
In looking at InputEntity.java in the the xml-crimson code, it looks
like the resource is being classed as an invalid URL and the code
attempts to convert it into a file reference. I'm not really sure why
this would work differently in an applet than in an application.
More importantly, I have no idea how to convince the code to "do the
right thing" at this point, or possibly where the system id is set
up... I guess I could follow that track a little ways.
"G. Wade Johnson" wrote:
>
> I'm willing to keep looking at it, if you think there's a possibility
> of finding it. I'll see what I can find out.
>
> I've extracted the inner exception. The stack trace is below:
> (apologies for any typoes)
>
> java.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)
> at java.security.AccessControlContext.checkPermission(accessControlContext.java:270)
> at java,security.AccessController.checkPermission(AccessController.java:401)
> at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
> at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1291)
> at java.lang.System.getProperty(System.java:572)
> at java.io.Win32FileSystem.getUserPath(Win32FileSystem.java:272)
> at java.io.Win32FileSystem.resolve(Win32FileSystem.java:288)
> at java.io.File.getAbsolutePath(File.java:459)
> at org.apache.crimson.parser.InputEntity.convertToFileURL(InputEntity.java:168)
> at org.apache.crimson.parser.InputEntity.init(InputEntity.java:204)
[snip]
> at org.apache.batik.swing.svg.SVGDocumentLoader.run(SVGDocumentLoader.java:71)
>
> Now, I'm not an expert. But, it sort of looks like crimson's
> convertToFileURL() is the culprit. I guess I can dig a little further.
>
> G. Wade
>
> Thomas E Deweese wrote:
> >
> > >>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> 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 <wa...@abbnm.com> 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 <wa...@abbnm.com> 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 <wa...@abbnm.com>
> > >> writes:
> > >> >> >>
> > GWJ> Thomas E Deweese wrote:
> > >> >> >> >> >>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> >>
> > >> 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 <wa...@abbnm.com>
> > >> >> >> 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: batik-users-unsubscribe@xml.apache.org
> > GWJ> 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
> > >> >> >> >>
> > GWJ> ---------------------------------------------------------------------
> > GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > GWJ> 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
> > >> >> >>
> > GWJ> ---------------------------------------------------------------------
> > GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > GWJ> 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
> > >> >>
> > GWJ> ---------------------------------------------------------------------
> > GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > GWJ> 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
> > >>
> > GWJ> ---------------------------------------------------------------------
> > GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > GWJ> 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
> >
> > GWJ> ---------------------------------------------------------------------
> > GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > GWJ> 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
>
> ---------------------------------------------------------------------
> 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
Re: NPE in Batik in an Applet jar running behind a firewall
Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> writes:
GWJ> I'm willing to keep looking at it, if you think there's a
GWJ> possibility of finding it. I'll see what I can find out.
I think is possible :)
Unfortunately it looks to me like the getResourceAsStream is
returning 'null'. Which puts us more or less back to square one.
and I'm out of ideas, so while I'm convinced it's possible I don't
think I can help you any more :<
GWJ> I've extracted the inner exception. The stack trace is below:
GWJ> (apologies for any typoes)
GWJ> java.security.AccessControlException: access denied
GWJ> (java.util.PropertyPermission user.dir read) at
GWJ> java.security.AccessControlContext.checkPermission(accessControlContext.java:270)
GWJ> at
GWJ> java,security.AccessController.checkPermission(AccessController.java:401)
GWJ> at
GWJ> java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
GWJ> at
GWJ> java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1291)
GWJ> at java.lang.System.getProperty(System.java:572) at
GWJ> java.io.Win32FileSystem.getUserPath(Win32FileSystem.java:272) at
GWJ> java.io.Win32FileSystem.resolve(Win32FileSystem.java:288) at
GWJ> java.io.File.getAbsolutePath(File.java:459) at
GWJ> org.apache.crimson.parser.InputEntity.convertToFileURL(InputEntity.java:168)
GWJ> at
GWJ> org.apache.crimson.parser.InputEntity.init(InputEntity.java:204)
GWJ> at
GWJ> org.apache.crimson.parser.Parser2.pushReader(Parser2.java:3135)
GWJ> at
GWJ> org.apache.crimson.parser.Parser2.externalParameterEntity(Parser2.java:2868)
GWJ> at
GWJ> org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Parser2.java:1167)
GWJ> at
GWJ> org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:489)
GWJ> at org.apache.crimson.parser.Parser2.parse(Parser2.java:305) at
GWJ> org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
GWJ> at
GWJ> org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:347)
GWJ> at
GWJ> org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:276)
GWJ> at
GWJ> org.apache.batik.dom.util.SAXSVGDocumentFactory.createDocument(SAXSVGDocumentFactory.java:176)
GWJ> at
GWJ> org.apache.batik.dom.util.SAXSVGDocumentFactory.createSVGDocument(SAXSVGDocumentFactory.java:101)
GWJ> at
GWJ> org.apache.batik.bridge.DocumentLoader.loadDocument(DocumentLoader.java:95)
GWJ> at
GWJ> org.apache.batik.swing.svg.SVGDocumentLoader.run(SVGDocumentLoader.java:71)
GWJ> Now, I'm not an expert. But, it sort of looks like crimson's
GWJ> convertToFileURL() is the culprit. I guess I can dig a little
GWJ> further.
GWJ> G. Wade
GWJ> Thomas E Deweese wrote:
>> >>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> 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 <wa...@abbnm.com> 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 <wa...@abbnm.com>
>> 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 <wa...@abbnm.com> >>
>> writes:
>> >> >> >>
GWJ> Thomas E Deweese wrote:
>> >> >> >> >> >>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com>
>> >> >> 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
>> <wa...@abbnm.com> >> >> >> 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: batik-users-unsubscribe@xml.apache.org
GWJ> 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
>> >> >> >> >>
GWJ> ---------------------------------------------------------------------
GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
GWJ> 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
>> >> >> >>
GWJ> ---------------------------------------------------------------------
GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
GWJ> 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
>> >> >>
GWJ> ---------------------------------------------------------------------
GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
GWJ> 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
>> >>
GWJ> ---------------------------------------------------------------------
GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
GWJ> 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
>>
GWJ> ---------------------------------------------------------------------
GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
GWJ> 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
GWJ> ---------------------------------------------------------------------
GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
GWJ> 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
Re: NPE in Batik in an Applet jar running behind a firewall
Posted by "G. Wade Johnson" <wa...@abbnm.com>.
I'm willing to keep looking at it, if you think there's a possibility
of finding it. I'll see what I can find out.
I've extracted the inner exception. The stack trace is below:
(apologies for any typoes)
java.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)
at java.security.AccessControlContext.checkPermission(accessControlContext.java:270)
at java,security.AccessController.checkPermission(AccessController.java:401)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1291)
at java.lang.System.getProperty(System.java:572)
at java.io.Win32FileSystem.getUserPath(Win32FileSystem.java:272)
at java.io.Win32FileSystem.resolve(Win32FileSystem.java:288)
at java.io.File.getAbsolutePath(File.java:459)
at org.apache.crimson.parser.InputEntity.convertToFileURL(InputEntity.java:168)
at org.apache.crimson.parser.InputEntity.init(InputEntity.java:204)
at org.apache.crimson.parser.Parser2.pushReader(Parser2.java:3135)
at org.apache.crimson.parser.Parser2.externalParameterEntity(Parser2.java:2868)
at org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Parser2.java:1167)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:489)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:347)
at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:276)
at org.apache.batik.dom.util.SAXSVGDocumentFactory.createDocument(SAXSVGDocumentFactory.java:176)
at org.apache.batik.dom.util.SAXSVGDocumentFactory.createSVGDocument(SAXSVGDocumentFactory.java:101)
at org.apache.batik.bridge.DocumentLoader.loadDocument(DocumentLoader.java:95)
at org.apache.batik.swing.svg.SVGDocumentLoader.run(SVGDocumentLoader.java:71)
Now, I'm not an expert. But, it sort of looks like crimson's
convertToFileURL() is the culprit. I guess I can dig a little further.
G. Wade
Thomas E Deweese wrote:
>
> >>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> 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 <wa...@abbnm.com> 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 <wa...@abbnm.com> 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 <wa...@abbnm.com>
> >> writes:
> >> >> >>
> GWJ> Thomas E Deweese wrote:
> >> >> >> >> >>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> >>
> >> 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 <wa...@abbnm.com>
> >> >> >> 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: batik-users-unsubscribe@xml.apache.org
> GWJ> 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
> >> >> >> >>
> GWJ> ---------------------------------------------------------------------
> GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> GWJ> 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
> >> >> >>
> GWJ> ---------------------------------------------------------------------
> GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> GWJ> 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
> >> >>
> GWJ> ---------------------------------------------------------------------
> GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> GWJ> 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
> >>
> GWJ> ---------------------------------------------------------------------
> GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> GWJ> 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
>
> GWJ> ---------------------------------------------------------------------
> GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> GWJ> 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
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: NPE in Batik in an Applet jar running behind a firewall - patched
Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> writes:
GWJ> I made a mistake when converting from getResource() to
GWJ> getResourceAsStream(). I forgot to remove the ".toString()" from
GWJ> the end of the request. The rest of the messages just followed
GWJ> that rabbit trail.
Ahh, that makes me feel much better :)
GWJ> Once I corrected that, things appear to be working as expected. I
GWJ> need to remove the debug code I've put in various places and try
GWJ> it again. Do you want to see this? I don't know if it would
GWJ> qualify as generally useful, or if it just a patch for the weird
GWJ> thing I'm trying to do.
Yes, I think it would be nice to include in Batik for people
who decide to use it as you are.
GWJ> Thanks again for your help.
GWJ> Thomas E Deweese wrote:
>> >>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> 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 <wa...@abbnm.com> 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 <wa...@abbnm.com>
>> 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 <wa...@abbnm.com> >>
>> writes:
>> >> >> >>
GWJ> Thomas E Deweese wrote:
>> >> >> >> >> >>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com>
>> >> >> 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
>> <wa...@abbnm.com> >> >> >> 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: batik-users-unsubscribe@xml.apache.org
GWJ> 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
Re: NPE in Batik in an Applet jar running behind a firewall - patched
Posted by "G. Wade Johnson" <wa...@abbnm.com>.
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 <wa...@abbnm.com> 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 <wa...@abbnm.com> 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 <wa...@abbnm.com> 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 <wa...@abbnm.com>
> >> writes:
> >> >> >>
> GWJ> Thomas E Deweese wrote:
> >> >> >> >> >>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> >>
> >> 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 <wa...@abbnm.com>
> >> >> >> 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: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: NPE in Batik in an Applet jar running behind a firewall
Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> 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 <wa...@abbnm.com> 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 <wa...@abbnm.com> 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 <wa...@abbnm.com>
>> writes:
>> >> >>
GWJ> Thomas E Deweese wrote:
>> >> >> >> >>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> >>
>> 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 <wa...@abbnm.com>
>> >> >> 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: batik-users-unsubscribe@xml.apache.org
GWJ> 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
>> >> >> >>
GWJ> ---------------------------------------------------------------------
GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
GWJ> 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
>> >> >>
GWJ> ---------------------------------------------------------------------
GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
GWJ> 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
>> >>
GWJ> ---------------------------------------------------------------------
GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
GWJ> 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
>>
GWJ> ---------------------------------------------------------------------
GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
GWJ> 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
GWJ> ---------------------------------------------------------------------
GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
GWJ> 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
Re: NPE in Batik in an Applet jar running behind a firewall
Posted by "G. Wade Johnson" <wa...@abbnm.com>.
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 <wa...@abbnm.com> 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 <wa...@abbnm.com> 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 <wa...@abbnm.com> writes:
> >> >>
> GWJ> Thomas E Deweese wrote:
> >> >> >> >>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com>
> >> 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 <wa...@abbnm.com> >>
> >> 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: batik-users-unsubscribe@xml.apache.org
> GWJ> 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
> >> >> >>
> GWJ> ---------------------------------------------------------------------
> GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> GWJ> 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
> >> >>
> GWJ> ---------------------------------------------------------------------
> GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> GWJ> 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
> >>
> GWJ> ---------------------------------------------------------------------
> GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> GWJ> 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
>
> GWJ> ---------------------------------------------------------------------
> GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> GWJ> 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
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: NPE in Batik in an Applet jar running behind a firewall
Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> 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 <wa...@abbnm.com> 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 <wa...@abbnm.com> writes:
>> >>
GWJ> Thomas E Deweese wrote:
>> >> >> >>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com>
>> 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 <wa...@abbnm.com> >>
>> 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: batik-users-unsubscribe@xml.apache.org
GWJ> 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
>> >> >>
GWJ> ---------------------------------------------------------------------
GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
GWJ> 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
>> >>
GWJ> ---------------------------------------------------------------------
GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
GWJ> 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
>>
GWJ> ---------------------------------------------------------------------
GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
GWJ> 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
GWJ> ---------------------------------------------------------------------
GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
GWJ> 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
Re: NPE in Batik in an Applet jar running behind a firewall
Posted by "G. Wade Johnson" <wa...@abbnm.com>.
Yes.
G. Wade
Thomas E Deweese wrote:
>
> >>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> 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 <wa...@abbnm.com> writes:
> >>
> GWJ> Thomas E Deweese wrote:
> >> >> >>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> 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 <wa...@abbnm.com>
> >> 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: batik-users-unsubscribe@xml.apache.org
> GWJ> 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
> >> >>
> GWJ> ---------------------------------------------------------------------
> GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> GWJ> 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
> >>
> GWJ> ---------------------------------------------------------------------
> GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> GWJ> 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
>
> GWJ> ---------------------------------------------------------------------
> GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> GWJ> 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
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: NPE in Batik in an Applet jar running behind a firewall
Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> 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 <wa...@abbnm.com> writes:
>>
GWJ> Thomas E Deweese wrote:
>> >> >>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> 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 <wa...@abbnm.com>
>> 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: batik-users-unsubscribe@xml.apache.org
GWJ> 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
>> >>
GWJ> ---------------------------------------------------------------------
GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
GWJ> 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
>>
GWJ> ---------------------------------------------------------------------
GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
GWJ> 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
GWJ> ---------------------------------------------------------------------
GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
GWJ> 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
Re: NPE in Batik in an Applet jar running behind a firewall
Posted by "G. Wade Johnson" <wa...@abbnm.com>.
I tried the doPrivileged() thing as you suggested. I get an access
denied error instead of a NPE, now.
java.io.Exception: access denied (java.io.FilePermission \C:\Program
Files\Java\j2re1.4.1_01\lib\ext\batik-svg-dom.jar read)
G. Wade
Thomas E Deweese wrote:
>
> >>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> writes:
>
> GWJ> Thomas E Deweese wrote:
>
> >> >>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> 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 <wa...@abbnm.com> 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: batik-users-unsubscribe@xml.apache.org
> GWJ> 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
> >>
> GWJ> ---------------------------------------------------------------------
> GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> GWJ> 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
>
> GWJ> ---------------------------------------------------------------------
> GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> GWJ> 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
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: NPE in Batik in an Applet jar running behind a firewall
Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> writes:
GWJ> Thomas E Deweese wrote:
>> >>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> 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 <wa...@abbnm.com> 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: batik-users-unsubscribe@xml.apache.org
GWJ> 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
>>
GWJ> ---------------------------------------------------------------------
GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
GWJ> 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
GWJ> ---------------------------------------------------------------------
GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
GWJ> 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
Re: NPE in Batik in an Applet jar running behind a firewall
Posted by "G. Wade Johnson" <wa...@abbnm.com>.
Including "resources/svg10.dtd" in my JAR doesn't work either. I
tried putting it at the root of the JAR and at the same path as in
the batik-svg-dom.jar library file.
I'm still baffled.
G. Wade
"G. Wade Johnson" wrote:
> Thomas E Deweese wrote:
>
> > >>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> 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?
>
> <grin>It wouldn't be the first time I've been called "odd".</grin> My
> applet is going to be deployed to known client machines, so I can
> depend on having the libraries installed. The download for the whole
> library set was a concern for those who pay my check.<shrug/>
>
> It's a NullPointerException all the way down.
>
> I'm showing that the localSystemId is "resources/svg10.dtd". That
> exception appears to be caused by a NPE at
> org.apache.crimson.parser.Parser2.parseInternal( Parser2.java:524 )
>
> The failure (on line 311) appears to be the getResource(localSystemId)
> call returning a null.
>
> I'm guessing I could include "resources/svg10.dtd" in my JAR and the
> problem would go away? It just seems awkward to have that resource
> in two places.
>
> Does that sound like a viable attack?
>
> 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 <wa...@abbnm.com> 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: batik-users-unsubscribe@xml.apache.org
> > GWJ> 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
> >
> > GWJ> ---------------------------------------------------------------------
> > GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > GWJ> 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
>
> ---------------------------------------------------------------------
> 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
Re: NPE in Batik in an Applet jar running behind a firewall
Posted by "G. Wade Johnson" <wa...@abbnm.com>.
Thomas E Deweese wrote:
> >>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> 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?
<grin>It wouldn't be the first time I've been called "odd".</grin> My
applet is going to be deployed to known client machines, so I can
depend on having the libraries installed. The download for the whole
library set was a concern for those who pay my check.<shrug/>
It's a NullPointerException all the way down.
I'm showing that the localSystemId is "resources/svg10.dtd". That
exception appears to be caused by a NPE at
org.apache.crimson.parser.Parser2.parseInternal( Parser2.java:524 )
The failure (on line 311) appears to be the getResource(localSystemId)
call returning a null.
I'm guessing I could include "resources/svg10.dtd" in my JAR and the
problem would go away? It just seems awkward to have that resource
in two places.
Does that sound like a viable attack?
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 <wa...@abbnm.com> 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: batik-users-unsubscribe@xml.apache.org
> GWJ> 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
>
> GWJ> ---------------------------------------------------------------------
> GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> GWJ> 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
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: NPE in Batik in an Applet jar running behind a firewall
Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> 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?
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 <wa...@abbnm.com> 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: batik-users-unsubscribe@xml.apache.org
GWJ> 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
GWJ> ---------------------------------------------------------------------
GWJ> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
GWJ> 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
Re: NPE in Batik in an Applet jar running behind a firewall
Posted by "G. Wade Johnson" <wa...@abbnm.com>.
Thomas,
Thanks for the quick response.
I'm a little confused. I have installed the Batik libraries in the JRE extension
directory. They appear to be being loaded from there. Wouldn't the DTD
be in those JAR files or am I goofing something up?
Maybe I'm using a problematic DOCTYPE?
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
Another program is generating the SVG for my app and embeds this during creation.
I'll debug line 311 further to see what I find out.
Thanks again,
G. Wade
Thomas E Deweese wrote:
> >>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> 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: batik-users-unsubscribe@xml.apache.org
> GWJ> 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
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
RE: NPE in Batik in an Applet jar running behind a firewall
Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "GWJ" == G Wade Johnson <wa...@abbnm.com> 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: batik-users-unsubscribe@xml.apache.org
GWJ> 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