Java Fx displayed Exception in Application start method - java

I am a beginner of JavaFX. When I create a JavaFX project with Scene Builder. I just run and check the default user interface and got an error. The full stack trace is attached below. I don't know how to solve this problem.
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$1(LauncherImpl.java:182)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException: Location is required.
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3207)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
at javafxapplication9.JavaFXApplication9.start(JavaFXApplication9.java:22)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$4(WinApplication.java:186)
... 1 more
Exception running application javafxapplication9.JavaFXApplication9
C:\Users\kobinath\Documents\NetBeansProjects\JavaFXApplication9\nbproject\build-impl.xml:1052: The following error occurred while executing this line:
C:\Users\kobinath\Documents\NetBeansProjects\JavaFXApplication9\nbproject\build-impl.xml:806: Java returned: 1
BUILD FAILED (total time: 1 second)
i don't know why. what i tried so far i attached below
public class JavaFXApplication9 extends Application {
#Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
/**
* #param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
FXMLDocumentController
public class FXMLDocumentController implements Initializable {
#FXML
private Label label;
#FXML
private void handleButtonAction(ActionEvent event) {
System.out.println("You clicked me!");
label.setText("Hello World!");
}
#Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}
}

Related

Spring remoting proxy injection to a spring defined FXMLController in initialization throws NoSuchBeanDefinitionException

As the title says, i have a server application which defines a RmiServiceExporter like this:
#Bean
RmiServiceExporter exporter() {
Class<Service> serviceInterface = Service.class;
RmiServiceExporter exporter = new RmiServiceExporter();
exporter.setServiceInterface(serviceInterface);
exporter.setService(service());
exporter.setServiceName("Service");//serviceInterface.getSimpleName());
exporter.setRegistryPort(1099);
return exporter;
}
and a client application, in which i have a spring configured loginScene and the RmiProxyFactoryBean.
This is the Client Spring configuration:
#Configuration
public class ClientConfig {
#Bean
public Stage primaryStage() {
return new Stage();
}
#Bean
RmiProxyFactoryBean service() {
RmiProxyFactoryBean rmiProxyFactory = new RmiProxyFactoryBean();
rmiProxyFactory.setServiceUrl("rmi://127.0.0.1:1099/Service");
rmiProxyFactory.setServiceInterface(Service.class);
return rmiProxyFactory;
}
#Bean
public Scene loginScene(){
final FXMLLoader loader = new FXMLLoader(getClass().getResource("/FXMLs/LoginFXML.fxml"));
try {
return new Scene(loader.load());
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
In the LoginController, i have an initialization method, which tries to get the service bean from the ApplicationContext, but instead NoSuchBeanDefinitionException is thrown.
Here is the LoginController:
#Data
public class LoginController {
private ApplicationContext factory;
private Service service;
#FXML private TextField textfield_username;
#FXML private PasswordField textfield_password;
#FXML
public void initialize(){
factory = new AnnotationConfigApplicationContext("Configurations.ClientConfig");
service = (Service) factory.getBean("service");
}
#FXML
private void textUsernameKeypressed(KeyEvent keyEvent) {
onEnterLogin(keyEvent);
}
#FXML
private void textPasswordKeypressed(KeyEvent keyEvent) {
onEnterLogin(keyEvent);
}
#FXML
private void buttonKeypressed(KeyEvent keyEvent) {
onEnterLogin(keyEvent);
}
private void onEnterLogin(KeyEvent keyEvent){
if (keyEvent.getCode().equals(KeyCode.ENTER))
login();
}
#FXML
private void loginButtonPressed(ActionEvent actionEvent) {
login();
}
private void login(){
try {
service.login(textfield_username.getText(), textfield_password.getText());
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setContentText("Login succesfull");
alert.show();
} catch (ServiceException e) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setContentText("Login failed: " + e.getMessage());
alert.show();
}
}
}
And here is the exception stacktrace:
/usr/lib/jvm/java-8-openjdk/bin/java -javaagent:/opt/intellij-idea-ultimate-edition/lib/idea_rt.jar=38303:/opt/intellij-idea-ultimate-edition/bin -Dfile.encoding=UTF-8 -classpath /usr/lib/jvm/java-8-openjdk/jre/lib/charsets.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/cldrdata.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/jaccess.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/jfxrt.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/nashorn.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/jce.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/jfxswt.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/jsse.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/resources.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/rt.jar:/home/bobby/Faculta/CurseAutobuze/Client/out/production/classes:/home/bobby/Faculta/CurseAutobuze/Client/out/production/resources:/home/bobby/Faculta/CurseAutobuze/Common/out/production/classes:/home/bobby/.gradle/caches/modules-2/files-2.1/org.projectlombok/lombok/1.16.18/557d13dcb647038dc687390711ccb5c9b3ffbd60/lombok-1.16.18.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.springframework.data/spring-data-jpa/2.0.5.RELEASE/51b2e315174e32b4c8a4841a147002555add076c/spring-data-jpa-2.0.5.RELEASE.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.hibernate/hibernate-core/5.2.13.Final/830492a74b3013ef75135ea4120b2ac23fa7ad9f/hibernate-core-5.2.13.Final.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.hibernate/hibernate-validator/6.0.7.Final/9e923bb3f45e7e4c7555677f0aab7953d4ea1251/hibernate-validator-6.0.7.Final.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.postgresql/postgresql/42.2.1/b7f61848ac43ae9fa6e38935bfd75628b7fc9086/postgresql-42.2.1.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.springframework.data/spring-data-commons/2.0.5.RELEASE/f5357c650f63f3a187d3d4086a9e9132f33851a6/spring-data-commons-2.0.5.RELEASE.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.springframework/spring-orm/5.0.4.RELEASE/dc83e08ecdb4ab28339f87358b53d75b4a8d1b9/spring-orm-5.0.4.RELEASE.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.springframework/spring-context/5.0.4.RELEASE/3e76d08c851113077642c5704f0f94d5ce58e905/spring-context-5.0.4.RELEASE.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.springframework/spring-aop/5.0.4.RELEASE/f8e029e54c0267dadb6b9f713f3feb54ec4f3a0e/spring-aop-5.0.4.RELEASE.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.springframework/spring-jdbc/5.0.4.RELEASE/6b5ac0db11d81d6319ebd0bb253b2f01713df3ab/spring-jdbc-5.0.4.RELEASE.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.springframework/spring-tx/5.0.4.RELEASE/7afc193c5d2b812ee6d2ccaf6fcc81fb83bfb4a7/spring-tx-5.0.4.RELEASE.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.springframework/spring-beans/5.0.4.RELEASE/7a8c3d48d4c33621e64d1399721d8e067450fcbd/spring-beans-5.0.4.RELEASE.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.springframework/spring-expression/5.0.4.RELEASE/4bda161f2e34c1486f2527a23eb47293567f473c/spring-expression-5.0.4.RELEASE.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/5.0.4.RELEASE/2221a957b5561a34f044350ba4e30ef5870254a3/spring-core-5.0.4.RELEASE.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.aspectj/aspectjrt/1.8.12/afaa5bdae313ed3ea119eb26c8848fca21e8b04e/aspectjrt-1.8.12.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.25/da76ca59f6a57ee3102f8f9bd9cee742973efa8a/slf4j-api-1.7.25.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.hibernate.common/hibernate-commons-annotations/5.0.1.Final/71e1cff3fcb20d3b3af4f3363c3ddb24d33c6879/hibernate-commons-annotations-5.0.1.Final.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.hibernate.validator/hibernate-validator/6.0.7.Final/8b9d9c7ec8c73963ea0fe81912fc67711a4ef76/hibernate-validator-6.0.7.Final.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.jboss.logging/jboss-logging/3.3.1.Final/c46217ab74b532568c0ed31dc599db3048bd1b67/jboss-logging-3.3.1.Final.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final/5e731d961297e5a07290bfaf3db1fbc8bbbf405a/hibernate-jpa-2.1-api-1.0.0.Final.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.javassist/javassist/3.22.0-GA/3e83394258ae2089be7219b971ec21a8288528ad/javassist-3.22.0-GA.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/antlr/antlr/2.7.7/83cd2cd674a217ade95a4bb83a8a14f351f48bd0/antlr-2.7.7.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.jboss.spec.javax.transaction/jboss-transaction-api_1.2_spec/1.0.1.Final/4441f144a2a1f46ed48fcc6b476a4b6295e6d524/jboss-transaction-api_1.2_spec-1.0.1.Final.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.jboss/jandex/2.0.3.Final/bfc4d6257dbff7a33a357f0de116be6ff951d849/jandex-2.0.3.Final.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/com.fasterxml/classmate/1.3.1/2ad2fd09dcf5607ca96f8ef432096a96986c40a/classmate-1.3.1.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/dom4j/dom4j/1.6.1/5d3ccc056b6f056dbf0dddfdf43894b9065a8f94/dom4j-1.6.1.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/org.springframework/spring-jcl/5.0.4.RELEASE/3053e2bad0a18571bdbb9596ce51f9d458f5934f/spring-jcl-5.0.4.RELEASE.jar:/home/bobby/.gradle/caches/modules-2/files-2.1/javax.validation/validation-api/2.0.1.Final/cb855558e6271b1b32e716d24cb85c7f583ce09e/validation-api-2.0.1.Final.jar Main
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
javafx.fxml.LoadException:
/home/bobby/Faculta/CurseAutobuze/Client/out/production/resources/FXMLs/LoginFXML.fxml
at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2571)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
at Configurations.ClientConfig.loginScene(ClientConfig.java:32)
at Configurations.ClientConfig$$EnhancerBySpringCGLIB$$5da32339.CGLIB$loginScene$2(<generated>)
at Configurations.ClientConfig$$EnhancerBySpringCGLIB$$5da32339$$FastClassBySpringCGLIB$$e0e4f3e3.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:361)
at Configurations.ClientConfig$$EnhancerBySpringCGLIB$$5da32339.loginScene(<generated>)
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 org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:579)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1250)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1099)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:88)
at Main.start(Main.java:16)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(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$5(GtkApplication.java:139)
at java.lang.Thread.run(Thread.java:748)
Caused by: 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 sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2566)
... 36 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'service' available
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:686)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1205)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1085)
at Controllers.LoginController.initialize(LoginController.java:28)
... 46 more
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$1(LauncherImpl.java:182)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassCastException: org.springframework.beans.factory.support.NullBean cannot be cast to javafx.scene.Scene
at Main.start(Main.java:19)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(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$5(GtkApplication.java:139)
... 1 more
Exception running application Main
Process finished with exit code 1
I solved the problem here was the problem:
#FXML
public void initialize(){
factory = new AnnotationConfigApplicationContext("Configurations.ClientConfig");
service = (Service) factory.getBean("service");
}
it should've been:
#FXML
public void initialize(){
factory = new AnnotationConfigApplicationContext(ClientConfig.class);
service = (Service) factory.getBean("service");
}

spring with javafx application exception when load fxml after mapping

Without mapping fxml this code run perfectly and load fxml
if i map fxml getting exception
i try alot but unable to understand what is the problem.....
SpringFxmlLoader class method load() return statement not returning anything because of which i think exception occur
javafx.fxml.LoadException:/E:/aa/JavaFXwithSpringBoot/bin/test/spring/boot/LoginPage.fxml:15
at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2579) at
javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441) at
javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409) at
test.spring.boot.config.SpringFXMLLoader.load(SpringFXMLLoader.java:34)
at
test.spring.boot.config.StageManager.loadViewNodeHierarchy(StageManager.java:80)
at
test.spring.boot.config.StageManager.switchScene(StageManager.java:31)
at test.spring.boot.Main.displayInitialScene(Main.java:35) at
test.spring.boot.Main.start(Main.java:24) 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.win.WinApplication._runLoop(Native Method) at
com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Unknown Source) Caused by:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
qualifying bean of type 'test.spring.boot.LoginPageController'
available at
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:353)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:340)
at
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1090)
at
javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:929)
at
javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:971)
at
javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:220)
at
javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:744)
at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2707) at
javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2527) ... 16 more
Exception in Application start method 2017-10-24 17:18:03.779 ERROR
6416 --- [lication Thread] test.spring.boot.config.StageManager :
Unable to load FXML view >> /test/spring/boot/LoginPage.fxml
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
qualifying bean of type 'test.spring.boot.LoginPageController'
available at
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:353)
~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:340)
~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1090)
~[spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] at
javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:929)
~[jfxrt.jar:na] at
javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:971)
~[jfxrt.jar:na] at
javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:220)
~[jfxrt.jar:na] at
javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:744)
~[jfxrt.jar:na] at
javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2707)
~[jfxrt.jar:na] at
javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2527) ~[jfxrt.jar:na]
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
~[jfxrt.jar:na] at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
~[jfxrt.jar:na] at
test.spring.boot.config.SpringFXMLLoader.load(SpringFXMLLoader.java:34)
~[bin/:na] at
test.spring.boot.config.StageManager.loadViewNodeHierarchy(StageManager.java:80)
[bin/:na] at
test.spring.boot.config.StageManager.switchScene(StageManager.java:31)
[bin/:na] at test.spring.boot.Main.displayInitialScene(Main.java:35)
[bin/:na] at test.spring.boot.Main.start(Main.java:24) [bin/:na] at
com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
[jfxrt.jar:na] at
com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
~[jfxrt.jar:na] at
com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
~[jfxrt.jar:na] at java.security.AccessController.doPrivileged(Native
Method) ~[na:1.8.0_131] at
com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
~[jfxrt.jar:na] at
com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
~[jfxrt.jar:na] at com.sun.glass.ui.win.WinApplication._runLoop(Native
Method) ~[jfxrt.jar:na] at
com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
~[jfxrt.jar:na] at java.lang.Thread.run(Unknown Source)
~[na:1.8.0_131]
2017-10-24 17:18:03.846 INFO 6416 --- [lication Thread]
s.c.a.AnnotationConfigApplicationContext : Closing
org.springframework.context.annotation.AnnotationConfigApplicationContext#f096164:
startup date [Tue Oct 24 17:18:02 IST 2017]; root of context hierarchy
2017-10-24 17:18:03.848 INFO 6416 --- [lication Thread]
o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed
beans on shutdown java.lang.reflect.InvocationTargetException at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at
java.lang.reflect.Method.invoke(Unknown Source) 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(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at
java.lang.reflect.Method.invoke(Unknown Source) at
sun.launcher.LauncherHelper$FXHelper.main(Unknown Source) 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(Unknown Source) Caused by:
java.lang.NullPointerException: Root cannot be null at
javafx.scene.Scene.(Scene.java:336) at
javafx.scene.Scene.(Scene.java:194) at
test.spring.boot.config.StageManager.prepareScene(StageManager.java:62)
at test.spring.boot.config.StageManager.show(StageManager.java:36) at
test.spring.boot.config.StageManager.switchScene(StageManager.java:32)
at test.spring.boot.Main.displayInitialScene(Main.java:35) at
test.spring.boot.Main.start(Main.java:24) 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.win.WinApplication._runLoop(Native Method) at
com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
... 1 more Exception running application test.spring.boot.Main
Main.java
#ComponentScan("test.spring.boot")
#SpringBootApplication
public class Main extends Application {
protected ConfigurableApplicationContext springContext;
protected StageManager stageManager;
#Override
public void start(Stage primaryStage) throws IOException {
stageManager = springContext.getBean(StageManager.class, primaryStage);
displayInitialScene();
}
#Override
public void init() throws Exception
{
springContext=springBootApplicationContext();
}
protected void displayInitialScene() {
stageManager.switchScene(FxmlView.LOGIN);
}
#Override
public void stop() throws Exception {
springContext.close();
}
private ConfigurableApplicationContext springBootApplicationContext() {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Main.class);
String[] args = getParameters().getRaw().stream().toArray(String[]::new);
return builder.run(args);
}
public static void main(String[] args) {
Application.launch(args);
}
}
Controller.java
public class LoginPageController implements Initializable{
#FXML
private TextField txtUserName;
#FXML
private PasswordField txtPassward;
#FXML
private Button btnLogin;
#FXML
private Label lblLogin;
#Autowired
private UserService userService;
#Lazy
#Autowired
private StageManager stageManager;
#FXML
public void login()
{
if(userService.authenticate(txtUserName.getText(), txtPassward.getText()))
{
stageManager.switchScene(FxmlView.USER);
}
else
{
lblLogin.setText("Login Failed.");
}
}
#Override
public void initialize(URL location, ResourceBundle resources) {
}
}
FxmlView.java
public enum FxmlView {
USER {
#Override
public String getTitle() {
return getStringFromResourceBundle("user.title");
}
#Override
public String getFxmlFile() {
return "/test/spring/boot/TestSpring.fxml";
}
},
LOGIN {
#Override
public String getTitle() {
return getStringFromResourceBundle("login.title");
}
#Override
public String getFxmlFile() {
return "/test/spring/boot/LoginPage.fxml";
}
};
public abstract String getTitle();
public abstract String getFxmlFile();
String getStringFromResourceBundle(String key){
return ResourceBundle.getBundle("Bundle").getString(key);
}
}
SpringFxmlLoader.java
#Component
public class SpringFXMLLoader {
private final ResourceBundle resourceBundle;
private final ApplicationContext context;
#Autowired
public SpringFXMLLoader(ApplicationContext context, ResourceBundle resourceBundle) {
this.resourceBundle = resourceBundle;
this.context = context;
}
public Parent load(String fxmlPath) throws IOException {
FXMLLoader loader = new FXMLLoader();
loader.setControllerFactory(context::getBean); //Spring now FXML Controller Factory
loader.setResources(resourceBundle);
loader.setLocation(getClass().getResource(fxmlPath));
System.out.println("springfxmlloader class : "+fxmlPath);
System.out.println("LOADER : ");
return loader.load();
}
}
StageManager.java
public class StageManager {
private static final Logger LOG = getLogger(StageManager.class);
private final Stage primaryStage;
private final SpringFXMLLoader springFXMLLoader;
public StageManager(SpringFXMLLoader springFXMLLoader, Stage stage) {
System.out.println(">>>>>>>>>>>>>>>>>> 1");
this.springFXMLLoader = springFXMLLoader;
this.primaryStage = stage;
}
public void switchScene(final FxmlView view) {
System.out.println(">>>>>>>>>>>>>>>>>> 2");
Parent viewRootNodeHierarchy = loadViewNodeHierarchy(view.getFxmlFile());
show(viewRootNodeHierarchy, view.getTitle());
}
private void show(final Parent rootnode, String title) {
Scene scene = prepareScene(rootnode);
//scene.getStylesheets().add("/styles/Styles.css");
//primaryStage.initStyle(StageStyle.TRANSPARENT);
primaryStage.setTitle(title);
primaryStage.setScene(scene);
primaryStage.sizeToScene();
primaryStage.centerOnScreen();
System.out.println(">>>>>>>>>>>>>>>>>> 3");
try {
primaryStage.show();
} catch (Exception exception) {
logAndExit ("Unable to show scene for title" + title, exception);
}
}
private Scene prepareScene(Parent rootnode){
System.out.println(">>>>>>>>>>>>>>>>>> 4");
Scene scene = primaryStage.getScene();
System.out.println("SCN >>>>>>>>>>>>>>>>>>>> : "+ scene);
if (scene == null) {
scene = new Scene(rootnode);
}
scene.setRoot(rootnode);
return scene;
}
private Parent loadViewNodeHierarchy(String fxmlFilePath) {
System.out.println(">>>>>>>>>>>>>>>>>> 5 path: "+fxmlFilePath);
Parent rootNode = null;
try {
System.out.println(fxmlFilePath);
rootNode = springFXMLLoader.load(fxmlFilePath);
System.out.println(">>>>5 : try");
Objects.requireNonNull(rootNode, "A Root FXML node must not be null");
} catch (Exception exception) {
System.out.println("File path????? : "+fxmlFilePath);
logAndExit("Unable to load FXML view >> " + fxmlFilePath, exception);
exception.printStackTrace();
}
return rootNode;
}
private void logAndExit(String errorMsg, Exception exception) {
System.out.println(">>>>>>>>>>>>>>>>>> 6");
LOG.error(errorMsg, exception, exception.getCause());
Platform.exit();
}
}
You forgot to add a Stereotype on your LoginPageController class that's why Spring is telling you:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'test.spring.boot.LoginPageController'
As the class is not marked the component-scan will ignore it and there will be no bean register assignable for that type.
Try:
#Controller
public class LoginPageController implements Initializable{
#Autowired
public LoginPageController(UserService userService, private StageManager stageManager){
this.userService = userService;
this.stageManager = stageManager;
}
}

How to make main.java to run an application that is designed by scene builder?

I tried to build a simple scene by using scene builder. But i failed to make a main.java file to run the code! i can't understand what's the wrong!
Here's my FXMLDocumentController.java file:
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
public class FXMLDocumentController {
#FXML
void btnHandle(ActionEvent event) {
}
}
And here's the fxml file:
sample.fxml
And the Main.java
import javafx.application.Application;
import static javafx.application.Application.launch;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
public class Main extends Application {
#Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
/**
* #param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
When i run this code it show error and failed to build:
Exception in Application start method
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: java.lang.NullPointerException: Location is required.
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3207)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
at Main.start(Main.java:15)
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.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
... 1 more
Exception running application Main
C:\Users\Dell\Desktop\Exercise\Java\BasicXml\nbproject\build-impl.xml:1052: The following error occurred while executing this line:
C:\Users\Dell\Desktop\Exercise\Java\BasicXml\nbproject\build-impl.xml:806: Java returned: 1
BUILD FAILED (total time: 0 seconds)
I suggest to cange the root class in the main from Parent to AnchorPane:
public class Main extends Application {
#Override
public void start(Stage stage) throws Exception {
AnchorPane root = FXMLLoader.load(getClass().getResource("sample.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
/**
* #param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}

How to load video in java FX

I want to insert video into javaFX. Insert video from computer - Not from youtube or something.
Play/pause/minimize buttons, borders are not needed.
import java.io.FileNotFoundException;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.scene.media.MediaView;
import javafx.stage.Stage;
public class MediaMP4 extends Application {
Stage window;
Scene scene1;
public static void main(String[] args) {
launch(args);
}
#Override
public void start(Stage primaryStage) throws FileNotFoundException {
window = primaryStage;
primaryStage.setTitle("Moves");
Media media = new Media ("pr.mp4");
MediaPlayer player = new MediaPlayer (media);
MediaView view = new MediaView (player);
Group full = new Group ();
full.getChildren().addAll(view);
scene1 = new Scene (full,600,600);
primaryStage.setScene(scene1);
window.show();
player.play();
}
}
My pr.mp4 file is inside project, not in package.
Stack trace:
Exception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
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(Unknown Source)
Caused by: java.lang.IllegalArgumentException: uri.getScheme() == null! uri == 'pr.mp4'
at com.sun.media.jfxmedia.locator.Locator.<init>(Locator.java:211)
at javafx.scene.media.Media.<init>(Media.java:393)
at vv.MediaMP4.start(MediaMP4.java:27)
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.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
... 1 more
Exception running application vv.MediaMP4
The relevant line in your stack trace is:
Caused by: java.lang.IllegalArgumentException: uri.getScheme() == null! uri == 'pr.mp4'.
You need to specify an URI string with a scheme as a construtor argument, as specified here.
So change your line from this:
Media media = new Media ("pr.mp4");
to something like this:
Media media = new Media("file://c:/myproject/pr.mp4"));
Have a look at this question for more details: How to target a file (a path to it) in Java/JavaFX

MediaPlayer written on JavaFx doesn't work

I only rewrote the code form the video https://www.youtube.com/watch?v=bWl98dhvf8Q (to 7.51). But I use Eclipse(the guy use IntelliJ IDEA), video I have at directory /home/lynda/workspace/Lab11/ and it contains Focus.mp4 , it`s a trailer of the film(2:24).
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.scene.media.MediaView;
import javafx.scene.paint.Color;
public class Player extends Application{
public static void main(String[] args) {
launch(args);
}
#Override
public void start(Stage stage) throws Exception {
Group root = new Group();
Media md = new Media("file:///home/lynda/workspace/Lab11/Focus.mp4");
MediaPlayer plr = new MediaPlayer(md);
MediaView view = new MediaView(plr);
root.getChildren().add(view);
Scene scn = new Scene(root, 400, 400, Color.BLACK);
stage.setScene(scn);
stage.show();
plr.play();
}
}
and I have many problems like this:
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:497)
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:497)
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$152(LauncherImpl.java:182)
at com.sun.javafx.application.LauncherImpl$$Lambda$55/29803442.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
Caused by: MediaException: UNKNOWN : com.sun.media.jfxmedia.MediaException: Could not create player! : com.sun.media.jfxmedia.MediaException: Could not create player!
at javafx.scene.media.MediaException.exceptionToMediaException(MediaException.java:146)
at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:511)
at javafx.scene.media.MediaPlayer.<init>(MediaPlayer.java:414)
at Player.start(Player.java:23)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$159(LauncherImpl.java:863)
at com.sun.javafx.application.LauncherImpl$$Lambda$58/4696732.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$172(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl$$Lambda$50/32203826.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$170(PlatformImpl.java:295)
at com.sun.javafx.application.PlatformImpl$$Lambda$53/23680289.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(PlatformImpl.java:294)
at com.sun.javafx.application.PlatformImpl$$Lambda$51/21992497.run(Unknown Source)
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$48(GtkApplication.java:139)
at com.sun.glass.ui.gtk.GtkApplication$$Lambda$41/22543536.run(Unknown Source)
... 1 more
Caused by: com.sun.media.jfxmedia.MediaException: Could not create player!
at com.sun.media.jfxmediaimpl.NativeMediaManager.getPlayer(NativeMediaManager.java:224)
at com.sun.media.jfxmedia.MediaManager.getPlayer(MediaManager.java:104)
at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:467)
... 16 more
Exception running application Player
And sorry for my English.

Categories

Resources