使用具有以下配置的jetty maven插件运行maven failsafe插件时
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.15.v20140411</version>
<configuration>
<stopKey>STOP</stopKey>
<stopPort>9999</stopPort>
<scanIntervalSeconds>5</scanIntervalSeconds>
<webAppConfig>
<contextPath>/${project.artifactId}</contextPath>
</webAppConfig>
<connectors>
<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
<port>8181</port>
</connector>
</connectors>
<contextXml>${project.build.testOutputDirectory}/jetty-context.xml</contextXml>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run-war</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.17</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<versionenter code here>2.17</version>
</dependency>
</dependencies>
<configuration>
<includes>
<include>**/*IntegrationTest.java</include>
</includes>
<additionalClasspathElements>
<additionalClasspathElement>${documentum.home}</additionalClasspathElement>
</additionalClasspathElements>
<argLine>-Xmx1024m -XX:MaxPermSize=2048m</argLine>
</configuration>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
Maven挂起了以下几行:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.fee.services.dctmsp.test.FooSpRepositoryServiceTest
Getting session manager... OK - took 4932 ms
Getting session... OK - took 1085 ms
serviceFactory: com.emc.documentum.fs.rt.context.ServiceFactory@2743724e
spRepositoryService: JAX-WS RI 2.1.7-b01-: Stub for http://localhost:8181/fooSP/services/fooSP/FooSpRepositoryService
有时我得到这个:
com.sun.xml.ws.transport.http.servlet.WSServletDelegate doGet
SEVERE: caught throwable
java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:421)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:383)
at com.emc.documentum.fs.rt.DfsException.<init>(DfsException.java:91)
at com.emc.documentum.fs.rt.DfsException.<init>(DfsException.java:73)
at com.emc.documentum.fs.rt.ServiceException.<init>(ServiceException.java:56)
at com.emc.documentum.fs.rt.ServiceInvocationException.<init>(ServiceInvocationException.java:36)
at com.emc.documentum.fs.rt.AuthenticationException.<init>(AuthenticationException.java:35)
at com.emc.documentum.fs.rt.impl.handler.AuthorizationHandler.authenticate(AuthorizationHandler.java:130)
at com.emc.documentum.fs.rt.impl.handler.AuthorizationHandler.handleMessage(AuthorizationHandler.java:55)
at com.emc.documentum.fs.rt.impl.handler.AuthorizationHandler.handleMessage(AuthorizationHandler.java:1)
at com.sun.xml.ws.handler.HandlerProcessor.callHandleMessage(HandlerProcessor.java:284)
at com.sun.xml.ws.handler.HandlerProcessor.callHandlersRequest(HandlerProcessor.java:135)
at com.sun.xml.ws.handler.ServerSOAPHandlerTube.callHandlersOnRequest(ServerSOAPHandlerTube.java:134)
at com.sun.xml.ws.handler.HandlerTube.processRequest(HandlerTube.java:116)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:471)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
还有一些我得到了这个:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.foo.services.dctmsp.test.FooSpRepositoryServiceTest
Getting session manager... OK - took 5914 ms
Getting session... OK - took 1072 ms
serviceFactory: com.emc.documentum.fs.rt.context.ServiceFactory@111edceb
spRepositoryService: JAX-WS RI 2.1.7-b01-: Stub for http://localhost:8181/fooSP/services/fooSP/FooSpRepositoryService
2014-09-18 14:32:50.353:WARN:oejs.ServletHandler:Error for /fooSP/services/fooSP/FooSpRepositoryService
java.lang.OutOfMemoryError: PermGen space
2014-09-18 14:32:51.871:WARN:oejs.ServletHandler:Error for /fooSP/services/fooSP/FooSpRepositoryService
java.lang.OutOfMemoryError: PermGen space
Exception in thread "Thread-14" java.lang.OutOfMemoryError: PermGen space
Exception in thread "Thread-15" java.lang.OutOfMemoryError: PermGen space
现在,我已尝试使用MaxPermSize的不同设置,但它似乎没有帮助,一切从64M到5000M。
以下是我正在运行的测试代码:
@Category(IntegrationTest.class)
public class FooSpRepositoryServiceTest extends FooSpCommon {
IFooSpRepositoryService spRepositoryService = null;
ArrayList<ISbDokument> dokumenter = new ArrayList<ISbDokument>();
ServiceFactory serviceFactory = null;
@Before
public void setUp() {
super.setUp();
try {
serviceFactory = ServiceFactory.getInstance();
spRepositoryService = serviceFactory.getRemoteService(IFooSpRepositoryService.class, serviceContext,
FOO_SERVICE_MODULE, FOO_SP_HOST);
System.out.println("serviceFactory: " + serviceFactory);
System.out.println("spRepositoryService: " + spRepositoryService);
} catch (Exception e) {
e.printStackTrace();
}
}
@After
public void tearDown() {
try {
if (dokumenter.size() > 0) {
for (ISbDokument dokument : dokumenter) {
if (dokument.isCheckedOut())
dokument.checkin(true, "CURRENT");
dokument.destroyAllVersions();
}
}
} catch (Exception e) {
e.printStackTrace();
}
if (session != null) {
sessionMgr.release(session);
}
}
@Test
public void test_dummy() {
String dummystring = "hello";
assertEquals(dummystring, "hello");
}
@Test
public void test_dummy1() {
assertTrue(serviceFactory != null);
assertTrue(spRepositoryService != null);
}
@Test
public void test_getFormatName_Text() throws ServiceException {
String formatName = spRepositoryService.getFormatName(REPOSITORY, "txt");
assertTrue(formatName != null);
assertTrue(!formatName.equalsIgnoreCase(""));
assertEquals(formatName, "crtext");
}
}
当调用spRepositoryService.getFormatName时,问题显然出现在方法test_getFormatName_Text中,因为其他测试不会失败。每当我没有得到任何&#34; java.lang.OutOfMemoryError:PermGen space&#34;是它永远挂起。