Erro ao entrar no Sistema fora do NetBeans

6 respostas
fejohann

Ola, criei um sistema, enquanto testava-o no ambiente de desenvolvimento, tudo blz… mas quando gerei o jar, ele simplesmente não funciona, acessa a tela inicial, mas quando precisa fazer consulta ao BD, dá erro!

Iniciei ele via prompt, e vi que dá erro em minha ClienteDAO, na linha 19.

e essa linha chama a abertura da Seção

session = HibernateUtil.getSession();

Mas não tem nada de errado, pois funciona quando executo a partir do NetBeans!

Agradeço!

6 Respostas

adriano_si

Bom, pode não ser no seu código, mas alguma coisa errada tem, senão estava funcionando.

Posta toda a Stack Trace para vermos qual o erro específico que está dando.

Abs []

fejohann

eis o meu “retorno”

Informaþ§es: Configuration resource: /hibernate.cfg.xml
org.hibernate.HibernateException: /hibernate.cfg.xml not found
        at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java
:147)
        at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configura
tion.java:1405)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1427)
        at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfigu
ration.java:972)
        at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfigu
ration.java:69)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1414)
        at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfigu
ration.java:966)
        at Util.HibernateUtil.<clinit>(HibernateUtil.java:18)
        at DAO.ClienteDAO.<init>(ClienteDAO.java:19)
        at View.CadastroClienteView.Listar(CadastroClienteView.java:344)
        at View.CadastroClienteView.jbInit(CadastroClienteView.java:337)
        at View.CadastroClienteView.<init>(CadastroClienteView.java:96)
        at View.Principal.menuFileCadastroCliente_actionPerformed(Principal.java
:103)
        at View.Principal.access$100(Principal.java:17)
        at View.Principal$3.actionPerformed(Principal.java:61)
        at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
        at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        at javax.swing.AbstractButton.doClick(Unknown Source)
        at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
        at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown
Source)
        at java.awt.Component.processMouseEvent(Unknown Source)
        at javax.swing.JComponent.processMouseEvent(Unknown Source)
        at java.awt.Component.processEvent(Unknown Source)
        at java.awt.Container.processEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Window.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        at java.awt.EventQueue.access$000(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour
ce)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour
ce)
        at java.awt.EventQueue$4.run(Unknown Source)
        at java.awt.EventQueue$4.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour
ce)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)
java.lang.NullPointerException
        at Util.HibernateUtil.getSession(HibernateUtil.java:34)
        at DAO.ClienteDAO.<init>(ClienteDAO.java:19)
        at View.CadastroClienteView.Listar(CadastroClienteView.java:344)
        at View.CadastroClienteView.jbInit(CadastroClienteView.java:337)
        at View.CadastroClienteView.<init>(CadastroClienteView.java:96)
        at View.Principal.menuFileCadastroCliente_actionPerformed(Principal.java
:103)
        at View.Principal.access$100(Principal.java:17)
        at View.Principal$3.actionPerformed(Principal.java:61)
        at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
        at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        at javax.swing.AbstractButton.doClick(Unknown Source)
        at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
        at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown
Source)
        at java.awt.Component.processMouseEvent(Unknown Source)
        at javax.swing.JComponent.processMouseEvent(Unknown Source)
        at java.awt.Component.processEvent(Unknown Source)
        at java.awt.Container.processEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Window.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        at java.awt.EventQueue.access$000(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour
ce)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour
ce)
        at java.awt.EventQueue$4.run(Unknown Source)
        at java.awt.EventQueue$4.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour
ce)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)
fejohann

O engraçado é que o Hibernate.cfg.xml esta no pacote padrão, e copiei ele pra outro pacote, e tb n funcionou!

thiago.fernandes

Cra não sou expert em java, mas ele não está realmente é encontrando o arquivo de configuração do hibernate. tem alguma diferença significativa de paths no seu desenvolvimento para produção?

fejohann

A princípio não tem diferença alguma, talvez com relação as bibliotecas, mas com relação ao hibernate.cfg.xml não!

fejohann

Alguém?

Criado 22 de agosto de 2012
Ultima resposta 24 de ago. de 2012
Respostas 6
Participantes 3