Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Inside Class Loaders: Debugging

Inside Class Loaders: Debugging This article will show how to solve class-loading problems and to overcome some debugging limitations of the JDK class loaders.

Tutorial Details:

Tricks of the Trade to Investigate Class-Loading Problems
The biggest challenge in dealing with class-loading problems is that problems rarely manifest themselves during the class-loading process but rather during the usage of a class later on. In addition, the messages provided by the JDK are, to say the least, inadequate, and the toString() methods of the JDK class loaders are not overridden to provide more data.

ClassNotFoundException
Let's consider several different class-loading error scenarios. First, we want to figure out what to do when a class could not be found and the application throws a ClassNotFoundException
Here are some steps to resolve the issue:

Look for the line where your class loader's loadClass() call is involved (in our example, the last line).
Figure out what class loader is used there.
Figure out the parent class loaders recursively until you find the bootstrap class loader.
Figure out why the class cannot be found by any of these class loaders.
This problem is caused when a class loader is asked to load a particular class and it cannot be found. Here are few causes:

An archive, directory, or other source for the classes was not added to the class loader asked to load the class, or to its parent.
A class loader's parent is not set correctly.
The wrong class loader is used to load the class in question.


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Inside Class Loaders: Debugging

View Tutorial:
Inside Class Loaders: Debugging

Related Tutorials:

Exceptions in Java - JavaWorld - July 1998
Exceptions in Java - JavaWorld - July 1998
 
Programming Java threads in the real world, Part 7 - JavaWorld - April 1999
Programming Java threads in the real world, Part 7 - JavaWorld - April 1999
 
Static class declarations
Static class declarations
 
Java Tip 83: Use filters to access resources in Java archives - JavaWorld
Java Tip 83: Use filters to access resources in Java archives - JavaWorld
 
Java Tip 90: Accelerate your GUIs - JavaWorld
Java Tip 90: Accelerate your GUIs - JavaWorld
 
Trace your steps in Java 1.4
Trace your steps in Java 1.4
 
Make a statement with javac!
Make a statement with javac!
 
Cracking Java byte-code encryption
Cracking Java byte-code encryption
 
Java Development on Eclipse, Part 1
Java Development on Eclipse, Part 1 Author\'s note: In part one of a two-part series of excerpts from Eclipse\'s Chapter 2, we\'ll get down to the business of developing Java using Eclipse. We\'re going to take a look at using Eclipse for Java developm
 
Inside Class Loaders: Debugging
Inside Class Loaders: Debugging This article will show how to solve class-loading problems and to overcome some debugging limitations of the JDK class loaders.
 
Attribute-Oriented Programming with Java 1.5, Part 1
In this article, I will consider the case of a status-bar component embedded in a GUI application. I will explore a number of different ways to implement this status reporter, starting with the traditional hard-coded idiom. Along the way, I will introduce
 
Attribute-Oriented Programming with Java 1.5, Part 2
Peeking Inside the Box: Attribute-Oriented Programming with Java 1.5,Part In the previous article in this series, "Peeking Inside the Box, Part 1," I introduced the concepts of Attribute-Oriented Programming, Java 1.5 annotations, and bytecode instrume
 
Java Application Instrumentation with Log4J
Java Application Instrumentation with Log4J Application metrics, such as performance metrics, are key to understanding and improving application efficiency. Profiling and monitoring tools yield valuable information on CPU and resource usage, including OS
 
Understanding Network Class Loaders Class loaders
One of the cornerstones of Java dynamics, determine when and how classes can be added to a running Java environment.
 
Game Canvas Basics
Introduces the MIDP 2.0 GameCanvas class and the game loop concept. Required reading for all aspiring "first person shooter" developers.
 
Adding search to your applications
The Lucene search engine is an open source, Jakarta project used to build and search indexes. Lucene can index any text-based information you like and then find it later based on various search criteria.
 
Oracle answers on Linux
The world's business software giant offers answers to the 10 most frequently asked questions about Linux.
 
Core Java Interview Questions!
Core Java Interview Questions! Core Java Interview Questions Question: What is transient variable? Answer: Transient variable can't be serialize. For example if a variable is declared as transient in a Serializable class and the class is written
 
Accessing Database from servlets through JDBC!
Accessing Database from servlets through JDBC! Java Servlets J ava Servlets are server side components that provides a powerful mechanism for developing server side of web application. Earlier CGI was developed to provide server side capabilities
 
one-jar
One-JAR is a simple solution to a vexing problem in Java: how to distribute an application as a single jar-file, when it depends on multiple other jar-files. One-JAR uses a custom classloader to discover library jar files inside the main jar.
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.