• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

How to Catch a Class Not Found Error  RSS feed

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a simple Java program in a web application as follows. When the code runs, the line that prints 'Point A' executes, but the line that prints 'Point B' does not. Otherwise, there are no error messages. Apparently the class 'XfoObj' is not being found, but I find that when the line that references this class executes, it causes the web page to hang and I then need to reboot the server. Is there a means of preventing the program from hanging if a class is not found? Thanks.


import lotus.domino.*;
import java.io.*;
import java.util.*;
import jp.co.antenna.XfoJavaCtl.*;

class ErrDump implements MessageListener {

public void onMessage(int errLevel, int errCode, String errMessage) {
System.out.println("ErrorLevel = " + errLevel + "\nErrorCode = " +
errCode + "\n" + errMessage);
}
}

public class JavaAgent extends AgentBase {

public void NotesMain() {

XfoObj axfo = null;
try {
System.out.println("Point A");

axfo = new XfoObj();

System.out.println("Point B");

} catch(Exception e) {

} finally {}
}
}
 
Sheriff
Posts: 23646
49
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a way. But it doesn't appear to me that the possibility of not finding the class is a design feature of that web application. So the way to fix your original problem is to fix the web application's configuration so it does find the class. Most likely that would involve finding the jar file that contains the class and dropping that jar file into the web application's WEB-INF/lib directory.
 
Ranch Hand
Posts: 116
Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the problem was that the class was not found then you would get a ClassNotFoundException when the containing class was loaded, not when the line in question is executed.
The problem is more likely a loop somewhere in the constructor for XfoObj.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!