2016-09-30 15:02 GMT+02:00 David Bosschaert <[email protected]>:

> Modifying the JRE installation via the endorsed this might be the only way
> to do this, but that really means that everyone using that JRE gets your
> hack and doesn't really support any kind of deployment lifecycle at all.
>

That's true, but the idea is to minimize the amount of code you need to put
through the endorsed mechanism.  Ideally, it may still support some level
of lifecycle with cooperation of the runtime.  Karaf allows such things for
example, as you can modify the content of the lib/* folder and ask for a
restart of the JVM.


>
> If you try to do this via a custom classloader that loads a java.* class
> without going via the root classloader is something that I tried before and
> at least at the time that was prevented via a security-related verification
> exception...
>

Yes, I don't think there's a possibility to do that, afaik, the only way to
override java.* class is the endorsed mechanism for < java 9, and no idea
how that's possible for java >= 9.


>
> Cheers,
>
> David
>
> On 30 September 2016 at 08:37, Guillaume Nodet <[email protected]> wrote:
>
>> Well, we do hack java.lang.Exception in karaf by adding a hacked version
>> in an endorsed jar, so I'm pretty sure you can do the same for
>> java.util.ServiceLoader.
>> However, I've no idea how that works in java9.
>>
>>
>> 2016-09-30 9:35 GMT+02:00 David Bosschaert <[email protected]>:
>>
>>> Hi Guillaume,
>>>
>>> I don't think you *can* hack the java.util.ServiceLoader. It's in java.*
>>> (not in javax.*) and those packages are designated for the JRE only. If you
>>> try to load them from another place you'll get a security exception of some
>>> sort.
>>>
>>> Cheers,
>>>
>>> David
>>>
>>>
>>> On 30 September 2016 at 07:27, Guillaume Nodet <[email protected]>
>>> wrote:
>>>
>>>>
>>>>
>>>> 2016-09-29 23:36 GMT+02:00 David Bosschaert <[email protected]
>>>> >:
>>>>
>>>>> Yes, SPI-Fly only handles setting the ThreadContextClassLoader for the
>>>>> duration of certain invocations.
>>>>>
>>>>> BTW Anyone know whether there exist such a hacked endorsed jar for the
>>>>> file system provider?
>>>>>
>>>>
>>>> I'm not aware of anything.
>>>>
>>>> I'm actually wondering, given the number of spec jars that are
>>>> maintained, would it be easier to hack the ServiceLoader
>>>> class so that it delegates to OSGi first, and use that hacked
>>>> ServiceLoader as an endorsed jar ?  I haven't checked all the specs, but I
>>>> now expect most of them to use this mechanism.
>>>> Though, that may be a point to address when we're going to look at JDK9
>>>> / Jigsaw support.
>>>>
>>>>
>>>>>
>>>>> Cheers,
>>>>>
>>>>> David
>>>>>
>>>>> On 29 September 2016 at 18:23, Guillaume Nodet <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> No, I think your analysis is correct.
>>>>>> Iin order to work, we'd have to use an endorsed hacked spec jar, as
>>>>>> we usually do
>>>>>>
>>>>>> 2016-09-29 19:10 GMT+02:00 Benson Margulies <[email protected]>:
>>>>>>
>>>>>>> Has anyone tried or succeeded in integrating a file system provider
>>>>>>> by
>>>>>>> using SPI-fly?
>>>>>>>
>>>>>>> The code in the JRE calls 'ClassLoader.getSystemClassLoader()',
>>>>>>> which
>>>>>>> leads me to be a pessimist, but I thought I'd ask.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> ------------------------
>>>>>> Guillaume Nodet
>>>>>> ------------------------
>>>>>> Red Hat, Open Source Integration
>>>>>>
>>>>>> Email: [email protected]
>>>>>> Web: http://fusesource.com
>>>>>> Blog: http://gnodet.blogspot.com/
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> ------------------------
>>>> Guillaume Nodet
>>>> ------------------------
>>>> Red Hat, Open Source Integration
>>>>
>>>> Email: [email protected]
>>>> Web: http://fusesource.com
>>>> Blog: http://gnodet.blogspot.com/
>>>>
>>>>
>>>
>>
>>
>> --
>> ------------------------
>> Guillaume Nodet
>> ------------------------
>> Red Hat, Open Source Integration
>>
>> Email: [email protected]
>> Web: http://fusesource.com
>> Blog: http://gnodet.blogspot.com/
>>
>>
>


-- 
------------------------
Guillaume Nodet
------------------------
Red Hat, Open Source Integration

Email: [email protected]
Web: http://fusesource.com
Blog: http://gnodet.blogspot.com/

Reply via email to