I want to deploy an EAR that is about 70MB big using Arquillian, but no matter what I do, I get:
Exception in thread "management-client-thread 1-1" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:3236)
at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:113)
at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:140)
at org.jboss.as.protocol.StreamUtils.copyStream(StreamUtils.java:52)
at org.jboss.as.controller.client.impl.InputStreamEntry$InMemoryEntry.initialize(InputStreamEntry.java:76)
at org.jboss.as.controller.client.impl.AbstractModelControllerClient$ReadAttachmentInputStreamRequestHandler$1.execute(AbstractModelControllerClient.java:193)
at org.jboss.as.protocol.mgmt.AbstractMessageHandler$2$1.doExecute(AbstractMessageHandler.java:283)
at org.jboss.as.protocol.mgmt.AbstractMessageHandler$AsyncTaskRunner.run(AbstractMessageHandler.java:504)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
I tried:
EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class);
ear.addAsModules(Maven.resolver().loadPomFromFile("pom.xml")
.resolve("org.acme:module1:war:?","org.acme:module2","org.acme:module3:war:?")
.withoutTransitivity().asFile());
Then
EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class);
ear.addAsModules(new File("lib/module1-4.4.2.war"));
ear.addAsModules(new File("lib/module2-3.7.0.jar"));
ear.addAsModules(new File("lib/module3-3.7.war"));
And then
EnterpriseArchive ear = ShrinkWrap.createFromZipFile(EnterpriseArchive.class, new File(
"../org.acme.project.ear/target/org.acme.project.ear.ear"));
Which brought an exception even Google didn't know (java.lang.UnsupportedOperationException: Multiple WebArchives found in org.acme.project.ear. Can not determine which to enrich
), so I added:
ear.delete("/module1-4.4.2.war");
// AND / OR
ear.delete("/module3-3.7.war");
Which (depending on the modules I removed) either brought me back to the OutOfMemoryError
or to an exception because of course now the application.xml of the EAR doesn't work with the new module list (and since the application.xml is dynamically created by Maven, there's now way I get a modified file into my Arquillian test harness).
And somewhere along the line I fiddled with the Xms
and Xmx
attributes in the arquillian.xml
:
<container qualifier="jboss" default="true">
<configuration>
<property name="javaVmArguments">-Xms512m -Xmx1024m</property>
</configuration>
</container>
The crux of the problem seems to be this one 50MB WAR, which I don't feel is that big, but evidently it is. What can I do to get my EAR to work?