[Design of POJO Server] - Re: VFS Permissions - JBMICROCONT-149
by adrian@jboss.org
"david.lloyd(a)jboss.com" wrote : Just a note that vfs* handlers in the bootstrap lib don't have to be the real handlers, they can just be do-nothing stubs, since there is the opportunity to plug in a real URLStreamHandlerFactory at a later time.
I'm not sure that would work. From my experience the URL stuff does
some funny caching?
An alternative solution is to change the way the VFSClassLoaderPolicy determines
the code source. i.e. instead of returning the vfs url we could hack it to return
a normal url.
But this would restrict codesources to be the top level url, you couldn't for
example have different permissions for subdeployments in the same deployment.
The relevant code is in VFSClassLoaderPolicy
| @Override
| protected ProtectionDomain getProtectionDomain(String className, String path)
| {
| VirtualFile clazz = findChild(path);
| if (clazz == null)
| {
| log.trace("Unable to determine class file for " + className);
| return null;
| }
| try
| {
| VirtualFile root = findRoot(path);
|
| // HERE!!!!!!!!
|
| URL codeSourceURL = root.toURL();
|
This could for example be replaced with something like:
| URL codeSourceURL = VFSUtils.getRealURLHack(root);
|
An alternative solution would be to allow you to specify the codeSourceURL to use
for the classloader as a parameter when you create it.
The hack could then be in the jboss deployer that creates the classloader policy
rather than forcing it on every user of VFSClassLoaderPolicy.
i.e. people that use it standalone would probably include jboss-vfs.jar
in the classpath so the urls would be parsable?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4187460#4187460
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4187460
17 years, 5 months
[Design of POJO Server] - Re: VFS Permissions - JBMICROCONT-149
by adrian@jboss.org
"anil.saldhana(a)jboss.com" wrote :
| | 11:19:11,025 ERROR [AbstractKernelController] Error installing to Create: name=AspectManager state=Configured
| | java.security.AccessControlException: access denied (java.io.FilePermission /home/anil/jboss-5.0/jboss-head/build/output/jboss-5.0.0.GA/server/default/tmp/aopdynclasses read)
| | at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
| |
|
| That is the error I am trying to get rid of that is not allowing a boot.
You don't show the full stacktrace, but this is on the bootstrap thread
isn't it?
If you've correctly given all the jboss jars the AllPermission
then there shouldn't be any problem here with accessing the file system.
My guess is that you haven't given them the AllPermission because of the
code source being a vfs url.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4187455#4187455
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4187455
17 years, 5 months
[Design of POJO Server] - JBVFS-67, VFSCacheFactory.getInstance(String defaultCacheImp
by scott.stark@jboss.org
I want to add a VFSCacheFactory.getInstance(String defaultCacheImpl) factory method so we can set the cache to use in the beans descriptor rather than having to set a system property. I would say this value takes precedence over the system property:
| public static VFSCache getInstance()
| {
| return getInstance(null);
| }
| public static VFSCache getInstance(String defaultCacheImpl)
| {
| if (instance == null)
| {
| synchronized (lock)
| {
| if (instance == null)
| instance = AccessController.doPrivileged(new VFSCacheCreatorAction(defaultCacheImpl));
| }
| }
| return instance;
| }
|
| private static class VFSCacheCreatorAction implements PrivilegedAction<VFSCache>
| {
| private String defaultCacheImpl;
| VFSCacheCreatorAction(String defaultCacheImpl)
| {
| this.defaultCacheImpl = defaultCacheImpl;
| }
|
| public VFSCache run()
| {
| try
| {
| String className = defaultCacheImpl;
| if(className == null)
| className = System.getProperty(VFSUtils.VFS_CACHE_KEY);
| if (className != null)
| {
| log.info("Initializing VFSCache [" + className + "] ...");
| ClassLoader cl = VFSCacheFactory.class.getClassLoader();
| Class<?> clazz = cl.loadClass(className);
| VFSCache cache = VFSCache.class.cast(clazz.newInstance());
| cache.start(); // start here, so we fall back to default no-op in case start fails
| log.info("Using VFSCache [" + cache + "] ...");
| return cache;
| }
| }
| catch (Throwable t)
| {
| log.warn("Exception instantiating VFS cache: " + t);
| }
| log.info("Using VFSCache [NoopVFSCache] ...");
| return new NoopVFSCache();
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4187445#4187445
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4187445
17 years, 5 months