java.lang.OutOfMemoryError: Java heap space

Sonatype JIRA | babu ravi teja nallamothu | 2 years ago
  1. 0

    which one to go to fix this? 1. <env key="MAVEN_OPTS" value="-Xmx1024m"/> 2. <jvmarg value="-Xmx1024m"/> deploy: [artifact:mvn] [INFO] Scanning for projects... [artifact:mvn] [INFO] ------------------------------------------------------------------------ [artifact:mvn] [INFO] Building Maven Default Project [artifact:mvn] [INFO] task-segment: [org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file] (aggregator-style) [artifact:mvn] [INFO] ------------------------------------------------------------------------ [artifact:mvn] [INFO] [deploy:deploy-file] [artifact:mvn] Uploading: http://dev.abc.com:8081/nexus/content/repositories/releases/com/abc/dev/lib-initial-state/0.1.87/lib-initial-state-0.1.87.zip [artifact:mvn] [INFO] ------------------------------------------------------------------------ [artifact:mvn] [ERROR] FATAL ERROR [artifact:mvn] [INFO] ------------------------------------------------------------------------ [artifact:mvn] [INFO] Java heap space [artifact:mvn] [INFO] ------------------------------------------------------------------------ [artifact:mvn] [INFO] Trace [artifact:mvn] java.lang.OutOfMemoryError: Java heap space [artifact:mvn] at java.util.Arrays.copyOf(Arrays.java:2271) [artifact:mvn] at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:113) [artifact:mvn] at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93) [artifact:mvn] at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:140) [artifact:mvn] at sun.net.www.http.PosterOutputStream.write(PosterOutputStream.java:78) [artifact:mvn] at org.apache.maven.wagon.AbstractWagon.transfer(AbstractWagon.java:338) [artifact:mvn] at org.apache.maven.wagon.AbstractWagon.transfer(AbstractWagon.java:305) [artifact:mvn] at org.apache.maven.wagon.AbstractWagon.transfer(AbstractWagon.java

    Sonatype JIRA | 2 years ago | babu ravi teja nallamothu
    java.lang.OutOfMemoryError: Java heap space
  2. 0

    Azure SDK OutofMemoryError

    Stack Overflow | 3 years ago | Klaus
    java.lang.OutOfMemoryError: Java heap space
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    OutOfMemory error when posting data to MultipartRequest

    GitHub | 2 years ago | jensanthegreat
    java.lang.OutOfMemoryError: Java heap space
  5. 0

    Where are problems uploading big files to fedora using fedora-client v0.7 Test to reproduce bug: @Test public void addLargeStreamToFedora() throws IOException, FedoraClientException { FedoraCredentials fedoraCredentials = new FedoraCredentials("http://localhost:8085/fedora", "fedoraAdmin", "<password>"); FedoraClient fedoraClient = new FedoraClient(fedoraCredentials); AddDatastream addStream = new AddDatastream("test:atest1", "MAIN"); addStream.mimeType("application/pdf"); addStream.controlGroup("M"); addStream.dsLabel("ds_label_1"); Path filePath = Paths.get("<path to large file>"); InputStream is = Files.newInputStream(filePath); addStream.content(is); new Ingest("test:atest1").ownerId("test").execute(fedoraClient); addStream.execute(fedoraClient); //java.lang.OutOfMemoryError: Java heap space } stack trace: addLargeStream(...FedoraRepositoryIT) Time elapsed: 1.802 sec <<< ERROR! java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:2271) 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 sun.net.www.http.PosterOutputStream.write(PosterOutputStream.java:78) at com.sun.jersey.api.client.CommittingOutputStream.write(CommittingOutputStream.java:90) at com.sun.jersey.core.util.ReaderWriter.writeTo(ReaderWriter.java:115) at com.sun.jersey.core.provider.AbstractMessageReaderWriterProvider.writeTo(AbstractMessageReaderWriterProvider.java:76) at com.sun.jersey.core.impl.provider.entity.InputStreamProvider.writeTo(InputStreamProvider.java:98) at com.sun.jersey.core.impl.provider.entity.InputStreamProvider.writeTo(InputStreamProvider.java:59) at com.sun.jersey.api.client.RequestWriter.writeRequestEntity(RequestWriter.java:300) at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:213) at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:149) at com.sun.jersey.api.client.filter.HTTPBasicAuthFilter.handle(HTTPBasicAuthFilter.java:104) at com.sun.jersey.api.client.Client.handle(Client.java:648) at com.sun.jersey.api.client.WebResource.handle(WebResource.java:680) at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74) at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:568) at com.yourmediashelf.fedora.client.request.AddDatastream.execute(AddDatastream.java:232) at....addLargeStream(FedoraRepositoryIT.java:115) I think, this problem is related to http://stackoverflow.com/questions/11176824/preventing-the-jersey-client-from-causing-an-outofmemory-error-when-posting-larg And work around would be use ApacheHttpClient instead of HttpURLConection in com.yourmediashelf.fedora.client.FedoraClent constructor. Something like: /** * Constructor for FedoraClient. * * @param fc credentials for a Fedora repository */ public FedoraClient(FedoraCredentials fc) { this.fc = fc; // TODO validate fc // null check for username & password // null check for baseUrl ClientConfig config = new DefaultClientConfig(); //added config.getProperties().put(DefaultApacheHttpClientConfig.PROPERTY_CHUNKED_ENCODING_SIZE, 0); //added // FIXME this isn't very security-minded if (fc.getBaseUrl().toString().startsWith("https")) { SSLContext ctx = null; try { ctx = SSLContext.getInstance("SSL"); ctx.init(null, null, null); } catch (NoSuchAlgorithmException e) { logger.error(e.getMessage(), e); } catch (KeyManagementException e) { logger.error(e.getMessage(), e); } // FIXME Consider using not-yet-commons-ssl hostnameverifier // config by property: strict, none, etc. config.getProperties().put( HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, new HTTPSProperties(null, ctx)); client = ApacheHttpClient.create(config); } else { client = ApacheHttpClient.create(config); //changed } client.setFollowRedirects(true); client.addFilter(new HTTPBasicAuthFilter(fc.getUsername(), fc .getPassword())); }

    Sakai JIRA | 3 years ago | Pavel
    java.lang.OutOfMemoryError: Java heap space

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.OutOfMemoryError

      Java heap space

      at java.util.Arrays.copyOf()
    2. Java RT
      PosterOutputStream.write
      1. java.util.Arrays.copyOf(Arrays.java:2271)
      2. java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:113)
      3. java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93)
      4. java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:140)
      5. sun.net.www.http.PosterOutputStream.write(PosterOutputStream.java:78)
      5 frames
    3. Maven
      AbstractWagon.transfer
      1. org.apache.maven.wagon.AbstractWagon.transfer(AbstractWagon.java:338)
      2. org.apache.maven.wagon.AbstractWagon.transfer(AbstractWagon.java:305)
      2 frames