【问题标题】:Error when adding java agent in VM arguments while using OpenJPA使用 OpenJPA 时在 VM 参数中添加 java 代理时出错
【发布时间】:2021-01-21 12:50:14
【问题描述】:

我在这里找到了 OpenJPA 问题的解决方案:Using TomEE and open JPA, i get the following error: SEVERE: JAVA AGENT NOT INSTALLED,但是在项目的运行配置中添加 VM 参数作为问题答案或文档https://tomee.apache.org/javaagent.html,在尝试运行后会导致此错误:

Error opening zip file or JAR manifest missing : openejb-javaagent-4.6.0.jar
Error occurred during initialization of VM
agent library failed to init: instrument

项目是Eclipse IDE中的JavaEE,使用Maven构建工具和TomEE作为JavaEE容器。

虚拟机参数:

-Dcatalina.base="C:\Users\wortigson\Desktop\ISMatrikaBc\.metadata\.plugins\org.eclipse.wst.server.core\tmp0" -Dcatalina.home="C:\Users\wortigson\apache-tomee-8.0.5-webprofile\apache-tomee-webprofile-8.0.5" -Dwtp.deploy="C:\Users\wortigson\Desktop\ISMatrikaBc\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps" -javaagent:openejb-javaagent-4.6.0.jar

pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>regitry</groupId>
<artifactId>WebApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
    <project.builder.sourceEncoding>UTF-8</project.builder.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
</properties>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>11</source>
                <target>11</target>
            </configuration>
        </plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
        <groupId>jakarta.platform</groupId>
        <artifactId>jakarta.jakartaee-api</artifactId>
        <version>8.0.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.derby</groupId>
        <artifactId>derbyclient</artifactId>
        <version>10.15.2.0</version>
    </dependency>
</dependencies>

【问题讨论】:

    标签: java jakarta-ee openjpa jvm-arguments openejb


    【解决方案1】:

    我的一个项目遇到了同样的问题,我通过添加openejb-javaagent-4.6.0.jar 的完整路径解决了这个问题。如果您通过 Maven 安装 jar(您可以看到添加 here 的依赖项),它位于项目的 target/ 目录中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多