Skip to content
Advertisement

Error when adding java agent in VM arguments while using 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

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

VM arguments:

-Dcatalina.base="C:UserswortigsonDesktopISMatrikaBc.metadata.pluginsorg.eclipse.wst.server.coretmp0" -Dcatalina.home="C:Userswortigsonapache-tomee-8.0.5-webprofileapache-tomee-webprofile-8.0.5" -Dwtp.deploy="C:UserswortigsonDesktopISMatrikaBc.metadata.pluginsorg.eclipse.wst.server.coretmp0wtpwebapps" -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>

Advertisement

Answer

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.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement