eclipse 4.3 EE facet jpa 2.0 build error

2019-07-20 19:22发布

I'm trying Eclipse Kepler 4.3 EE

After open it over my old workspace, my project starts with an build error:

This project has the JPA facet, but no JPA project could be created. See the error log for more details.

This is the details:

eclipse.buildId=4.3.0.I20130605-2000
java.version=1.7.0_21
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=pt_BR
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -data D:\JJW\srcWeb -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product

Error
Mon Aug 19 14:46:53 BRT 2013
null JPA platform: P/jjwxp-web

java.lang.IllegalArgumentException
    at org.eclipse.jpt.jpa.core.internal.InternalJpaProjectManager.buildJpaProject(InternalJpaProjectManager.java:643)
    at org.eclipse.jpt.jpa.core.internal.InternalJpaProjectManager.buildJpaProject(InternalJpaProjectManager.java:635)
    at org.eclipse.jpt.jpa.core.internal.InternalJpaProjectManager.buildJpaProject(InternalJpaProjectManager.java:628)
    at org.eclipse.jpt.jpa.core.internal.InternalJpaProjectManager.addJpaProject(InternalJpaProjectManager.java:609)
    at org.eclipse.jpt.jpa.core.internal.InternalJpaProjectManager.buildJpaProject_(InternalJpaProjectManager.java:312)
    at org.eclipse.jpt.jpa.core.internal.InternalJpaProjectManager$BuildJpaProjectCommand.execute(InternalJpaProjectManager.java:306)
    at org.eclipse.jpt.common.core.internal.utility.command.CommandJobCommandAdapter.execute(CommandJobCommandAdapter.java:50)
    at org.eclipse.jpt.common.core.internal.utility.command.JobCommandJob.run(JobCommandJob.java:42)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

Project facet: JPA 2.0

Persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
    xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">


    <persistence-unit name="jjwxp-web-unit"
        transaction-type="RESOURCE_LOCAL">

        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>

        <class>br.com.jjw.jjwxp.web.model.Pais</class>
        <class>br.com.jjw.jjwxp.web.model.Estado</class>
        <class>br.com.jjw.jjwxp.web.model.Cidade</class>
        <class>br.com.jjw.jjwxp.web.model.Usuario</class>
        <class>br.com.jjw.jjwxp.web.model.Empresa</class>
        <class>br.com.jjw.jjwxp.web.model.Pessoa</class>
        <class>br.com.jjw.jjwxp.web.model.PessoaCliente</class>
        <class>br.com.jjw.jjwxp.web.model.PessoaRepresentante</class>
        <class>br.com.jjw.jjwxp.web.model.PessoaContato</class>
        <class>br.com.jjw.jjwxp.web.model.ListaPrecos</class>
        <class>br.com.jjw.jjwxp.web.model.ListaPrecosRepresentante</class>
        <class>br.com.jjw.jjwxp.web.model.ListaPrecosColuna</class>
        <class>br.com.jjw.jjwxp.web.model.ListaPrecosItem</class>
        <class>br.com.jjw.jjwxp.web.model.Produto</class>
        <class>br.com.jjw.jjwxp.web.model.ProdutoGrade</class>
        <class>br.com.jjw.jjwxp.web.model.ProdutoEstoque</class>
        <class>br.com.jjw.jjwxp.web.model.ProdutoCor</class>
        <class>br.com.jjw.jjwxp.web.model.FaixaTamanho</class>
        <class>br.com.jjw.jjwxp.web.model.GrupoProduto</class>
        <class>br.com.jjw.jjwxp.web.model.Tamanho</class>
        <class>br.com.jjw.jjwxp.web.model.Cor</class>
        <class>br.com.jjw.jjwxp.web.model.ProdutoImagem</class>
        <class>br.com.jjw.jjwxp.web.model.ProdutoCorImagem</class>
        <class>br.com.jjw.jjwxp.web.model.PVE</class>
        <class>br.com.jjw.jjwxp.web.model.PVEItem</class>
        <class>br.com.jjw.jjwxp.web.model.PVEItemGrade</class>
        <class>br.com.jjw.jjwxp.web.model.CondicaoPagamento</class>
        <class>br.com.jjw.jjwxp.web.model.ModalidadeVenda</class>
        <class>br.com.jjw.jjwxp.web.model.Moeda</class>
        <class>br.com.jjw.jjwxp.web.model.ClassificacaoFiscal</class>
        <class>br.com.jjw.jjwxp.web.model.ClassificacaoFiscalEmpresa</class>
        <class>br.com.jjw.jjwxp.web.model.RepresentanteProduto</class>
        <class>br.com.jjw.jjwxp.web.model.ModuloSistema</class>


        <shared-cache-mode>NONE</shared-cache-mode>

        <properties>
            <property name="eclipselink.ddl-generation" value="NONE" />
            <property name="eclipselink.weaving" value="dynamic" />

            <property name="eclipselink.logging.level" value="FINE" />
            <property name="eclipselink.logging.logger"
                value="org.eclipse.persistence.logging.CommonsLoggingSessionLog" />
        </properties>

    </persistence-unit>

</persistence>

Any ideas about what is happening ?

2条回答
乱世女痞
2楼-- · 2019-07-20 19:24

If you renamed the project, and the error happened after renaming (or svn downloading in a different folder ) ..

the cause is explained in this eclipse Eclipse BUG 414688 (OPEN) https://bugs.eclipse.org/bugs/show_bug.cgi?id=414688

And the real source of the problem is in BUG 414795 (FIXED) https://bugs.eclipse.org/bugs/show_bug.cgi?id=414795

Since the Second Bug was fixed in Dec 2013, and Verified in Jan 2014, I suppose the next version of Eclipse Will Solve this error.

查看更多
淡お忘
3楼-- · 2019-07-20 19:43

I just had the same exact issue after downloading Eclipse Neon. I solved the problem by:

  1. Right click on the project. Then select properties to open the properties window.
  2. Select JPA to see the JPA configuration. Under platform, select the JPA platform in my case Hibernate (JPA 2.1).
  3. Under JPA Implementation Type, select Disable Library Configuration cause in my case, I'm using a maven project where I declared the JPA dependencies, so the library will be available in the classpath.
  4. Under Peristent class management make sure you select the option discover annotated classes automatically. After click apply, then OK and it should resolve the error.

Also under Project Properties ---> Project Facets, make sure you select the proper Java version and target runtime (your JDK) and also deselect Utility Module check box if it is checked.

查看更多
登录 后发表回答