Boa noite, Galera!
Alguém poderia me ajudar com esse erro… Já tentei de tudo mas ainda não descobrir o problema…
ant -f C:\\Users\\luanp\\Documents\\NetBeansProjects\\Easypaper jfxsa-run
init:
Deleting: C:\Users\luanp\Documents\NetBeansProjects\Easypaper\build\built-jar.properties
deps-jar:
Updating property file: C:\Users\luanp\Documents\NetBeansProjects\Easypaper\build\built-jar.properties
Compiling 2 source files to C:\Users\luanp\Documents\NetBeansProjects\Easypaper\build\classes
Note: Hibernate JPA 2 Static-Metamodel Generator 4.3.1.Final
warning: The following options were not recognized by any processor: '[eclipselink.canonicalmodel.use_static_factory]'
compile:
Deleting directory C:\Users\luanp\Documents\NetBeansProjects\Easypaper\dist\lib
Copying 18 files to C:\Users\luanp\Documents\NetBeansProjects\Easypaper\dist\lib
Detected JavaFX Ant API version 1.3
Launching <fx:jar> task from C:\Program Files\Java\jdk1.8.0_212\jre\..\lib\ant-javafx.jar
Warning: From JDK7u25 the Codebase manifest attribute should be used to restrict JAR repurposing.
Please set manifest.custom.codebase property to override the current default non-secure value '*'.
Launching <fx:deploy> task from C:\Program Files\Java\jdk1.8.0_212\jre\..\lib\ant-javafx.jar
No base JDK. Package will use system JRE.
No base JDK. Package will use system JRE.
jfx-deployment-script:
jfx-deployment:
jar:
Copying 30 files to C:\Users\luanp\Documents\NetBeansProjects\Easypaper\dist\run955593222
jfx-project-run:
Executing C:\Users\luanp\Documents\NetBeansProjects\Easypaper\dist\run955593222\Easypaper.jar using platform C:\Program Files\Java\jdk1.8.0_212\jre/bin/java
jun 02, 2019 1:13:57 PM org.hibernate.ejb.HibernatePersistence logDeprecation
WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
jun 02, 2019 1:13:58 PM org.hibernate.ejb.HibernatePersistence logDeprecation
WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
jun 02, 2019 1:13:58 PM org.hibernate.ejb.HibernatePersistence logDeprecation
WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
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$159(LauncherImpl.java:182)
at java.lang.Thread.run(Thread.java:748)
Caused by: javafx.fxml.LoadException:
file:/C:/Users/luanp/Documents/NetBeansProjects/Easypaper/dist/run955593222/Easypaper.jar!/br/com/easypaper/view/FXMLScreenLogin.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.loadImpl(FXMLLoader.java:3214)
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 easypaper.Easypaper.start(Easypaper.java:22)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$166(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$179(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$177(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$178(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$152(WinApplication.java:177)
... 1 more
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.GeneratedMethodAccessor1.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)
... 17 more
Caused by: java.lang.NoClassDefFoundError: org/jboss/jandex/IndexView
at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:51)
at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:129)
at org.hibernate.ejb.HibernatePersistence.getEntityManagerFactoryBuilderOrNull(HibernatePersistence.java:93)
at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:86)
at org.hibernate.ejb.HibernatePersistence.getEntityManagerFactoryBuilderOrNull(HibernatePersistence.java:101)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:67)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:54)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
at br.com.easypaper.connection.JpaUtil.<clinit>(JpaUtil.java:21)
at br.com.easypaper.dao.LoginDAO.<init>(LoginDAO.java:23)
at br.com.easypaper.controller.FXMLScreenLoginController.initialize(FXMLScreenLoginController.java:136)
... 27 more
Caused by: java.lang.ClassNotFoundException: org.jboss.jandex.IndexView
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 39 more
Exception running application easypaper.Easypaper
Java Result: 1
Deleting directory C:\Users\luanp\Documents\NetBeansProjects\Easypaper\dist\run955593222
jfxsa-run:
CONSTRUÍDO COM SUCESSO (tempo total: 6 segundos)
…
Só sei que o problema ocorre quando tento usar a classe LoginDAO.
public List<Usuarios> getUsuarios() {
try {
String jpql = "select u.usuario from usuarios u";
TypedQuery<Usuarios> query = manager.createQuery(jpql, Usuarios.class);
List<Usuarios> usuarios = query.getResultList();
return usuarios;
} catch (Exception e) {
System.out.println(e);
} finally {
manager.close();
JpaUtil.close();
}
return null;
}
…
@FXML
void initialize() {
try {
LoginDAO dao = new LoginDAO(); // <- AQUI
List<Usuarios> list = dao.getUsuarios();
list.forEach((u) -> {
this.getTxtUsuario().getItems().add(u.getUsuario());
});
} catch (Exception e) {
System.out.println(e);
}
}
Esse método me retorna uma lista de usuários do banco de dados…
E com essa lista estou querendo setar em um ComboBox na minha tela de Login FXMLScreenLoginController.java.
package br.com.easypaper.controller;
import br.com.easypaper.model.Usuarios;
import java.net.URL;
import java.util.List;
import java.util.Objects;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.PasswordField;
public class FXMLScreenLoginController {
@FXML
private ResourceBundle resources;
@FXML
private URL location;
@FXML
private ComboBox<String> txtUsuario;
@FXML
private PasswordField txtSenha;
@FXML
private Button btnLogin;
@FXML
private Button btnSair;
public ResourceBundle getResources() {
return resources;
}
public void setResources(ResourceBundle resources) {
this.resources = resources;
}
public URL getLocation() {
return location;
}
public void setLocation(URL location) {
this.location = location;
}
public ComboBox<String> getTxtUsuario() {
return txtUsuario;
}
public void setTxtUsuario(ComboBox<String> txtUsuario) {
this.txtUsuario = txtUsuario;
}
public PasswordField getTxtSenha() {
return txtSenha;
}
public void setTxtSenha(PasswordField txtSenha) {
this.txtSenha = txtSenha;
}
public Button getBtnLogin() {
return btnLogin;
}
public void setBtnLogin(Button btnLogin) {
this.btnLogin = btnLogin;
}
public Button getBtnSair() {
return btnSair;
}
public void setBtnSair(Button btnSair) {
this.btnSair = btnSair;
}
@Override
public int hashCode() {
int hash = 5;
hash = 17 * hash + Objects.hashCode(this.resources);
hash = 17 * hash + Objects.hashCode(this.location);
hash = 17 * hash + Objects.hashCode(this.txtUsuario);
hash = 17 * hash + Objects.hashCode(this.txtSenha);
hash = 17 * hash + Objects.hashCode(this.btnLogin);
hash = 17 * hash + Objects.hashCode(this.btnSair);
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final FXMLScreenLoginController other = (FXMLScreenLoginController) obj;
if (!Objects.equals(this.resources, other.resources)) {
return false;
}
if (!Objects.equals(this.location, other.location)) {
return false;
}
if (!Objects.equals(this.txtUsuario, other.txtUsuario)) {
return false;
}
if (!Objects.equals(this.txtSenha, other.txtSenha)) {
return false;
}
if (!Objects.equals(this.btnLogin, other.btnLogin)) {
return false;
}
if (!Objects.equals(this.btnSair, other.btnSair)) {
return false;
}
return true;
}
@FXML
void login(ActionEvent event) {
}
@FXML
void initialize() {
try {
LoginDAO dao = new LoginDAO();
List<Usuarios> list = dao.getUsuarios();
list.forEach((u) -> {
this.getTxtUsuario().getItems().add(u.getUsuario());
});
} catch (Exception e) {
System.out.println(e);
}
}
}
Essa é a classe principal que chama a FXMLScreenLogin.fxml
public class Easypaper extends Application {
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("/br/com/easypaper/view/FXMLScreenLogin.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);
}
}