log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.NullPointerException
at br.com.syscomm.mauricio.persistencia.fabricante.FabricanteDAOHibernate.salvarOuAlterar(FabricanteDAOHibernate.java:32)
at teste.main(teste.java:66)
Pessoal ao tentar persistir minha classe estou tento este estranho erro . Já verifiquei as libs me parece estar tudo ok , alguém já passou por isso?
Objeto
Fabricante fab = new Fabricante("AMBEV", "12345678");
FabricanteDAOHibernate fabDAO = new FabricanteDAOHibernate();
fabDAO.salvarOuAlterar(fab);
Método persistencia
public void salvarOuAlterar(Fabricante fabSalvarAlterar) {
try {
session = HibernateUtil.getSession();
tx = session.beginTransaction();
session.saveOrUpdate(fabSalvarAlterar);
tx.commit();
} catch (Exception e) {
if (tx != null) {
try {
tx.rollback();
} catch (HibernateException he) {
he.getCause();
he.getMessage();
}
}
} finally {
try {
session.close();
} catch (HibernateException he) {
throw he;
}
}
}
//HibernateUtil
private static SessionFactory sessionFactory;
public static SessionFactory getSessionFactory() {
if (sessionFactory == null) {
AnnotationConfiguration cfg = new AnnotationConfiguration();
Configuration config = cfg.configure("hibernate.cfg.xml");
sessionFactory = config.buildSessionFactory();
}
return sessionFactory;
}
public static Session getSession() {
Session sessao = getSessionFactory().openSession();
return sessao;
}
o estranho é que também retorna como nullPointerEx .
Alguma sugestão?