Re: Jini client inside Tomcat - FilePermission required to unmarshall a service item

Peter Jones <[email protected]> Fri, 4 Jan 2008 19:04:05 -0500
Newsgroups gmane.comp.java.sun.jini
Message-ID <20080105000405.GF18609@east>
On Fri, Jan 04, 2008 at 10:55:32AM +0100, Michal Kleczek wrote:
> On Thursday, 3 of January 2008 19:47:38 Peter Jones wrote:
>> On Thu, Jan 03, 2008 at 09:43:38AM +0100, Michal Kleczek wrote:
>>> On Wednesday, 2 of January 2008 20:39:50 Peter Jones wrote:
>>>
>>> [snip]
>>>
>>>> This seems similar to the following bug that was filed against
>>>> Tomcat 5.0.19:
>>>>
>>>>     http://issues.apache.org/bugzilla/show_bug.cgi?id=28256
>>>
>>> Read the bug report and it seems that's exactly the case (I didn't
>>> describe it in the original post to make it
>>> simpler). PreferredClassLoader loads interface classes
>>> successfully using codebase annotation but then
>>> Proxy.getProxyClass() fails with ClassNotFoundError because it
>>> cannot load dependent types
>>
>> Oh, so the stack trace from your initial message does not
>> correspond to the exception causing the failure (so the reggie code
>> on that stack does actually have the necessary permissions)?
>>
>> I believe that the exact case behind the above bug report involved
>> a normal class, not a dynamic proxy class, and I'm not quite sure
>> how the bug case maps to a dynamic proxy class case-- perhaps it
>> involves indirect inheritance through a private interface?  (The
>> actual failure stack trace would help.)
>>
>>> (I guess for some reason proxy class is defined by
>>> WebappClassLoader).
>>
>> If it has a codebase annotation, I would expect it to be defined by
>> the PreferredClassLoader for the service.
> 
> In my case there are two interfaces
> Int1 - used by the client
> Int2 extends Int1, Administrable, Remote - implemented by the service
> and the class
> DataObject used as a return value from one of the Int1 methods.
> 
> So when reggie proxy unmarshalls the service proxy Int1 is already
> loaded by WebappClassLoader. Int2 gets loaded by
> PreferredClassLoader from the codebase
> annotation. Proxy.getProxyClass() is called by
> PreferredClassProvider from outside any privileged block and since
> Int1 classloader (WebappClassloader) is used to load DataObject
> class the permission check fails and ClassNotFoundError is thrown.

OK-- FWIW, I'm still not seeing exactly how the above bug case is
occurring here, because I wouldn't expect the DataObject class to be
resolved as part of the PreferredClassLoader defining a class or
interface that itself is loaded during the defining of the dynamic
proxy class (which itself isn't done within the restricted access
control context of the PreferredClassLoader).  Again, the failure
exception trace would help.  Regardless, though, it still seems like a
similar problem with the same root cause.

-- Peter

--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to [email protected]