Hibernate Java, NullException

beatsmicro

Usuario Nuevo nvl. 1
8 Ene 2010
36
0
6
Debo realizar una aplicación de escritorio que descargue unos archivos (.xls) desde una pagina en donde se exige registro. Existía una aplicacion en Java que ya funcionaba, y he seguido la linea de dicha app. Esta trabaja con Hibernate, pero hay unos errores que aun no logro resolver. Este es el log de excepciones:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at Negocio.NegClaves.<init>(NegClaves.java:21)
at Control.ControlUEN.<init>(ControlUEN.java:9)
at Vista.Principal.btnIniciarActionPerformed(Principa l.java:204)
at Vista.Principal.access$000(Principal.java:18)
at Vista.Principal$1.actionPerformed(Principal.java:5 8)
at javax.swing.AbstractButton.fireActionPerformed(Abs tractButton.java:2018)
at javax.swing.AbstractButton$Handler.actionPerformed (AbstractButton.java:2341)
at javax.swing.DefaultButtonModel.fireActionPerformed (DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultB uttonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.jav a:6516)
at javax.swing.JComponent.processMouseEvent(JComponen t.java:3321)
at java.awt.Component.processEvent(Component.java:628 1)
at java.awt.Container.processEvent(Container.java:222 9)
at java.awt.Component.dispatchEventImpl(Component.jav a:4872)
at java.awt.Container.dispatchEventImpl(Container.jav a:2287)
at java.awt.Component.dispatchEvent(Component.java:46 98)
at java.awt.LightweightDispatcher.retargetMouseEvent( Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(C ontainer.java:4492)
at java.awt.LightweightDispatcher.dispatchEvent(Conta iner.java:4422)
at java.awt.Container.dispatchEventImpl(Container.jav a:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2719 )
at java.awt.Component.dispatchEvent(Component.java:46 98)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.j ava:747)
at java.awt.EventQueue.access$300(EventQueue.java:103 )
at java.awt.EventQueue$3.run(EventQueue.java:706)
at java.awt.EventQueue$3.run(EventQueue.java:704)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPri vilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPri vilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:720)
at java.awt.EventQueue$4.run(EventQueue.java:718)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPri vilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java: 717)
at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:91)

Codigo de HibernateUtil.

t java.io.PrintStream;
Código:
import org.hibernate.cfg.Configuration;import org.hibernate.SessionFactory;public class Neimport java.io.File;
imporgHibernateUtil {    private static SessionFactory sessionFactory = buildSessionFactory();        private static SessionFactory buildSessionFactory() {        try {            // Create the SessionFactory from standard (hibernate.cfg.xml)             // config file.                        //return new Configuration().configure().buildSessionFactory();                        sessionFactory = new Configuration().configure().buildSessionFactory();                    } catch (Throwable ex) {            // Log the exception.             System.err.println("Initial SessionFactory creation failed." + ex);            throw new ExceptionInInitializerError(ex);        }        return null;    }        public static SessionFactory getSessionFactory() {        return sessionFactory;    }

Codigo NegClaves:


import Entidades.ClavesRl;
Código:
import static Negocio.NegHibernateUtil.getSessionFactory;import static java.sql.DriverManager.println;import java.util.List;import org.hibernate.Query;import org.hibernate.Session;import org.hibernate.SessionFactory;import org.hibernate.Transaction;public class NegClaves {         Session sesion;    public NegClaves(){        //this.sesion = (Session) getSessionFactory();    this.sesion = NegHibernateUtil.getSessionFactory().openSession();  }    public String clave(String UEN){    Query q;    q = this.sesion.createQuery("from ClavesRl where UEN='" + UEN + "'");    List<ClavesRl> clave = q.list();    String retorno = ((ClavesRl)clave.get(0)).getPass();        return retorno;  }    public ClavesRl todo(String UEN){    Query q;     q = this.sesion.createQuery("from ClavesRl where UEN='" + UEN + "'");    List<ClavesRl> clave = q.list();    ClavesRl retorno = (ClavesRl)clave.get(0);        return retorno;  }    public boolean uppClave(ClavesRl p)    throws Exception  {    this.sesion.clear();    Transaction tx = this.sesion.beginTransaction();    this.sesion.saveOrUpdate(p);    tx.commit();    return true;  }

Favor ayuda