• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

How to Catch a Class Not Found Error

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 28319
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bring me the box labeled "thinking cap" ... and then read this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic