Pessoal, ja tentei de tudo e nao estou conseguindo resolver este erro, fiz o mapeamento do meu banco utilizando JPA(anotacoes), configurei o arquivo persistence.xml, o mesmo esta na pasta META-INF, o ID dele e SGPPU, mas ao executar o comando Persistence.createEntityManagerFactory(“SGPPU”); esta dando o seguinte erro:
Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException
at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:120)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
Alguem sabe o q pode ser?
Pessoal segue meu codigo:
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
/**
*
-
@author Diego
*/
public class Main {
public static void main(String args[]) {
EntityManagerFactory factory = Persistence
.createEntityManagerFactory(“SGPPU”);
EntityManager em = factory.createEntityManager();
JfLogin formLogin = new JfLogin(em);
formLogin.setVisible(true);
}
}
Esse e meu persistence
<?xml version=“1.0” encoding=“UTF-8”?>
<persistence version=“1.0” xmlns=“http://java.sun.com/xml/ns/persistence” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=“http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd”>
<persistence-unit name=“SGPPU” transaction-type=“RESOURCE_LOCAL”>
<provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
<class>sgp.model.Categoriacontas</class>
<class>sgp.model.Saldo</class>
<class>sgp.model.Contasreceber</class>
<class>sgp.model.Contatos</class>
<class>sgp.model.Compromissos</class>
<class>sgp.model.Nivelacesso</class>
<class>sgp.model.Usuarios</class>
<class>sgp.model.Transacoes</class>
<class>sgp.model.Endereco</class>
<class>sgp.model.Contaspagar</class>
<properties>
<property name=“toplink.jdbc.url” value=“jdbc:mysql://lptdie:3306/sgp”/>
<property name=“toplink.jdbc.user” value=“root”/>
<property name=“toplink.jdbc.driver” value=“com.mysql.jdbc.Driver”/>
<property name=“toplink.jdbc.password” value=“root”/>
</properties>
</persistence-unit>
</persistence>
Pessoal, achei mto estranho mas quando eu abri esse mesmo projeto no eclipse ele rodou beleza… acho que era pau do netbeans !!!
Abracos!