使用OpenJPA时在VM参数中添加Java代理时出错 [英] Error when adding java agent in VM arguments while using OpenJPA

查看:78
本文介绍了使用OpenJPA时在VM参数中添加Java代理时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里找到了针对OpenJPA问题的解决方案:

I found solution for my problem with OpenJPA here: Using TomEE and open JPA, i get the following error: SEVERE: JAVA AGENT NOT INSTALLED, but adding VM parameter as in question answer or documentation https://tomee.apache.org/javaagent.html, in project's run configuration, results in this error, after trying to run:

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容器.

Project is JavaEE in Eclipse IDE, using Maven build tool and TomEE as JavaEE container.

VM参数:

-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>

推荐答案

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

I had the same issue on a project of mine and I solved it by adding the full path to the openejb-javaagent-4.6.0.jar. If you install the jar via Maven (you can see the dependencies to add here) it is in the target/ directory of your project.

这篇关于使用OpenJPA时在VM参数中添加Java代理时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆