Hi all,
I am investigating Javassist to use with babeldoc (www.babeldoc.com) in a number of roles:
1. Gui framework
2. Dynamic pipeline compiler.
I am currently trying to rework the javassist.web.WebServer / Appserver to be a Tomcat 4.1 servlet. Here are the guts of the application:
public void init() throws ServletException {
try {
exportedNames = new HashMap();
exportedObjects = new ArrayList();
classPool = ClassPool.getDefault();
}
catch(Exception e) {
e.printStackTrace();
}
}
And then in the doGet, called to download the classes as an octet-stream:
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
logging("Path Info:"+request.getPathInfo());
String filename = request.getPathInfo();
byte[] classfile = null;
String classname
= filename.substring(1, filename.length() - 6).replace('/', '.');
logging("Finding class: "+classname);
try {
logging("Method 1");
Class clazz = Class.forName(classname);
logging("Method 2");
CtClass ctclass = classPool.get(classname);
I get an exception from Javassist that it cannot load the class (that has jsut been loaded by the regular ClassLoader, or the one that Apache has provided)
javassist.NotFoundException: com.babeldoc.web.server.Counter
at javassist.ClassPoolTail.openClassfile(ClassPoolTail.java:270)
at javassist.ClassPoolTail.readClassfile(ClassPoolTail.java:234)
at javassist.ClassPoolTail.write(ClassPoolTail.java:154)
at javassist.ClassPoolTail.write(ClassPoolTail.java:160)
Any and all help will be much appreciated. I am using Tomcat/4.1.24-LE-jdk14 on windows 2000.
regards,
Bruce McDonald.