java.lang.OutOfMemoryError: Java heap space

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

,
via oracle.com by Unknown author

An easy way to solve OutOfMemoryError in java is to increase the maximum heap size by using JVM options -Xmx512M, this will immediately solve your OutOfMemoryError.

,
via Stack Overflow by Eugene Yokota

In Eclipse : go to Run --> Run Configurations --> then select the project under maven build --> then select the tab "JRE" --> then enter -Xmx1024m.

This should increase the memory heap for all the builds/projects. The above memory size is 1 GB.

Solutions on the web

via tomcat-users by ext-narsi.reddy@nokia.com, 1 year ago
via tomcat-users by ext-narsi.reddy@nokia.com, 1 year ago
via Coderanch by peter tong, 1 year ago
via Stack Overflow by Maximin
, 2 years ago
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2786)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)
at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:263)
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:106)
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:116)
at java.io.OutputStreamWriter.write(OutputStreamWriter.java:203)
at java.io.Writer.write(Writer.java:140)
at org.codehaus.plexus.util.xml.pull.MXSerializer.writeAttributeValue(MXSerializer.java:880)
at org.codehaus.plexus.util.xml.pull.MXSerializer.attribute(MXSerializer.java:663)
at org.codehaus.plexus.util.xml.SerializerXMLWriter.addAttribute(SerializerXMLWriter.java:67)
at org.codehaus.plexus.util.xml.Xpp3DomWriter.write(Xpp3DomWriter.java:50)
at org.codehaus.plexus.util.xml.Xpp3DomWriter.write(Xpp3DomWriter.java:55)
at org.codehaus.plexus.util.xml.Xpp3DomWriter.write(Xpp3DomWriter.java:55)
at org.codehaus.plexus.util.xml.Xpp3DomWriter.write(Xpp3DomWriter.java:55)
at org.codehaus.plexus.util.xml.Xpp3DomWriter.write(Xpp3DomWriter.java:55)
at org.codehaus.plexus.util.xml.Xpp3DomWriter.write(Xpp3DomWriter.java:39)
at org.sonatype.nexus.plugins.p2.repository.metadata.AbstractP2MetadataSource.createMetadataItem(AbstractP2MetadataSource.java:105)
at org.sonatype.nexus.plugins.p2.repository.metadata.AbstractP2MetadataSource.createMetadataItem(AbstractP2MetadataSource.java:80)
at org.sonatype.nexus.plugins.p2.repository.metadata.AbstractP2MetadataSource.doRetrieveContentItem(AbstractP2MetadataSource.java:492)
at org.sonatype.nexus.plugins.p2.repository.metadata.AbstractP2MetadataSource.doRetrieveItem(AbstractP2MetadataSource.java:214)
at org.sonatype.nexus.plugins.p2.repository.proxy.P2ProxyRepositoryImpl.doRetrieveItem(P2ProxyRepositoryImpl.java:444)
at org.sonatype.nexus.plugins.p2.repository.proxy.P2ProxyRepositoryImpl.retrieveItem(P2ProxyRepositoryImpl.java:417)
at org.sonatype.nexus.proxy.repository.AbstractRepository.retrieveItem(AbstractRepository.java:584)
at org.sonatype.nexus.rest.AbstractResourceStoreContentPlexusResource.get(AbstractResourceStoreContentPlexusResource.java:139)
at org.restlet.resource.Resource.getRepresentation(Resource.java:302)
at org.restlet.resource.Resource.handleGet(Resource.java:464)

Users with the same issue

2 times, 5 days ago
3 times, 1 month ago
Once, 2 months ago
Once, 2 months ago
2 times, 3 months ago

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.