netbeans 8.2 persistenceLocationProvider未实现

时间:2018-06-27 15:19:09

标签: jpa netbeans

我正在使用gradle和spring boot创建我的第一个spring项目。我想从netbeans中的数据库创建实体类。当我尝试执行此操作时,单击“完成”按钮后,出现以下错误:

SEVERE [org.openide.util.Exceptions]
java.io.IOException: The project org.netbeans.gradle.project.NbGradleProject@d34797b does not have an implementation of PersistenceLocationProvider in its lookup
at org.netbeans.modules.j2ee.persistence.api.PersistenceLocation.createLocation(PersistenceLocation.java:94)
at org.netbeans.modules.j2ee.persistence.provider.ProviderUtil.createPersistenceDDFile(ProviderUtil.java:847)
[catch] at org.netbeans.modules.j2ee.persistence.provider.ProviderUtil.getPUDataObject(ProviderUtil.java:810)
at org.netbeans.modules.j2ee.persistence.wizard.unit.PersistenceUnitWizard.instantiateWProgress(PersistenceUnitWizard.java:223)
at org.netbeans.modules.j2ee.persistence.wizard.unit.PersistenceUnitWizard.instantiate(PersistenceUnitWizard.java:159)
at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(TemplateWizard.java:1051)
at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:605)
at org.openide.loaders.TemplateWizard.instantiateNewObjects(TemplateWizard.java:439)
at org.openide.loaders.TemplateWizardIterImpl.instantiate(TemplateWizardIterImpl.java:253)
at org.openide.loaders.TemplateWizardIteratorWrapper$ProgressInstantiatingIterator.instantiate(TemplateWizardIteratorWrapper.java:180)
at org.openide.WizardDescriptor.callInstantiateOpen(WizardDescriptor.java:1626)
at org.openide.WizardDescriptor.callInstantiate(WizardDescriptor.java:1570)
at org.openide.WizardDescriptor.access$2300(WizardDescriptor.java:92)
at org.openide.WizardDescriptor$Listener$2$1.run(WizardDescriptor.java:2257)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)
WARNING [org.openide.WizardDescriptor]
java.lang.NullPointerException
at org.netbeans.modules.j2ee.persistence.wizard.unit.PersistenceUnitWizard.instantiateWProgress(PersistenceUnitWizard.java:230)
at org.netbeans.modules.j2ee.persistence.wizard.unit.PersistenceUnitWizard.instantiate(PersistenceUnitWizard.java:159)
at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(TemplateWizard.java:1051)
at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:605)
at org.openide.loaders.TemplateWizard.instantiateNewObjects(TemplateWizard.java:439)
at org.openide.loaders.TemplateWizardIterImpl.instantiate(TemplateWizardIterImpl.java:253)
at org.openide.loaders.TemplateWizardIteratorWrapper$ProgressInstantiatingIterator.instantiate(TemplateWizardIteratorWrapper.java:180)
at org.openide.WizardDescriptor.callInstantiateOpen(WizardDescriptor.java:1626)
at org.openide.WizardDescriptor.callInstantiate(WizardDescriptor.java:1570)
at org.openide.WizardDescriptor.access$2300(WizardDescriptor.java:92)
[catch] at org.openide.WizardDescriptor$Listener$2$1.run(WizardDescriptor.java:2257)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)

我的build.gradle看起来像这样:

import org.gradle.api.artifacts.*


buildscript {
    repositories {
        mavenCentral()
        maven{
            url 'https://repo.spring.io/libs-release'
        }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.3.RELEASE")
    }
}

apply plugin: 'base' // To add "clean" task to the root project.
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

bootJar {
    mainClassName='org.gogogold.core.Skelton.xuyun'
    baseName = 'gradlePom'
    version =  '0.1.0'
}

repositories {
    mavenCentral()
}

dependencies {

    compile("org.springframework.boot:spring-boot-starter")
    compile("org.springframework.boot:spring-boot-starter-data-jpa")
    compile("org.springframework.data:spring-data-jpa:2.0.8.RELEASE")
    // https://mvnrepository.com/artifact/org.eclipse.persistence/javax.persistence
    compile group: 'org.eclipse.persistence', name: 'javax.persistence', version: '2.2.0'

    // https://mvnrepository.com/artifact/org.hibernate/hibernate-core
    compile group: 'org.hibernate', name: 'hibernate-core', version: '5.3.1.Final'
    // https://mvnrepository.com/artifact/org.hibernate/hibernate-entitymanager
    compile group: 'org.hibernate', name: 'hibernate-entitymanager', version: '5.3.1.Final'
    // https://mvnrepository.com/artifact/org.hibernate.javax.persistence/hibernate-jpa-2.1-api
    compile group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.1-api', version: '1.0.2.Final'

}

我在netbeans中连接了数据库,我尝试用Google搜索答案,但是最相似的问题已针对6.3或更高版本的netbeans解决。我应该怎么做才能使JPA工作?非常感谢你!

0 个答案:

没有答案