Erro Hibernate somente pelo jar

3 respostas
GouverMXT

Minha aplicação utiliza Hibernate e roda normalmente quando mando executar pela IDE, mas quando mando construir (pelo Netbeans) e executo a aplicação pelo jar gerado recebo o seguinte erro quando tento fazer o login:

Microsoft Windows [versao 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Todos os direitos reservados.

C:\Users\Brazil>d:

D:\>cd Documentos

D:\Documentos>cd "My Dropbox"

D:\Documentos\My Dropbox>cd ProjetosNetBeans

D:\Documentos\My Dropbox\ProjetosNetBeans>cd Matheca

Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: javax.persis
tence.OneToOne.orphanRemoval()Z
        at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(Annotati
onBinder.java:1560)
        at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(An
notationBinder.java:762)
        at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:72
6)
        at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(Anno
tationConfiguration.java:636)
        at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(Annotatio
nConfiguration.java:359)
        at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1206
)
        at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.j
ava:1449)
        at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerCo
nfigurator.java:193)
        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:
1077)
        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:
275)
        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:
359)
        at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(Hib
ernatePersistence.java:55)
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.
java:51)
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.
java:33)
        at Util.HibernateUtil.<clinit>(HibernateUtil.java:23)
        at DAO.GenericDAO.<init>(GenericDAO.java:17)
        at DAO.PessoaDAO.<init>(PessoaDAO.java:21)
        at Control.CTR_EfetuarLogin.<init>(CTR_EfetuarLogin.java:16)
        at View.LoginView.btnEntrarActionPerformed(LoginView.java:195)
        at View.LoginView.access$400(LoginView.java:31)
        at View.LoginView$5.actionPerformed(LoginView.java:104)
        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.AbstractButton.doClick(Unknown Source)
        at View.LoginView.txtSenhaActionPerformed(LoginView.java:224)
        at View.LoginView.access$200(LoginView.java:31)
        at View.LoginView$3.actionPerformed(LoginView.java:91)
        at javax.swing.JTextField.fireActionPerformed(Unknown Source)
        at javax.swing.JTextField.postActionEvent(Unknown Source)
        at javax.swing.JTextField$NotifyAction.actionPerformed(Unknown Source)
        at javax.swing.SwingUtilities.notifyAction(Unknown Source)
        at javax.swing.JComponent.processKeyBinding(Unknown Source)
        at javax.swing.JComponent.processKeyBindings(Unknown Source)
        at javax.swing.JComponent.processKeyEvent(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.KeyboardFocusManager.redispatchEvent(Unknown Source)
        at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)

        at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Sour
ce)
        at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Sour
ce)
        at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(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$1.run(Unknown Source)
        at java.awt.EventQueue$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
Source)
        at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
Source)
        at java.awt.EventQueue$2.run(Unknown Source)
        at java.awt.EventQueue$2.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
Source)
        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)

3 Respostas

Andre_Fonseca

oi,

Parece que tem a ver com a versão do JPA veja o link

O seu servidor é compativel com JPA2 ?

Abs

GouverMXT

André Fonseca:
oi,

Parece que tem a ver com a versão do JPA veja o link

O seu servidor é compativel com JPA2 ?

Abs

É uma aplicação Desktop.

Andre_Fonseca

Quais versões do jar para o persistence e o hibernate você está utilizando?

Remove these files from project lib location persistence-api-1.0.jar ejb3-persistence.jar

add only javax.persistence-2.0.0.jar

it contains all the required fields and atrributes.

try this it’ll work for your problem.

Criado 27 de julho de 2011
Ultima resposta 27 de jul. de 2011
Respostas 3
Participantes 2