You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Kerry <ka...@avionicengineers.com> on 2018/12/23 20:38:07 UTC

Karaf 4.2.2, Java 11, OpenJFX 11 and PaxExam

Hi,

I'm trying to to get my project FlexFx to work on Java 11 with OpenJFX 11 inside Karaf 4.2.2 and have so far managed to get it to work by manually deploying the OpenJFX jars to the `jdk9plus` folder of Karaf.

I am now trying to update the integration tests which use Pax Exam and because JavaFX is no longer part of the JDK-11 I need to include these in the Karaf configuration. To begin with I tried this:

bootClasspathLibraries(
    new BootClasspathLibraryOption(mavenBundle().artifactId(OPENJFX_BASE_ARTIFACT_ID).groupId(OPENJFX_GROUP_ID).version(OPENFX_VERSION)),
    new BootClasspathLibraryOption(mavenBundle().artifactId(OPENJFX_CONTROLS_ARTIFACT_ID).groupId(OPENJFX_GROUP_ID).version(OPENFX_VERSION)),
    new BootClasspathLibraryOption(mavenBundle().artifactId(OPENJFX_FXML_ARTIFACT_ID).groupId(OPENJFX_GROUP_ID).version(OPENFX_VERSION)))

but this only put the artifacts into the lib folder not `lib/jdk9plus`

Also (and this is where I am still new and confused with the Java9 + module system) the above artifacts are not the actual ones I used when I manually installed OpenJFX to Karaf. I manually installed the SDK from gluon (https://gluonhq.com/products/javafx/) and this zip file includes native libraries as well as JARs. These are what I think I should be installing automatically but I'm uncertain how I can go about this with PaxExam.

Does anyone have any suggestions?

Thanks, Kerry.



Re: Karaf 4.2.2, Java 11, OpenJFX 11 and PaxExam

Posted by Kerry <ka...@avionicengineers.com>.
Hi Freeman,

I updated to the PAX version as advised but now I get a Karaf start up issue when I try to run my test and I get the same result when I remove my custom configuration of the Karaf container:

[main] INFO org.ops4j.pax.exam.spi.DefaultExamSystem - Pax Exam System (Version: 4.13.1) created.
[main] INFO org.ops4j.pax.exam.junit.impl.ProbeRunner - creating PaxExam runner for class com.javatechnics.flexfx.boot.DeployFlexFxTest
[main] INFO org.ops4j.pax.exam.junit.impl.ProbeRunner - running test class com.javatechnics.flexfx.boot.DeployFlexFxTest
[main] INFO org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer - Creating RMI registry server on 127.0.0.1:21000
[main] INFO org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer - Found 0 options when requesting OverrideJUnitBundlesOption.class
[main] INFO org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer - Wait for test container to finish its initialization [ RelativeTimeout value = 180000 ]
[main] INFO org.ops4j.pax.exam.rbc.client.RemoteBundleContextClient - Waiting for remote bundle context.. on 21000 name: 572ce6a6-fc5b-4884-a699-2c7a0132875e timout: [ RelativeTimeout value = 180000 ]
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.felix.framework.ext.ClassPathExtenderFactory$DefaultClassLoaderExtender (file:/home/kerry/intellijprojects/flexfx/it/tests/target/paxexam/unpack/106f6824-a4ac-4a12-af4b-aecdd0b6bd9c/system/org/apache/felix/org.apache.felix.framework/5.6.10/org.apache.felix.framework-5.6.10.jar) to method java.net.URLClassLoader.addURL(java.net.URL)
WARNING: Please consider reporting this to the maintainers of org.apache.felix.framework.ext.ClassPathExtenderFactory$DefaultClassLoaderExtender
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

java.lang.RuntimeException: Container never came up
    at org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.stop(KarafTestContainer.java:629)
    at org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactor.tearDown(EagerSingleStagedReactor.java:118)
    at org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactor.afterClass(EagerSingleStagedReactor.java:132)
    at org.ops4j.pax.exam.spi.reactors.ReactorManager.afterClass(ReactorManager.java:441)
    at org.ops4j.pax.exam.junit.impl.ProbeRunner.run(ProbeRunner.java:107)
    at org.ops4j.pax.exam.junit.PaxExam.run(PaxExam.java:93)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Process finished with exit code 254

java.lang.RuntimeException: Cannot get the remote bundle context

    at org.ops4j.pax.exam.rbc.client.intern.RemoteBundleContextClientImpl.getRemoteBundleContext(RemoteBundleContextClientImpl.java:261)
    at org.ops4j.pax.exam.rbc.client.intern.RemoteBundleContextClientImpl.waitForState(RemoteBundleContextClientImpl.java:218)
    at org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.waitForState(KarafTestContainer.java:659)
    at org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.startKaraf(KarafTestContainer.java:262)
    at org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.start(KarafTestContainer.java:194)
    at org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactor.setUp(EagerSingleStagedReactor.java:86)
    at org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactor.beforeClass(EagerSingleStagedReactor.java:136)
    at org.ops4j.pax.exam.spi.reactors.ReactorManager.beforeClass(ReactorManager.java:457)
    at org.ops4j.pax.exam.junit.impl.ProbeRunner.run(ProbeRunner.java:97)
    at org.ops4j.pax.exam.junit.PaxExam.run(PaxExam.java:93)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.rmi.NotBoundException: 572ce6a6-fc5b-4884-a699-2c7a0132875e
    at java.rmi/sun.rmi.registry.RegistryImpl.lookup(RegistryImpl.java:234)
    at java.rmi/sun.rmi.registry.RegistryImpl_Skel.dispatch(RegistryImpl_Skel.java:115)
    at java.rmi/sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:467)
    at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:297)
    at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
    at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
    at java.rmi/sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:283)
    at java.rmi/sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:260)
    at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:375)
    at java.rmi/sun.rmi.registry.RegistryImpl_Stub.lookup(RegistryImpl_Stub.java:119)
    at org.ops4j.pax.exam.rbc.client.intern.RemoteBundleContextClientImpl.getRemoteBundleContext(RemoteBundleContextClientImpl.java:248)
    ... 14 more

I'm using Oracle Java 11.0.1

On 26/12/2018 23:01, Freeman Fang wrote:
> Hi,
>
> Please use PAX-EXAM 4.13.1, which will address this issue.
>
> Cheers
> -------------
> Freeman(Yue) Fang
>
> Red Hat, Inc. 
>
>
>
>
>
>> On Dec 27, 2018, at 2:42 AM, Kerry <karaf-user@avionicengineers.com <ma...@avionicengineers.com>> wrote:
>>
>> Thanks Freeman. I've ended up using
>>
>> new VMOption("-p"), new VMOption("/usr/lib/jvm/jfx1.11.0/lib"),
>> new VMOption("--add-modules"), new VMOption("javafx.base,javafx.controls,javafx.fxml,javafx.graphics")
>>
>> Which seems to do the trick but I've got a Karaf start up issue now to solve:
>>
>> Cannot access RandomAccessFile java.io.FileNotFoundException: /karaf.log (Permission denied) java.io.FileNotFoundException: /karaf.log (Permission denied)
>>
>> Looks like it's looking in the root directory for the log file so something must be different about the configuration and need to work out what has changed (I've previously had the tests working under earlier versions of Karaf and Java)
>>
>>
>> Kerry
>>
>> On 23/12/2018 23:21, Freeman Fang wrote:
>>>
>>> -------------
>>> Freeman(Yue) Fang
>>>
>>> Red Hat, Inc. 
>>>
>>>
>>>
>>>
>>>
>>>> On Dec 24, 2018, at 4:38 AM, Kerry <karaf-user@avionicengineers.com <ma...@avionicengineers.com>> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I'm trying to to get my project FlexFx to work on Java 11 with OpenJFX 11 inside Karaf 4.2.2 and have so far managed to get it to work by manually deploying the OpenJFX jars to the `jdk9plus` folder of Karaf.
>>>>
>>>> I am now trying to update the integration tests which use Pax Exam and because JavaFX is no longer part of the JDK-11 I need to include these in the Karaf configuration. To begin with I tried this:
>>>>
>>>> bootClasspathLibraries(
>>>>     new BootClasspathLibraryOption(mavenBundle().artifactId(OPENJFX_BASE_ARTIFACT_ID).groupId(OPENJFX_GROUP_ID).version(OPENFX_VERSION)),
>>>>     new BootClasspathLibraryOption(mavenBundle().artifactId(OPENJFX_CONTROLS_ARTIFACT_ID).groupId(OPENJFX_GROUP_ID).version(OPENFX_VERSION)),
>>>>     new BootClasspathLibraryOption(mavenBundle().artifactId(OPENJFX_FXML_ARTIFACT_ID).groupId(OPENJFX_GROUP_ID).version(OPENFX_VERSION)))
>>>>
>>>> but this only put the artifacts into the lib folder not `lib/jdk9plus`
>>>
>>> Then I think you can add 
>>>
>>> new VMOption("-classpath"),
>>>                 new VMOption(“lib/whatever_yourlib_is")
>>>
>>>>
>>>> Also (and this is where I am still new and confused with the Java9 + module system) the above artifacts are not the actual ones I used when I manually installed OpenJFX to Karaf. I manually installed the SDK from gluon (https://gluonhq.com/products/javafx/) and this zip file includes native libraries as well as JARs. These are what I think I should be installing automatically but I'm uncertain how I can go about this with PaxExam.
>>>>
>>>> Does anyone have any suggestions?
>>>>
>>>> Thanks, Kerry.
>>>>
>>>>
>>>
>

Re: Karaf 4.2.2, Java 11, OpenJFX 11 and PaxExam

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

Please use PAX-EXAM 4.13.1, which will address this issue.

Cheers
-------------
Freeman(Yue) Fang

Red Hat, Inc. 





> On Dec 27, 2018, at 2:42 AM, Kerry <ka...@avionicengineers.com> wrote:
> 
> Thanks Freeman. I've ended up using
> 
> new VMOption("-p"), new VMOption("/usr/lib/jvm/jfx1.11.0/lib"),
> new VMOption("--add-modules"), new VMOption("javafx.base,javafx.controls,javafx.fxml,javafx.graphics")
> 
> Which seems to do the trick but I've got a Karaf start up issue now to solve:
> 
> Cannot access RandomAccessFile java.io.FileNotFoundException: /karaf.log (Permission denied) java.io.FileNotFoundException: /karaf.log (Permission denied)
> 
> Looks like it's looking in the root directory for the log file so something must be different about the configuration and need to work out what has changed (I've previously had the tests working under earlier versions of Karaf and Java)
> 
> 
> Kerry
> On 23/12/2018 23:21, Freeman Fang wrote:
>> 
>> -------------
>> Freeman(Yue) Fang
>> 
>> Red Hat, Inc. 
>> 
>> 
>> 
>> 
>> 
>>> On Dec 24, 2018, at 4:38 AM, Kerry <karaf-user@avionicengineers.com <ma...@avionicengineers.com>> wrote:
>>> 
>>> Hi,
>>> 
>>> I'm trying to to get my project FlexFx to work on Java 11 with OpenJFX 11 inside Karaf 4.2.2 and have so far managed to get it to work by manually deploying the OpenJFX jars to the `jdk9plus` folder of Karaf.
>>> 
>>> I am now trying to update the integration tests which use Pax Exam and because JavaFX is no longer part of the JDK-11 I need to include these in the Karaf configuration. To begin with I tried this:
>>> 
>>> bootClasspathLibraries(
>>>     new BootClasspathLibraryOption(mavenBundle().artifactId(OPENJFX_BASE_ARTIFACT_ID).groupId(OPENJFX_GROUP_ID).version(OPENFX_VERSION)),
>>>     new BootClasspathLibraryOption(mavenBundle().artifactId(OPENJFX_CONTROLS_ARTIFACT_ID).groupId(OPENJFX_GROUP_ID).version(OPENFX_VERSION)),
>>>     new BootClasspathLibraryOption(mavenBundle().artifactId(OPENJFX_FXML_ARTIFACT_ID).groupId(OPENJFX_GROUP_ID).version(OPENFX_VERSION)))
>>> 
>>> but this only put the artifacts into the lib folder not `lib/jdk9plus`
>> 
>> Then I think you can add 
>> 
>> new VMOption("-classpath"),
>>                 new VMOption(“lib/whatever_yourlib_is")
>> 
>>> 
>>> Also (and this is where I am still new and confused with the Java9 + module system) the above artifacts are not the actual ones I used when I manually installed OpenJFX to Karaf. I manually installed the SDK from gluon (https://gluonhq.com/products/javafx/ <https://gluonhq.com/products/javafx/>) and this zip file includes native libraries as well as JARs. These are what I think I should be installing automatically but I'm uncertain how I can go about this with PaxExam.
>>> 
>>> Does anyone have any suggestions?
>>> 
>>> Thanks, Kerry.
>>> 
>>> 
>> 


Re: Karaf 4.2.2, Java 11, OpenJFX 11 and PaxExam

Posted by Kerry <ka...@avionicengineers.com>.
Thanks Freeman. I've ended up using

new VMOption("-p"), new VMOption("/usr/lib/jvm/jfx1.11.0/lib"),
new VMOption("--add-modules"), new VMOption("javafx.base,javafx.controls,javafx.fxml,javafx.graphics")

Which seems to do the trick but I've got a Karaf start up issue now to solve:

Cannot access RandomAccessFile java.io.FileNotFoundException: /karaf.log (Permission denied) java.io.FileNotFoundException: /karaf.log (Permission denied)

Looks like it's looking in the root directory for the log file so something must be different about the configuration and need to work out what has changed (I've previously had the tests working under earlier versions of Karaf and Java)


Kerry

On 23/12/2018 23:21, Freeman Fang wrote:
>
> -------------
> Freeman(Yue) Fang
>
> Red Hat, Inc. 
>
>
>
>
>
>> On Dec 24, 2018, at 4:38 AM, Kerry <karaf-user@avionicengineers.com <ma...@avionicengineers.com>> wrote:
>>
>> Hi,
>>
>> I'm trying to to get my project FlexFx to work on Java 11 with OpenJFX 11 inside Karaf 4.2.2 and have so far managed to get it to work by manually deploying the OpenJFX jars to the `jdk9plus` folder of Karaf.
>>
>> I am now trying to update the integration tests which use Pax Exam and because JavaFX is no longer part of the JDK-11 I need to include these in the Karaf configuration. To begin with I tried this:
>>
>> bootClasspathLibraries(
>>     new BootClasspathLibraryOption(mavenBundle().artifactId(OPENJFX_BASE_ARTIFACT_ID).groupId(OPENJFX_GROUP_ID).version(OPENFX_VERSION)),
>>     new BootClasspathLibraryOption(mavenBundle().artifactId(OPENJFX_CONTROLS_ARTIFACT_ID).groupId(OPENJFX_GROUP_ID).version(OPENFX_VERSION)),
>>     new BootClasspathLibraryOption(mavenBundle().artifactId(OPENJFX_FXML_ARTIFACT_ID).groupId(OPENJFX_GROUP_ID).version(OPENFX_VERSION)))
>>
>> but this only put the artifacts into the lib folder not `lib/jdk9plus`
>
> Then I think you can add 
>
> new VMOption("-classpath"),
>                 new VMOption(“lib/whatever_yourlib_is")
>
>>
>> Also (and this is where I am still new and confused with the Java9 + module system) the above artifacts are not the actual ones I used when I manually installed OpenJFX to Karaf. I manually installed the SDK from gluon (https://gluonhq.com/products/javafx/) and this zip file includes native libraries as well as JARs. These are what I think I should be installing automatically but I'm uncertain how I can go about this with PaxExam.
>>
>> Does anyone have any suggestions?
>>
>> Thanks, Kerry.
>>
>>
>

Re: Karaf 4.2.2, Java 11, OpenJFX 11 and PaxExam

Posted by Freeman Fang <fr...@gmail.com>.
-------------
Freeman(Yue) Fang

Red Hat, Inc. 





> On Dec 24, 2018, at 4:38 AM, Kerry <ka...@avionicengineers.com> wrote:
> 
> Hi,
> 
> I'm trying to to get my project FlexFx to work on Java 11 with OpenJFX 11 inside Karaf 4.2.2 and have so far managed to get it to work by manually deploying the OpenJFX jars to the `jdk9plus` folder of Karaf.
> 
> I am now trying to update the integration tests which use Pax Exam and because JavaFX is no longer part of the JDK-11 I need to include these in the Karaf configuration. To begin with I tried this:
> 
> bootClasspathLibraries(
>     new BootClasspathLibraryOption(mavenBundle().artifactId(OPENJFX_BASE_ARTIFACT_ID).groupId(OPENJFX_GROUP_ID).version(OPENFX_VERSION)),
>     new BootClasspathLibraryOption(mavenBundle().artifactId(OPENJFX_CONTROLS_ARTIFACT_ID).groupId(OPENJFX_GROUP_ID).version(OPENFX_VERSION)),
>     new BootClasspathLibraryOption(mavenBundle().artifactId(OPENJFX_FXML_ARTIFACT_ID).groupId(OPENJFX_GROUP_ID).version(OPENFX_VERSION)))
> 
> but this only put the artifacts into the lib folder not `lib/jdk9plus`

Then I think you can add 

new VMOption("-classpath"),
                new VMOption(“lib/whatever_yourlib_is")

> 
> Also (and this is where I am still new and confused with the Java9 + module system) the above artifacts are not the actual ones I used when I manually installed OpenJFX to Karaf. I manually installed the SDK from gluon (https://gluonhq.com/products/javafx/) and this zip file includes native libraries as well as JARs. These are what I think I should be installing automatically but I'm uncertain how I can go about this with PaxExam.
> 
> Does anyone have any suggestions?
> 
> Thanks, Kerry.
> 
>