0

I'm try to configure maven jetty plugin to start my war application, but it has some complications like as follow descriptions:

1º - It has dependencies with a ejb jar; 2º - It has dependencies with war (tag jstl:import context="nscl"); 3º - The classloader between wars must be shareded.

So, I need some help to resolve the third problem. Looks my jetty plugin configuration in pom.xml:

        <plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>9.4.1.v20170120</version>
            <configuration>
                <useProvidedScope>true</useProvidedScope>
                <useTestScope>true</useTestScope>
                <webApp>
                    <contextPath>/nscl/cntr</contextPath>
                </webApp>
                <contextHandlers>
                    <contextHandler implementation="org.eclipse.jetty.maven.plugin.JettyWebAppContext">
                        <war>${contexto.war.path}</war>
                        <contextPath>/nscl</contextPath>
                    </contextHandler>
                </contextHandlers>
                <systemProperties>
                    <systemProperty>
                        <name>spring.profiles.active</name>
                        <value>test</value>
                    </systemProperty>
                </systemProperties>
            </configuration>
        </plugin>

The problem is, when jetty is starting the second war (context-path = nscl), I receive problems saying the classes used to start first war not exist to second, a sample is classes of spring framework.

Thanks !!!!

1 Answers1

0

You are hitting Standard Servlet Spec behavior.

Your WebApp's cannot share the same ClassLoader.

That is a fundamental part of being a Servlet Spec WebApp, the ClassLoader isolation.

Attempting to force it will just create mysterious problems with the ClassLoader hierarchy (InvalidClassChange errors, memory leaks, GC failures, etc)

Perhaps you can detail why you think you need this.

As there's likely already a standard way to accomplish it using the features of the Servlet spec (and not fighting it).

Joakim Erdfelt
  • 46,896
  • 7
  • 86
  • 136