Re: Security Manager perm for loading a resource
Blaine Simpson <[email protected]>
| Newsgroups | gmane.comp.java.mx4j.devel |
|---|---|
| Message-ID | <[email protected]> |
Bordet, Simone wrote: > Hi, > > >>I think it would be very convenient to have some HTML text on >>the demo site that can be changed at run-time. That way, we >>could modify the list of usable MBeans, or otherwise improve >>instructions, without having to re-build and redeploy the war. > > > You mean like a Wiki ? > Wouldn't changing the list of MBeans require also the classes ? > > >>The problem with that is, I want to load it as a resource >>(Class.getResourceAsStream()), not as a file. I don't want >>to load it as a file because current-working-directory is >>very app-server dependent, but since getResourceAsStream() >>will use the container's overridden ClassLoader, it can >>always load files from .../WEB-INF/classes. The idea is, >>we'd just throw a HTML fragment file into that directory. > > > So you're running with exploded war ? > > >>Works fine until the security manager is thrown in. >>getResourceAsStream() just returns null-- no *Permission >>exception is thrown. > > > Yes, I find this very annoying as well. > > >>I can find nothing in the Java API nor >>in the Policy File Syntax guide about granting permissions to >>load files as resources, only about loading files from >>filesystems or loading classes. I tried granting >>AllPermissions to a new codebase (corresponding to what >>.../WEB-INF/classes will be eventually), but that doesn't >>work. I think that some privilege needs to be added to the >>loading codebase, not the target codebase. Anybody know of >>something I can try in the policy file, or anything else? >> >>If it just threw an exception on the getResourceAsStream, I >>could find out what permission it is lacking. :( > > > My tactic in the past was: granting AllPermission to every codebase and see if that works as I expect. > If yes, run it with -Djava.security.debug=access.failure and then spend time to find out which domain failed and for which reason. > > I'm not sure what you mean by "HTML that can be changed". Can you expand on that ? > > Simon This is a non-problem. I forgot that the war part does not run under a security manager. Sorry. -- Don't pray in my school, and I won't think in your church. ICF: 703-934-3692 Cell: 703-944-9317 ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click