----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------


hi everyone,

thanks for replying my mail. it's really a great relief knowing that there
is somebody out there willing to listen to my problem, especially during
this critical moment.

after trying lots of things, i have successully narrowed down the problem.
it seemed that the problem comes from org.apache.ecs.ConcreteElement class
(but only when it is created from the startup servlet). you can reproduce
this by following what i have done. i created 3 classes: Debug,
MyStartupServlet, and TestClass. Debug class basically is just a class for
printing my debug message to a text file (because i am not able to output
my
debug message to the screen in apache (can i????)). MyStartupServlet is a
servlet which is supposed to be loaded at the startup of apache jserv,
which
basically writes 'before allocating a new object' to a text file, allocates
a new TestClass object, and overwrites the text file by writing 'after
allocating a new object'. TestClass is my test class that demonstrates that
a problem arises when there is a method that calls
ConcreteElement.setPrettyPrint() - this method doesn't event get called!!!!
so if everything is running as expected, after restarting the httpd, we
should have a text file that contains 'after allocating a new object'. but
instead it will contain 'before allocating a new object'. try it!!!! but if
you comment out the ce.setPrettyPrint(true) in the TestClass' testmethod(),
everything will be fine. the question is: WHY????? what is something
special
about this org.apache.ecs.ConcreteElement.setPrettyPrint()????

the following are my 3 above mentioned classes:

Debug.java:

import java.io.PrintWriter;
import java.io.FileOutputStream;

public class Debug {
           public static void print(String s) {
                     try {
                               PrintWriter pw = new PrintWriter(new
FileOutputStream("/home/ferry/servlets/vodafone/output.txt"));
                               pw.print(s);
                               pw.flush();
                               pw.close();
                     }  /* try. */
                     catch(Exception e) {
                               System.err.println("Exception caught: " +
e.getMessage());
                               e.printStackTrace();
                     }  /* catch. */
           }  /* print(). */
}  /* Debug. */

MyStartupServlet.java:

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

public class MyStartupServlet extends HttpServlet {

           public MyStartupServlet() throws ServletException, IOException {
                     Debug.print("before allocating a new object.");
                     new TestClass();
                     Debug.print("After allocating a new object.");
           }  /* MyStartupServlet. */
}  /* MyStartupServlet. */

TestClass.java:

import org.apache.ecs.ConcreteElement;

public class TestClass {
           private void testMethod(ConcreteElement ce) {
                     ce.setPrettyPrint(true);  // this is where the problem
lies.... comment
this out and you will be fine.
           }
}  /* TestClass. */

again, thanks for the help... please email me answers to this problem at
[EMAIL PROTECTED] AND [EMAIL PROTECTED]

ferry

-----Original Message-----
From: Bruno Wenger [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 15 November 2000 7:06 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: servlets.startup=MyStartupServlet


It is difficult to heeeelp if we dont know what your
servlet is supposed to do.

If you provide the servlet class, chances are better to
get an answer.

Regards
Bruno





--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search Archives: 
<http://www.mail-archive.com/java-apache-users%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to