Friday, June 21, 2013

IBM Java core file

Description

An IBM Java core file is a snapshot generated by the IBM JVM as a result of:

  • Severe events such as a java.lang.OutOfMemoryError event.
  • User signal (action) sent to the JVM such as kill -3 <Java PID>.

Sample file

javacore.20130522.091935.14024730.0008.txt

NULL           ------------------------------------------------------------------------
0SECTION       TITLE subcomponent dump routine
NULL           ===============================
1TISIGINFO     Dump Event "systhrow" (00040000) Detail "java/lang/OutOfMemoryError" received
1TIDATETIME    Date:                 2013/05/22 at 09:25:36
1TIFILENAME    Javacore filename:    <App Folder>/javacore.20130522.091935.14024730.0008.txt
NULL           ------------------------------------------------------------------------
0SECTION       GPINFO subcomponent dump routine
NULL           ================================
2XHOSLEVEL     OS Level         : AIX 6.1
2XHCPUS        Processors -
3XHCPUARCH       Architecture   : ppc64
3XHNUMCPUS       How Many       : 12
Possible causes
……………………………………………………………………………………………
0SECTION       THREADS subcomponent dump routine
NULL           =================================
NULL           
1XMCURTHDINFO  Current Thread Details
NULL           ----------------------

……………………………………………………………………………………………
0SECTION       CLASSES subcomponent dump routine
NULL           =================================
1CLTEXTCLLOS        Classloader summaries
……………………………………………………………………………………………

Data content & purpose

  • IBM JVM thread dump analysis (thread lock contention, deadlock, thread chains, execution snapshot etc.)
  • Class loader analysis (# instances, leak patterns etc.).
  • JVM runtime arguments review.
  • Last GC activity history.

References and Case Studies


Thursday, June 20, 2013

mysql_connect(): Can't connect to local MySQL server

Description

Problem from a PHP application connecting to a local MySQL server database.

Sample Error

PHP Warning:  mysql_connect(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (11)

Possible causes

  • Your local MySQL database is down or not responding via its local server socket IP address and port.
  • Verify the physical utilization of your physical server hosting MySQL and determine if you are dealing with high CPU and/or other resource utilization. CPU saturation can also cause connection failures from client such as Apache, PHP when trying to connect to the MySQL database server socket port.

 References and Case Studies


Tuesday, June 18, 2013

java.lang.NoClassDefFoundError

Description and Symptoms

Exception in thread "main" java.lang.NoClassDefFoundError is one of the most complex problems that you can face when developing Java applications. This error is thrown by the JVM at runtime when it is unable to locate a particular Java class from the current Thread context class loader.

Sample Error

java.lang.NoClassDefFoundError: Could not initialize class org.ph.javaee.training2.ClassA
       at org.ph.javaee.training2.NoClassDefFoundErrorSimulator.main(NoClassDefFoundErrorSimulator.java:32)


java.lang.ExceptionInInitializerError
       at org.ph.javaee.training2.NoClassDefFoundErrorSimulator.main(NoClassDefFoundErrorSimulator.java:23)
Caused by: java.lang.IllegalStateException: ClassA.initStaticVariable(): Internal Error!
       at org.ph.javaee.training2.ClassA.initStaticVariable(ClassA.java:37)
       at org.ph.javaee.training2.ClassA.<clinit>(ClassA.java:16)
       ... 1 more

Possible causes

  • Missing Java class and/or JAR file(s) from your Java runtime classpath.
  • Failure of a static variable or initializer block at class loading time.
  • Packaging problem of your application or third part API causing a mixed-up of class loading between the parent and child class loaders.
  • Wrong Class loader delegation model based on your application and packaging requirements.

Troubleshooting and solutions

  • First identify the Java class the JVM is complaining about.
  • Check for a simple root cause first: wrong Java runtime classpath.
  • If the problem persists, verify if the affected Java class contains static initializers e.g. static variable and/or static block initializer. Look for any failure at class loading time.
  • Once the above items are ruled out, perform an assessment of your application runtime class loader delegation model and look for any packing problem.

References and Case Studies


java.lang.NullPointerException


Description and Symptoms

 java.lang.NullPointerException is a very common Java exception that you can face when developing pure Java, Java EE applications or executing Java programs & games. Exception in thread "main" java.lang.NullPointerException has been around since early JDK days e.g. JDK 1.0.

Sample Error

java.lang.NullPointerException
       at org.ph.javaee.training1.CallerClassA.doSomething(CallerClassA.java:27)

       at org.ph.javaee.training1.NoClassDefFoundErrorSimulator.main(NoClassDefFoundErrorSimulator.java:28)

Possible Causes

  • Java programming problem.
  • Java software (applications, games...) bug.

Troubleshooting and solutions

  • Stack trace and root cause analysis of the affected code. Extra logging and debugging is also recommended.
  • Java code review and bug identification. Addition of proper NULL validation to prevent the problem at the first place.
  • Patch installation of the affected Java software.

References and Case Studies