Exception In Thread “Main” Java.Lang.Outofmemoryerror: Java Heap Space

Oct 6, 2017

Share this post
exception-in-thread-main-javalangoutofmemoryerror-java-heap-space

Problem

Encountered the following error when we are running adcfgclone.pl on DB node as part Cloning

ERROR

Loading ORACLE_HOME environment from /opt/mis/orcle/product/11204

Log file: /opt/mis/orcle/product/11204/SID/NetServiceHandler.log Exception in thread “main” java.lang.OutOfMemoryError: Java Heap Space

at java.io.UnixFileSystem.list(Navtive Method)

at java.io.File.list (Unknown Source)

at sun.srcurity.provider.SeedGenerator$1.run (Unknown Source)

at java.security.AccessController.doPrivilleged (Native Method)

Error generating tnsnames.ora from the database

Trying to connect using SID…

getConnectionUsingSID() –>

JDBC URL: jdbc:oracle:thin:@EBSDEV.omnitracs.com:1521:EBSDEV

WARNING

Exception occurred: java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection

adgentns.pl exiting with status 1

ERRORCODE = 1 ERRORCODE_END

RESOLUTION

Increase the java heap size for the following variable in Java.pm file and re-ran adcfgclone.pl. After this, the Perl adcfgclone.pl dbTier completed successfully.

Variable: adjreopts

File Location: /opt/mis/oracle/product/11204/appsutil/perl/ADX/util/java.pm

BEFORE ERROR:  java.pm file

sub getadjreopts {

($javaCmd, $red) = $self->getJavaPrg($JDK_TOP):

if ($ret != 0) {

return (“”, 1);

}

if ($javaCmd = ~ /jre/)     {

return (“-mx256m”, 0);

}

else {

return (“-Xmx512m”, 0);

}

}

AFTER ERROR:  java.pm file

sub getadjreopts {

($javaCmd, $red) = $self->getJavaPrg($JDK_TOP):

if ($ret != 0) {

return (“”, 1);

}

if ($javaCmd = ~ /jre/)     {

return (“-mx512m”, 0);

}

else {

return (“-Xmx1024M”, 0);

}

}