2009-06-23 3 views
1

나는이 자습서를 따라하고, 내가 사용 넷빈즈 http://www.netbeans.org/kb/docs/java/gui-db-custom.html넷빈즈/지속성 API 오류

난에 나는 "데이터베이스에서 새 개체 클래스"를 만들 부분에 도착 6.5.1 " 튜토리얼의 "마스터/상세보기 사용자 정의"절을 참조하십시오. 작업 목록에서이 오류가 발생하여 컴파일 할 수 없습니다. 실행하면 런타임 오류가 발생합니다 ... Atleast 나는이 두 가지가 관련 있다고 생각합니다.

 
Error Named queries can be defined only on an Entity or MappedSuperclass class. Countries.java 27 C:/Users/Danny/dev/NetBeansProjects/Test/src/test 

Error Named queries can be defined only on an Entity or MappedSuperclass class. Products.java 28 C:/Users/Danny/dev/NetBeansProjects/Test/src/test 

내가하는 모든 작업은 데이터베이스의 새로운> 엔티티 클래스를 수행하고 튜토리얼에서 말한대로 수행합니다. 튜토리얼 작성자는 응용 프로그램이 "부분적으로 기능적"이어야한다고 말했기 때문에 "대화 상자 추가"제목에서 튜토리얼을 멈추었습니다. 생성 된 코드를 내가 지시 한 바를 편집하지 않았습니다.

은 넷빈즈의 출력 콘솔에 의해 생성 된 출력 :

 
run: 
Jun 23, 2009 3:03:23 PM org.jdesktop.application.Application$1 run 
SEVERE: Application class test.TestApp failed to launch 
javax.persistence.PersistenceException: No Persistence provider for EntityManager named MyBusinessRecordsPU: Provider named oracle.toplink.essentials.PersistenceProvider threw unexpected exception at create EntityManagerFactory: 
oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException 
Local Exception Stack: 
Exception [TOPLINK-30005] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException 
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: [email protected] 
Internal Exception: javax.persistence.PersistenceException: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.EntityManagerSetupException 
Exception Description: predeploy for PersistenceUnit [MyBusinessRecordsPU] failed. 
Internal Exception: Exception [TOPLINK-7244] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.ValidationException 
Exception Description: An incompatible mapping has been encountered between [class test.Products] and [class test.Orders]. This usually occurs when the cardinality of a mapping does not correspond with the cardinality of its backpointer. 
     at oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:143) 
     at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:169) 
     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:110) 
     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83) 
     at test.TestView.initComponents(TestView.java:337) 
     at test.TestView.(TestView.java:39) 
     at test.TestApp.startup(TestApp.java:19) 
     at org.jdesktop.application.Application$1.run(Application.java:171) 
     at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) 
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:597) 
     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) 
     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) 
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) 
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) 
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) 
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) 
Caused by: javax.persistence.PersistenceException: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.EntityManagerSetupException 
Exception Description: predeploy for PersistenceUnit [MyBusinessRecordsPU] failed. 
Internal Exception: Exception [TOPLINK-7244] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.ValidationException 
Exception Description: An incompatible mapping has been encountered between [class test.Products] and [class test.Orders]. This usually occurs when the cardinality of a mapping does not correspond with the cardinality of its backpointer. 
     at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:643) 
     at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.callPredeploy(JavaSECMPInitializer.java:171) 
     at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initPersistenceUnits(JavaSECMPInitializer.java:239) 
     at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initialize(JavaSECMPInitializer.java:255) 
     at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:155) 
     ... 14 more 
Caused by: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.EntityManagerSetupException 
Exception Description: predeploy for PersistenceUnit [MyBusinessRecordsPU] failed. 
Internal Exception: Exception [TOPLINK-7244] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.ValidationException 
Exception Description: An incompatible mapping has been encountered between [class test.Products] and [class test.Orders]. This usually occurs when the cardinality of a mapping does not correspond with the cardinality of its backpointer. 
     at oracle.toplink.essentials.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:228) 
     ... 19 more 
Caused by: Exception [TOPLINK-7244] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.ValidationException 
Exception Description: An incompatible mapping has been encountered between [class test.Products] and [class test.Orders]. This usually occurs when the cardinality of a mapping does not correspond with the cardinality of its backpointer. 
     at oracle.toplink.essentials.exceptions.ValidationException.invalidMapping(ValidationException.java:1069) 
     at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataValidator.throwInvalidMappingEncountered(MetadataValidator.java:275) 
     at oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.OneToManyAccessor.process(OneToManyAccessor.java:161) 
     at oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.RelationshipAccessor.processRelationship(RelationshipAccessor.java:290) 
     at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProject.processRelationshipDescriptors(MetadataProject.java:579) 
     at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProject.process(MetadataProject.java:512) 
     at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProcessor.processAnnotations(MetadataProcessor.java:246) 
     at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:370) 
     at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:607) 
     ... 18 more 


The following providers: 
oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider 
Returned null to createEntityManagerFactory. 

     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:154) 
     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83) 
     at test.TestView.initComponents(TestView.java:337) 
     at test.TestView.(TestView.java:39) 
     at test.TestApp.startup(TestApp.java:19) 
     at org.jdesktop.application.Application$1.run(Application.java:171) 
     at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) 
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:597) 
     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) 
     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) 
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) 
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) 
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) 
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) 
Exception in thread "AWT-EventQueue-0" java.lang.Error: Application class test.TestApp failed to launch 
     at org.jdesktop.application.Application$1.run(Application.java:177) 
     at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) 
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:597) 
     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) 
     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) 
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) 
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) 
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) 
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) 
Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named MyBusinessRecordsPU: Provider named oracle.toplink.essentials.PersistenceProvider threw unexpected exception at create EntityManagerFactory: 
oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException 
Local Exception Stack: 
Exception [TOPLINK-30005] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException 
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: [email protected] 
Internal Exception: javax.persistence.PersistenceException: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.EntityManagerSetupException 
Exception Description: predeploy for PersistenceUnit [MyBusinessRecordsPU] failed. 
Internal Exception: Exception [TOPLINK-7244] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.ValidationException 
Exception Description: An incompatible mapping has been encountered between [class test.Products] and [class test.Orders]. This usually occurs when the cardinality of a mapping does not correspond with the cardinality of its backpointer. 
     at oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:143) 
     at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:169) 
     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:110) 
     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83) 
     at test.TestView.initComponents(TestView.java:337) 
     at test.TestView.(TestView.java:39) 
     at test.TestApp.startup(TestApp.java:19) 
     at org.jdesktop.application.Application$1.run(Application.java:171) 
     at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) 
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:597) 
     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) 
     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) 
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) 
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) 
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) 
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) 
Caused by: javax.persistence.PersistenceException: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.EntityManagerSetupException 
Exception Description: predeploy for PersistenceUnit [MyBusinessRecordsPU] failed. 
Internal Exception: Exception [TOPLINK-7244] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.ValidationException 
Exception Description: An incompatible mapping has been encountered between [class test.Products] and [class test.Orders]. This usually occurs when the cardinality of a mapping does not correspond with the cardinality of its backpointer. 
     at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:643) 
     at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.callPredeploy(JavaSECMPInitializer.java:171) 
     at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initPersistenceUnits(JavaSECMPInitializer.java:239) 
     at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initialize(JavaSECMPInitializer.java:255) 
     at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:155) 
     ... 14 more 
Caused by: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.EntityManagerSetupException 
Exception Description: predeploy for PersistenceUnit [MyBusinessRecordsPU] failed. 
Internal Exception: Exception [TOPLINK-7244] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.ValidationException 
Exception Description: An incompatible mapping has been encountered between [class test.Products] and [class test.Orders]. This usually occurs when the cardinality of a mapping does not correspond with the cardinality of its backpointer. 
     at oracle.toplink.essentials.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:228) 
     ... 19 more 
Caused by: Exception [TOPLINK-7244] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.ValidationException 
Exception Description: An incompatible mapping has been encountered between [class test.Products] and [class test.Orders]. This usually occurs when the cardinality of a mapping does not correspond with the cardinality of its backpointer. 
     at oracle.toplink.essentials.exceptions.ValidationException.invalidMapping(ValidationException.java:1069) 
     at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataValidator.throwInvalidMappingEncountered(MetadataValidator.java:275) 
     at oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.OneToManyAccessor.process(OneToManyAccessor.java:161) 
     at oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.RelationshipAccessor.processRelationship(RelationshipAccessor.java:290) 
     at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProject.processRelationshipDescriptors(MetadataProject.java:579) 
     at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProject.process(MetadataProject.java:512) 
     at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProcessor.processAnnotations(MetadataProcessor.java:246) 
     at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:370) 
     at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:607) 
     ... 18 more 


The following providers: 
oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider 
Returned null to createEntityManagerFactory. 

     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:154) 
     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83) 
     at test.TestView.initComponents(TestView.java:337) 
     at test.TestView.(TestView.java:39) 
     at test.TestApp.startup(TestApp.java:19) 
     at org.jdesktop.application.Application$1.run(Application.java:171) 
     ... 8 more 
BUILD SUCCESSFUL (total time: 2 seconds) 

내가 잘못 또는 뭔가해야 내 넷빈즈 응용 프로그램을 생각하고, 나 자신

를 같은 문제를 가진 사람을 찾을 수가 없습니다

답변

1

netbeans에 버그가있는 것으로 보입니다. 새로 설치 했으므로 이제는 작동하는 것 같습니다.

+0

NetBeans 6.8에서 동일한 오류가 발생했습니다. 버그가 어떻게 든 다시 도입 되었습니까? – mvexel

0

동일한 문제가있었습니다. 다시 설치 - 동일한 문제가 발생합니다. Ran Revo 제거 프로그램이 기본 설정으로되어 있습니다. 다시 설치되었습니다. 이번에는 새 프로젝트 마법사 직후에 바로 제품 테이블을 & 국가에 대해 만들었습니다. 그것이 차이를 만들지 모르겠지만, 이번에는 모두 잘했다.

0

Netbeans IDE 업데이트가 효과적입니다. 나는 신선한 설치가 필요하지 않았다.

0

업데이트 :이 오류는 Netbeans 7.4에도 여전히 존재합니다.
엔터프라이즈 응용 프로그램의 -war (Web -) 모듈 내의 Annotated Entities가 여전히 "NamedQueries를 정의 할 수 없습니다 ..."오류를 발생 시키므로
ejb-Module의 동일한 클래스는 그렇지 않습니다.
분명히 엔티티 클래스가 있어야합니다.
JSF - 페이지를 생성하기 위해 웹 모듈로 이동했습니다.하지만이 문제로 인해 페이지가 다시 시작된 후
문제가 발생하여 제대로 작동하지 않았습니다. EJB 모듈에서도 생성 될 수 있습니다.