org.codehaus.classworlds.NoSuchRealmException:plexus.core

发布于 2024-12-26 02:47:30 字数 2235 浏览 0 评论 0原文

我正在尝试使用 Tomcat 7 的 Apache Maven Tomcat 插件, 所以我将以下依赖项添加到 POM 文件:

<dependency>
    <groupId>org.codehaus.plexus</groupId>
    <artifactId>plexus-classworlds</artifactId>
    <version>2.4</version>
</dependency>

插件配置:

<plugin>

    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.0-SNAPSHOT</version>
    <configuration>
        <path>/${project.build.finalName}</path>
    </configuration>

</plugin>

存储库

<repositories>

    <repository>
        <id>people.apache.snapshots</id>
        <url>http://people.apache.org/repo/m2-snapshot-repository</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>

</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>apache.snapshots</id>
        <name>Apache Snapshots</name>
        <url>http://people.apache.org/repo/m2-snapshot-repository</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>

Maven OPTS

-Xmx512m -Xms256m -XX:MaxPermSize=512m

但是当使用 mvn tomcat7:run 运行应用程序时,我收到以下异常:

org.codehaus.classworlds.NoSuchRealmException: plexus.core
    at org.codehaus.classworlds.ClassWorld.getRealm(ClassWorld.java:128)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:434)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

为什么?我的配置有问题吗,或者我遗漏了什么?

I am trying to use an Apache Maven Tomcat plugin for Tomcat 7,
so I added the following dependency to the POM file:

<dependency>
    <groupId>org.codehaus.plexus</groupId>
    <artifactId>plexus-classworlds</artifactId>
    <version>2.4</version>
</dependency>

Plugin configuration:

<plugin>

    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.0-SNAPSHOT</version>
    <configuration>
        <path>/${project.build.finalName}</path>
    </configuration>

</plugin>

Repositories:

<repositories>

    <repository>
        <id>people.apache.snapshots</id>
        <url>http://people.apache.org/repo/m2-snapshot-repository</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>

</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>apache.snapshots</id>
        <name>Apache Snapshots</name>
        <url>http://people.apache.org/repo/m2-snapshot-repository</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>

Maven OPTS:

-Xmx512m -Xms256m -XX:MaxPermSize=512m

but when running the application with mvn tomcat7:run i am getting following exception:

org.codehaus.classworlds.NoSuchRealmException: plexus.core
    at org.codehaus.classworlds.ClassWorld.getRealm(ClassWorld.java:128)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:434)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

Why? Do I have something wrong in configuration, or I am missing something?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

爱格式化 2025-01-02 02:47:30

当我收到此错误时,我尝试在 Jenkins 上 mvn 打包 maven:grails 应用程序。奇怪的是,我让它在我的旧 Hudson CI 服务器。要解决这个问题,我所要做的就是将以下 JVM 选项添加到 package 命令的配置中:

-Xmx2048m -Xms512m -XX:MaxPermSize=1024m

Jenkins job config → Build → 调用顶级 Maven 目标 → 高级...

单击“高级...”

在此处输入图像描述

When I got this error, I was trying to mvn package a maven:grails app on Jenkins. The weird part was that I had it working on my old Hudson CI server. All I had to do to fix the problem was add the following JVM options to the configuration for the package command:

-Xmx2048m -Xms512m -XX:MaxPermSize=1024m

Jenkins job config → Build → Invoke top-level Maven targets → Advanced...

Click "Advanced..."

Enter image description here

栀子花开つ 2025-01-02 02:47:30

我自己在使用时也遇到了同样的问题。看起来,当 plexus 代码运行时,它不能很好地处理 OutOfMemory 异常。

如果在构建期间增加分配给 JVM 的内存量,您会发现错误消失了。问题是堆栈的 PermSize。请参考此链接:Java JVM 内存入门 了解有关如何配置 JVM 内存的详细信息。

尝试使用如下设置:

  • -Xmn256m
  • -Xms512m
  • -Xmx1536m
  • -Xss1m
  • -XX:PermSize=512m
  • -XX:MaxPermSize=768m

I experienced the same issues myself when using this. It seems that when the plexus code runs, it does not handle OutOfMemory Exceptions well.

If you increase the allocated amount of memory to the JVM during the build, you will find that the error goes away. The problem is the PermSize for the stack. Refer to this link: Get started with java JVM memory for details on how to configure your JVM Memory.

Try using settings as such:

  • -Xmn256m
  • -Xms512m
  • -Xmx1536m
  • -Xss1m
  • -XX:PermSize=512m
  • -XX:MaxPermSize=768m
拥有 2025-01-02 02:47:30

通过控制台运行:

mvn clean install -DXms512m -DXmx2048m -DXX:MaxPermSize=1024m

或设置环境参数:

export MAVEN_OPTS="-Xms512m -Xmx2048m -XX:MaxPermSize=1024m"

使用系统环境文件:在“/etc/environment”文件中添加MAVEN_OPTS="-Xms512m -Xmx2048m -XX:MaxPermSize=1024m"。

接下来运行:

mvn clean install

在 Eclipse 中使用,添加到 MVN 参数如下:(

-DXms512m -DXmx2048m -DXX:MaxPermSize=1024m

这对我有用)

Run by console:

mvn clean install -DXms512m -DXmx2048m -DXX:MaxPermSize=1024m

Or set environment parameter:

export MAVEN_OPTS="-Xms512m -Xmx2048m -XX:MaxPermSize=1024m"

Using system environment file: Add MAVEN_OPTS="-Xms512m -Xmx2048m -XX:MaxPermSize=1024m" in "/etc/environment" file.

And next run:

mvn clean install

Use in Eclipse, adding to MVN Arguments following:

-DXms512m -DXmx2048m -DXX:MaxPermSize=1024m

(It works to me)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文