ClassNotFoundException at HostServicesDelegate
Kevin Rushforth
kevin.rushforth at oracle.com
Wed Jun 29 23:47:24 UTC 2016
> What instance should be returned from
HostServicesDelegate#getInstance() by default if javafx.deploy is not
loaded?
It will need to be a new instance that implements the methods of
HostServices in a way that makes sense for a standalone app. The deploy
code already does this, so I can likely reuse that. In any event, I'll
do this when I fix the bug. It won't happen in the next few weeks,
though; until then please use the workaround or just ignore the warning
message.
-- Kevin
Yasumasa Suenaga wrote:
> Hi Kevin,
>
> Currently, ctor of HostServices will not be initialized because it
> will recieve ClassNotFoundException. However, the application seems
> to be run.
>
> What instance should be returned from HostServicesDelegate#getInstance()
> by default if javafx.deploy is not loaded?
>
> I guess we can use ModuleFinder#find() to refactoring.
>
>
> Thanks,
>
> Yasumasa
>
>
> On 2016/06/30 0:09, Kevin Rushforth wrote:
>> Hi Yasumasa,
>>
>> No, this is not a correct solution as it just masks the problem. A
>> likely solution will be to refactor the code to provide an
>> alternative implementation of HostServicesDelegate in case the
>> javafx.deploy module is not loaded (either in the case of a purely
>> open build of OpenJFX or in the case where the deploy module doesn't
>> get loaded by default).
>>
>> -- Kevin
>>
>>
>> Yasumasa Suenaga wrote:
>>> Hi Kevin,
>>>
>>>> java -addmods javafx.deploy ....
>>>>
>>>> We will need a fix that doesn't require this.
>>>
>>> I guess you will fix to add exports directive to module-info.java in
>>> closed source.
>>> However, I think we should fix as below:
>>>
>>> ----------------
>>> diff -r 3597495167c7
>>> modules/graphics/src/main/java/com/sun/javafx/application/HostServicesDelegate.java
>>>
>>> ---
>>> a/modules/graphics/src/main/java/com/sun/javafx/application/HostServicesDelegate.java
>>> Tue Jun 28 01:48:07 2016 +0530
>>> +++
>>> b/modules/graphics/src/main/java/com/sun/javafx/application/HostServicesDelegate.java
>>> Wed Jun 29 23:53:07 2016 +0900
>>> @@ -55,7 +55,6 @@
>>> getInstanceMeth =
>>> factoryClass.getMethod(
>>> "getInstance",
>>> Application.class);
>>> } catch (Exception ex) {
>>> - ex.printStackTrace();
>>> return null;
>>> }
>>> }
>>> ----------------
>>>
>>> Otherwise, the user who uses pure OpenJFX will see this stack trace.
>>> I think this exception can be ignored.
>>> So it should not be printed.
>>>
>>>
>>> Thanks,
>>>
>>> Yasumasa
>>>
>>>
>>> On 2016/06/29 0:44, Kevin Rushforth wrote:
>>>> A workaround is:
>>>>
>>>> java -addmods javafx.deploy ....
>>>>
>>>> We will need a fix that doesn't require this.
>>>>
>>>> -- Kevin
>>>>
>>>>
>>>> Kevin Rushforth wrote:
>>>>> Thanks for the pointer. That was enough for me to reproduce the
>>>>> bug. I filed the following issue to track it:
>>>>>
>>>>> https://bugs.openjdk.java.net/browse/JDK-8160464
>>>>>
>>>>> -- Kevin
>>>>>
>>>>>
>>>>> Yasumasa Suenaga wrote:
>>>>>>
>>>>>> Hi Kevin,
>>>>>>
>>>>>> I use JDK 9 EA b124 for Windows x64 from java.net <http://java.net>.
>>>>>> https://jdk9.java.net/download/
>>>>>>
>>>>>> If you want to full stack trace, please download from here:
>>>>>>
>>>>>> http://icedtea.classpath.org/bugzilla/attachment.cgi?id=1540&action=edit
>>>>>> <http://icedtea.classpath.org/bugzilla/attachment.cgi?id=1540&action=edit>
>>>>>>
>>>>>>
>>>>>> This exception does not occur on OracleJDK 8. So I guess this
>>>>>> exception is from Java FX 9.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Yasumasa
>>>>>>
>>>>>> 2016/06/28 23:52 "Kevin Rushforth" <kevin.rushforth at oracle.com
>>>>>> <mailto:kevin.rushforth at oracle.com>>:
>>>>>>
>>>>>> Hi Yasumasa,
>>>>>>
>>>>>> I assume this is a download of the Oracle JDK from java.net
>>>>>> <http://java.net>? We haven't seen any problems like this, so it
>>>>>> might be a problem with HeapStats analyzer. The class in
>>>>>> question
>>>>>> is a closed-source class that lives in the javafx.deploy module.
>>>>>> What exactly are you running?
>>>>>>
>>>>>> -- Kevin
>>>>>>
>>>>>>
>>>>>> Yasumasa Suenaga wrote:
>>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> When I ran HeapStats Analyzer [1] on JDK 9 EA b124, I
>>>>>> encountered ClassNotFoundException as below:
>>>>>> ------------
>>>>>> java.lang.ClassNotFoundException:
>>>>>> com.sun.deploy.uitoolkit.impl.fx.HostServicesFactory
>>>>>> at
>>>>>>
>>>>>> jdk.internal.loader.BuiltinClassLoader.loadClass(java.base at 9-ea/BuiltinClassLoader.java:366)
>>>>>>
>>>>>>
>>>>>> at
>>>>>>
>>>>>> java.lang.ClassLoader.loadClass(java.base at 9-ea/ClassLoader.java:419)
>>>>>> at java.lang.Class.forName0(java.base at 9-ea/Native
>>>>>> Method)
>>>>>> at
>>>>>> java.lang.Class.forName(java.base at 9-ea/Class.java:378)
>>>>>> at
>>>>>>
>>>>>> com.sun.javafx.application.HostServicesDelegate.lambda$getInstance$0(javafx.graphics at 9-ea/HostServicesDelegate.java:52)
>>>>>>
>>>>>>
>>>>>> :
>>>>>> ------------
>>>>>>
>>>>>> This message does not appear on JDK 8u92.
>>>>>> I think this message is printed at [2].
>>>>>>
>>>>>> I think this exception message do not need to be printed.
>>>>>> At least, it is debug level.
>>>>>>
>>>>>> Does someone work for it?
>>>>>> If not so, I want to contribute patch.
>>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Yasumasa
>>>>>>
>>>>>>
>>>>>> [1] http://icedtea.classpath.org/wiki/HeapStats
>>>>>> [2]
>>>>>>
>>>>>> http://hg.openjdk.java.net/openjfx/9-dev/rt/file/3597495167c7/modules/graphics/src/main/java/com/sun/javafx/application/HostServicesDelegate.java#l58
>>>>>>
>>>>>>
>>>>>>
More information about the openjfx-dev
mailing list