You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Nino Martinez (JIRA)" <ji...@apache.org> on 2016/06/20 06:05:05 UTC
[jira] [Commented] (FELIX-4784) Using iPOJO in a JavaFX Application
[ https://issues.apache.org/jira/browse/FELIX-4784?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15339047#comment-15339047 ]
Nino Martinez commented on FELIX-4784:
--------------------------------------
Any idea on when of if work will begin on this?
> Using iPOJO in a JavaFX Application
> -----------------------------------
>
> Key: FELIX-4784
> URL: https://issues.apache.org/jira/browse/FELIX-4784
> Project: Felix
> Issue Type: Bug
> Components: iPOJO
> Environment: Ubuntu 14.04, Java 8 - JavaFX 8, Apache Felix
> Reporter: Arjay Sitoy
>
> I am doing a Javafx application in {{Apache Felix}} along with some experiments using {{iPOJO}}. I also posted the same question in [*StackOverflow*|http://stackoverflow.com/questions/28289948/using-ipojo-in-a-javafx-application].
> First is I called the {{Application.launch()}} method in a different class and then start an another class containing the iPOJO {{@Requires}} like this:
> {code}
> public class JavafxApp extends Application {
> @Override
> public void start(Stage primaryStage){
> /* Do nothing here because I thought I can initialize JavaFX in a different class */
> }
> public void start(){
> Platform.runLater(() -> {
> launch(JavafxApplication.class);
> });
> }
> }
> public class MyApplication {
> @Requires
> LibraryClass class;
> @Validate
> public void start(){
> JavafxApp.start();
> class.someMethod();
> }
> }
> {code}
> This implementation throws this exception, {{java.lang.IllegalStateException: Toolkit not initialized}} but the iPOJO located the implementation class of the {{LibraryClass}} interface.
> After some research I found out that the application should be inside the class that extends the {{javafx.application.Application}} so I did some restructuring.
> {code}
> public class JavafxApp extends Application {
> @Requires
> LibraryClass class;
> @Override
> public void start(Stage primaryStage){
> class.someMethod();
> }
> @Validate
> public void start(){
> launch(JavafxApp.class);
> }
> }
> {code}
> Now the iPOJO throws a {{RuntimeException}} and the {{LibraryClass}} becomes null and the application throws a {{NullPointerException}}.
> My questions are:
> - Is it possible to use iPOJO in this situation?
> - If it is what is the right way to use iPOJO in a JavaFX application?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)