tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Artur Rataj" <arturra...@gmail.com>
Subject Re: STrange problem with a thread made in Servlet.init()
Date Wed, 22 Feb 2006 17:23:36 GMT
On 2/22/06, David Smith <dns4@cornell.edu> wrote:
> Hmmm.... A very verbose exception message.  Can we see the code that
> threw the exception?  Are there any other exceptions in the logs before
> this one?
>

There is a servlet that loads on start up. In its init(ServletConfig
config) is a code starting a new thread:

        LoggerThread loggerThread = new LoggerThread();
        loggerThread.start();

the run() method of the LoggerThread is as follows:

    public void run() {
        try {
            try {
                String fifoName = MapTable.get("tlog_conf", "feed-fifo");
                System.out.println("LoggerThread: feed fifo name is `"
+ fifoName + "'");
                Logger logger = new Logger(fifoName, 1000*10);
            } catch(IOException e) {
                throw new IOException("Could not start traffic logger
thread: " + e.toString());
            } catch(SQLException e) {
                throw new IOException("Could not start traffic logger
thread: " + e.toString());
            }
        } catch(IOException e) {
            System.out.println(e.toString());
        }
    }

It is being developed, and no proper error handling is done yet.

The constructor of Logger is in an infinite loop that scans fifo
output. The last line of the code shown causes the error:

    public Logger(String namedPipe, int reportPeriod) throws
            IOException {
        InputStream in;
        try {
            in = new FileInputStream(namedPipe);
        } catch(FileNotFoundException e) {
            throw new IOException("Could not open pipe: " +
                    e.toString());
        }
        Scanner scanner = new Scanner(in);

The catalina.out log up to the error is as follows:

Feb 22, 2006 5:26:02 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Feb 22, 2006 5:26:02 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1852 ms
Feb 22, 2006 5:26:02 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Feb 22, 2006 5:26:02 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.15
Feb 22, 2006 5:26:02 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
LoggerThread: feed fifo name is `/home/art/fifo'
Exception in thread "HSQLDB Timer @dc57db" java.lang.NullPointerException
        at org.hsqldb.lib.HsqlTimer.nextTask(Unknown Source)
        at org.hsqldb.lib.HsqlTimer$TaskRunner.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:595)
Feb 22, 2006 5:26:07 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Feb 22, 2006 5:26:07 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Feb 22, 2006 5:26:07 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/50  config=null
Feb 22, 2006 5:26:07 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Feb 22, 2006 5:26:07 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 5577 ms

As you can see, HSQLDB, that worked correctly before adding the
thread, started to misbehave for some reason, too.

Best regards,
Artur

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message