What could cause java.lang.reflect.InvocationTargetException?
You've added an extra level of abstraction by calling the method with reflection. The reflection layer wraps any exception in an InvocationTargetException
, which lets you tell the difference between an exception actually caused by a failure in the reflection call (maybe your argument list wasn't valid, for example) and a failure within the method called.
Just unwrap the cause within the InvocationTargetException
and you'll get to the original one.
I'm getting an java.lang.reflect.InvocationTargetException exception in JavaFX app and I have no idea how to fix it
You've got an initialization order issue. In your StartMenuCtrl
constructor, you're passing a reference to this
to the StartMenuUI
constructor. The StartMenuUi
constructor then calls initComponents
, which calls startMenuCtrl.getStage()
... but that method returns null
because the StartMenuCtrl constructor has not finished executing, and has not yet initialized its primaryStage
field.
Try reordering the lines in the StartMenuCtrl constructor so they're in this order:
this.primaryStage = new Stage(); // this needs to happen first!
this.startMenuUI = new StartMenuUI(this);
This problem illustrates why, generally speaking, it's best not to let the this
reference escape during object construction.
java.lang.reflect.InvocationTargetException error javafx even though there is no code
Your main class extends javafx.application.Application
needs to be public. Change your class as below.
package com.front.fire;
import javafx.application.Application;
import javafx.stage.Stage;
public class FrontFireMain extends Application{
@Override
public void start(Stage arg0) throws Exception {
}
}
error: java.lang.reflect.InvocationTargetException
In the error message you have, there is this line:
Caused by: java.lang.IllegalArgumentException: Can not set java.awt.TextField field ihm_project.LoginController.Email to javafx.scene.control.TextField
so make sure that your text field "Email" is of type javafx.scene.control.TextField
not java.awt.TextField
and to be sure that the type of TextField is the correct type, delete this line in your code import java.awt.*;
, if no error occurs, it means that you are using the correct type
java.lang.reflect.InvocationTargetException: null
Root problem
Caused by: java.sql.SQLFeatureNotSupportedException: Method org.postgresql.jdbc.PgConnection.createClob() is not yet implemented.
Looks like bug https://hibernate.atlassian.net/browse/HHH-12368
They recommended set property (I believe it's the best workaround):
as workaround is to disable hibernate to detect this function by
setting flag hibernate.jdbc.lob.non_contextual_creation=true
The other solution described here: http://vkuzel.blogspot.com.cy/2016/03/spring-boot-jpa-hibernate-atomikos.html
Disable feature detection by this undocumented parameter. Check the org.hibernate.engine.jdbc.internal.JdbcServiceImpl.configure method for more details.
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults = false
So you can also try to add to your Spring boot properties file
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults = false
Related Topics
Why Call Super() in a Constructor
How to Delete Stuff Printed to Console by System.Out.Println()
Parsing an Arithmetic Expression and Building a Tree from It in Java
Createprocess Error=206, the Filename or Extension Is Too Long When Running Main() Method
How to Iterate an Arraylist Inside a Hashmap Using Jstl
Unsupportedoperationexception When Trying to Remove from the List Returned by Array.Aslist
Gmail Rest API:400 Bad Request + Failed Precondition
How to Understand Happens-Before Consistent
Java 8 Nested (Multi Level) Group By
Connection to Db Dies After >4<24 in Spring-Boot JPA Hibernate
How to Iterate Through the Unicode Codepoints of a Java String
Why Is the Catch(Exception) Almost Always a Bad Idea
Different Dependencies for Different Build Profiles
Content Is Not Allowed in Prolog Saxparserexception
Jersey /* Servlet Mapping Causes 404 Error for Static Resources