Apache camel ServiceMix环境中的OpenJPA异常

Apache camel ServiceMix环境中的OpenJPA异常,apache-camel,cxf,openjpa,apache-servicemix,Apache Camel,Cxf,Openjpa,Apache Servicemix,ServiceMix、Camel、CXF 我写了一些使用JPA的数据库操作程序。这些并不复杂。它们工作正常,我写了一个过程,用它们中的一些。 process starter是一个基于文件的驼峰路线,一切都很完美。 好的,让初学者创建一个Web服务。没问题,我们使用ServiceMix,让我们使用CXF。这很简单,而且我们有一个集成的环境,可能会有什么问题。 WS-ready,调用过程并。。。我有一个例外: <openjpa-2.3.0-r422266:1540826 nonfatal us

ServiceMix、Camel、CXF 我写了一些使用JPA的数据库操作程序。这些并不复杂。它们工作正常,我写了一个过程,用它们中的一些。 process starter是一个基于文件的驼峰路线,一切都很完美。 好的,让初学者创建一个Web服务。没问题,我们使用ServiceMix,让我们使用CXF。这很简单,而且我们有一个集成的环境,可能会有什么问题。 WS-ready,调用过程并。。。我有一个例外:

<openjpa-2.3.0-r422266:1540826 nonfatal user error> 
org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter 
"select i from IntegratedSystem i where i.code = :value". 
Error message: The name "IntegratedSystem" is not a recognized entity or identifier. 
Perhaps you meant IntegratedSystem, which is a close match. 
Known entity names: [Category, EsbLog, Message, MsgDispatcherCfg, 
ConsumerRequest, ProviderResponse, ServiceRegistry, ConsumerResponse, 
IntegratedSystem, ProviderRequest, CategoryItem]
这非常有趣,因为例外实体和紧密匹配是相同的。 问题是:

如果我从Camel路由调用一个过程,那么JPA工作正常;如果我从WS-implementation调用,那么JPA不知道该实体。你知道吗

WS和Camel路由是同一个项目和同一个包,如果我将JPA select替换为本机select,那么它可以正常工作。这不是一个好的解决方案,因为我使用了不止一个选项,并且我使用了JPA的潜力

谢谢大家!! 费里

I had similar issue, and the cause was openjpa enhancer plugin within maven could not enhance the object as it could not find persistence.xml 
and required change as:

        <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
        <persistenceXmlFile>${project.basedir}/src/main/resources/META-INF/persistence.xml</persistenceXmlFile>
        <classes>${project.build.outputDirectory}</classes>
        <workDir>${project.build.directory}\openjpa-work</workDir>


Full plugin description:

<plugin>
    <groupId>org.apache.openjpa</groupId>
    <artifactId>openjpa-maven-plugin</artifactId>
    <version>2.3.0</version>
    <configuration>
        <includes>**/model/**/*.class</includes>
        <addDefaultConstructor>true</addDefaultConstructor>
        <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
        <persistenceXmlFile>${project.basedir}/src/main/resources/META-INF/persistence.xml</persistenceXmlFile>
        <classes>${project.build.outputDirectory}</classes>
        <workDir>${project.build.directory}\openjpa-work</workDir>
    </configuration>
    <executions>
        <execution>
            <id>enhancer</id>
            <phase>process-classes</phase>
            <goals>
                <goal>enhance</goal>
            </goals>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>org.apache.openjpa</groupId>
            <artifactId>openjpa</artifactId>
            <version>${openjpa.version}</version>
        </dependency>
    </dependencies>
</plugin>

Hope it helps someone !!