Take the 2-minute tour ×

I am attempting to run a tomcat application, but when I try to go to the application I get:

java.lang.NoClassDefFoundError: Could not initialize class ysl.util.Utils ysl.util.Utils.executeQuery(Utils.java:186)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)

I have found many references to this problem on the web - most say there was a class available when the application was compiled that is not available at run time and that I need to add something to the java classpath to find it. But how can I determine what class is missing?

The error message says that the Utils class could not be initialized, yet the stacktrace shows that we are into the second method in the class, so I would think that the class was already initialized. And certainly that is not the class whose definition can't be found, since we have line number information in the stacktrace.

The method which is triggering the error looks like this:

static public ResultSet executeQuery(String queryString) throws SQLException {
return dbConnPool.executeQuery(queryString);

Any suggestions?

share|improve this question
On that particular one, there should be another root cause further down in the stacktrace. If there is any, post it as well (it contains the answer). If there's none, then it's likely a bug in static initialization of ysl.util.Utils class which is suppressing the root cause of the exception (doublecheck all static fields and blocks of that class). –  BalusC Nov 14 '11 at 20:07
add comment

2 Answers

Most likely the Utils class is trying to use another class that is unavailable during static initialization (that would be the root cause that @BalusC pointed out). The failure to load that class causes Utils to fail as well, so even though Utils is defined, its dependencies are not.

share|improve this answer
add comment

If you are using oracle (ex Sun) java, try running:

java -verbose:class

more options under http://download.oracle.com/javase/6/docs/technotes/tools/windows/java.html

You will see what classes were loaded.

share|improve this answer
add comment

Your Answer


