gpt4 book ai didi

Tomcat + OpenJPA

转载 作者:行者123 更新时间:2023-11-28 23:25:35 28 4
gpt4 key购买 nike

我正在尝试将应用程序从 WLP 迁移到 Tomcat,在尝试部署 war 时,出现以下异常

org.apache.openjpa.persistence.ArgumentException:此配置不允许运行时优化,但以下列出的类型在构建时或在使用 javaagent 的类加载时未得到增强:

我尝试添加 javaagent 以启用运行时加载JAVA_OPTS=%JAVA_OPTS% -javaagent:"$CATALINA_HOME/lib/openjpa-2.X.jar

here 中所述但没有成功。

任何建议或要点。

最佳答案

我总是建议使用编译时优化。这是 JPA 实现自动为 jpa 增强类文件生成 JPA 函数的任务。

ScopedEntityManager utility project in Github 中查看此 build.xml .

<?xml version="1.0" encoding="UTF-8"?>
<project name="jpaexample" default="build" basedir=".">
...clip...
<target name="compile" depends="clean" description="Compile classes">
<mkdir dir="${classes}"/>
<javac srcdir="${src}" destdir="${classes}" target="1.7" source="1.7" encoding="ISO-8859-1"
debug="true" debuglevel="lines,source" includeantruntime="false"
excludes="" >
<classpath refid="libs" />
</javac>
<antcall target="jpaenhance" />
</target>


<target name="jpaenhance" description="Preprocess entity classes, enhance for JPA use">
<path id="jpa.enhancement.classpath">
<pathelement location="${classes}" />
<fileset dir="./webapp/WEB-INF/lib">
<include name="*.jar" />
<exclude name="${name}.jar" />
</fileset>
</path>

<taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask">
<classpath refid="jpa.enhancement.classpath" />
</taskdef>
<openjpac>
<classpath refid="jpa.enhancement.classpath" />
<config propertiesFile="./webapp/WEB-INF/classes/META-INF/persistence.xml" />
</openjpac>
</target>
...clip...
</project>

关于Tomcat + OpenJPA,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37590785/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com