Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when starting JavaFXApplication from eclipse #641

Closed
madoar opened this issue Mar 7, 2017 · 9 comments
Closed

Error when starting JavaFXApplication from eclipse #641

madoar opened this issue Mar 7, 2017 · 9 comments

Comments

@madoar
Copy link
Collaborator

madoar commented Mar 7, 2017

I just go a stacktrace when I tried to start JavaFXApplication from eclipse as an Java Application:

Mär 07, 2017 12:24:35 PM org.springframework.context.annotation.AnnotationConfigApplicationContext prepareRefresh
INFORMATION: Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@614d69cd: startup date [Tue Mar 07 12:24:35 CET 2017]; root of context hierarchy
Mär 07, 2017 12:24:35 PM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition
INFORMATION: Overriding bean definition for bean 'viewLibrary' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.phoenicis.javafx.views.mainwindow.library.ViewsConfigurationLibrary; factoryMethodName=viewLibrary; initMethodName=null; destroyMethodName=(inferred); defined in class org.phoenicis.javafx.views.mainwindow.library.ViewsConfigurationLibrary] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.phoenicis.javafx.views.ViewsConfiguration; factoryMethodName=viewLibrary; initMethodName=null; destroyMethodName=(inferred); defined in class org.phoenicis.javafx.views.ViewsConfiguration]
Mär 07, 2017 12:24:35 PM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition
INFORMATION: Overriding bean definition for bean 'consoleTabFactory' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.phoenicis.javafx.views.mainwindow.library.ViewsConfigurationLibrary; factoryMethodName=consoleTabFactory; initMethodName=null; destroyMethodName=(inferred); defined in class org.phoenicis.javafx.views.mainwindow.library.ViewsConfigurationLibrary] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.phoenicis.javafx.views.ViewsConfiguration; factoryMethodName=consoleTabFactory; initMethodName=null; destroyMethodName=(inferred); defined in class org.phoenicis.javafx.views.ViewsConfiguration]
Mär 07, 2017 12:24:35 PM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition
INFORMATION: Overriding bean definition for bean 'operatingSystemFetcher' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.phoenicis.tools.system.SystemConfiguration; factoryMethodName=operatingSystemFetcher; initMethodName=null; destroyMethodName=(inferred); defined in class org.phoenicis.tools.system.SystemConfiguration] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.phoenicis.tools.ToolsConfiguration; factoryMethodName=operatingSystemFetcher; initMethodName=null; destroyMethodName=(inferred); defined in class org.phoenicis.tools.ToolsConfiguration]
Mär 07, 2017 12:24:35 PM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition
INFORMATION: Overriding bean definition for bean 'terminalOpener' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.phoenicis.tools.system.SystemConfiguration; factoryMethodName=terminalOpener; initMethodName=null; destroyMethodName=(inferred); defined in class org.phoenicis.tools.system.SystemConfiguration] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.phoenicis.tools.ToolsConfiguration; factoryMethodName=terminalOpener; initMethodName=null; destroyMethodName=(inferred); defined in class org.phoenicis.tools.ToolsConfiguration]
Mär 07, 2017 12:24:35 PM org.springframework.context.annotation.AnnotationConfigApplicationContext refresh
WARNUNG: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.phoenicis.javafx.controller.ControllerConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.phoenicis.javafx.views.ViewsConfiguration org.phoenicis.javafx.controller.ControllerConfiguration.viewsConfiguration; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.phoenicis.javafx.views.ViewsConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String org.phoenicis.javafx.views.ViewsConfiguration.applicationGitRevision; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'buildNumber' in string value "${buildNumber}"
Exception in Application start method
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
	at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
	at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.phoenicis.javafx.controller.ControllerConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.phoenicis.javafx.views.ViewsConfiguration org.phoenicis.javafx.controller.ControllerConfiguration.viewsConfiguration; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.phoenicis.javafx.views.ViewsConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String org.phoenicis.javafx.views.ViewsConfiguration.applicationGitRevision; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'buildNumber' in string value "${buildNumber}"
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
	at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:84)
	at org.phoenicis.javafx.JavaFXApplication.start(JavaFXApplication.java:42)
	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
	at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
	at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
	at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
	at com.sun.glass.ui.gtk.GtkApplication.lambda$null$49(GtkApplication.java:139)
	... 1 more
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.phoenicis.javafx.views.ViewsConfiguration org.phoenicis.javafx.controller.ControllerConfiguration.viewsConfiguration; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.phoenicis.javafx.views.ViewsConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String org.phoenicis.javafx.views.ViewsConfiguration.applicationGitRevision; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'buildNumber' in string value "${buildNumber}"
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
	... 21 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.phoenicis.javafx.views.ViewsConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String org.phoenicis.javafx.views.ViewsConfiguration.applicationGitRevision; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'buildNumber' in string value "${buildNumber}"
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545)
	... 23 more
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String org.phoenicis.javafx.views.ViewsConfiguration.applicationGitRevision; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'buildNumber' in string value "${buildNumber}"
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
	... 34 more
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'buildNumber' in string value "${buildNumber}"
	at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:174)
	at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126)
	at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:204)
	at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:178)
	at org.springframework.core.env.AbstractPropertyResolver.resolveNestedPlaceholders(AbstractPropertyResolver.java:195)
	at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:87)
	at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:60)
	at org.springframework.core.env.AbstractEnvironment.getProperty(AbstractEnvironment.java:531)
	at org.springframework.context.support.PropertySourcesPlaceholderConfigurer$1.getProperty(PropertySourcesPlaceholderConfigurer.java:132)
	at org.springframework.context.support.PropertySourcesPlaceholderConfigurer$1.getProperty(PropertySourcesPlaceholderConfigurer.java:129)
	at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:83)
	at org.springframework.core.env.PropertySourcesPropertyResolver.getPropertyAsRawString(PropertySourcesPropertyResolver.java:70)
	at org.springframework.core.env.AbstractPropertyResolver$1.resolvePlaceholder(AbstractPropertyResolver.java:207)
	at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:147)
	at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126)
	at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:204)
	at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:178)
	at org.springframework.context.support.PropertySourcesPlaceholderConfigurer$2.resolveStringValue(PropertySourcesPlaceholderConfigurer.java:172)
	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:808)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1027)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545)
	... 36 more
Exception running application org.phoenicis.javafx.JavaFXApplication

Afterwards I've tried to build the application with maven (mvn clean package) and run it via the shell-script in the dist-target zip archive, which worked. Interestingly I got JavaFXApplication to start in eclipse afterwards. Has anyone a clue why this happened?

@plata
Copy link
Collaborator

plata commented Mar 7, 2017

Yes. The version information is created in the validate build step (it creates the buildNumber variable). Obviously, your eclipse did not run the validate step which led to this issue.
I do not know enough about maven to say if this should be handled differently.

@madoar
Copy link
Collaborator Author

madoar commented Mar 7, 2017

Is there a way to detect if no version informations are available?
If yes we could maybe show a string containing "No build number available" is this case, which would prevent such an error.

@plata
Copy link
Collaborator

plata commented Mar 7, 2017

We should just make sure that the validate phase is run. Actually, I don't know why it isn't because the Maven Build Lifecycle says that validate should be run before package (which obviously happens on the console). Maybe it is a problem of how eclipse executes a maven build?

@madoar
Copy link
Collaborator Author

madoar commented Mar 7, 2017

I'm not sure that the normal "Run as Java Application" operation in eclipse uses the complete Maven Build Lifecycle, because as far as I know there are other operations to do this, namely "Run as Maven (build, package, ...)".

@plata
Copy link
Collaborator

plata commented Mar 7, 2017

I guess it's rather an issue of eclipse (or how to use a Maven project in eclipse) than an issue of our software.

@madoar
Copy link
Collaborator Author

madoar commented Mar 7, 2017

I agree with you, but I don't think it's good to see an exception if you want to run POL 5 inside the for development suggested IDE, which is eclipse, as far as I understand the formatter etc. instructions inside the README.md file.

@plata
Copy link
Collaborator

plata commented Mar 7, 2017

That's true. However, I cannot help because I'm using Intellij IDEA myself.

@madoar
Copy link
Collaborator Author

madoar commented Mar 7, 2017

Not sure if this helps, but after asking google I found out, that it's possible to define default values that are loaded if the property wasn't found.
For more information see here.

@plata
Copy link
Collaborator

plata commented Mar 7, 2017

We could set defaults. But in the end this doesn't solve the problem (we need to make sure that the validate build step is called and adjust the eclipse description accordingly).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants