org.codehaus.classworlds.NoSuchRealmException: plexus.core

4.9k views Asked by At

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?

3

There are 3 answers

0
Ryan Zakariudakis On

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
0
Dario Palminio On

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)

0
mholm815 On

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