Tomcat应用程序在启动期间停止。通过查看调用堆栈,我可以看到它停留在其主线程上:
"RMI Scheduler(0)": awaiting notification on [0xe9892698]
at sun.misc.Unsafe.park(Native Method)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1987)
at java.util.concurrent.DelayQueue.take(DelayQueue.java:160)
"main": running, holding [0xe5818b78, 0xe9889690, 0xe98880e8, 0xbad69fc0, 0xbad69f20, 0xbad663b8, 0xbad16508]
at sun.nio.ch.FileChannelImpl.lock0(Native Method)
at sun.nio.ch.FileChannelImpl.tryLock(FileChannelImpl.java:881)
at java.nio.channels.FileChannel.tryLock(FileChannel.java:962)
at java.util.logging.FileHandler.openFiles(FileHandler.java:396)
at java.util.logging.FileHandler.<init>(FileHandler.java:270)
at com.xyxy.visualizer.util.DsvLogger.<init>(DsvLogger.java:32)
...
以下是DsvLogger类的代码。
package com.xyxy.visualizer.util;
import java.io.PrintStream;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.logging.FileHandler;
import java.util.logging.Formatter;
import java.util.logging.Handler;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
public class DsvLogger
extends Logger {
private static final String LOG_LOCATION = "/nfsdir1/xyxy/webapps/logs"
private static DsvLogger instance;
private DsvLogger() throws SecurityException {
super("DSVLogger", null);
String filename = new SimpleDateFormat("yyyy-MM-dd_hh-mm-ss_").format(Calendar.getInstance().getTime()) + ".log";
FileHandler fh = null;
try {
fh = new FileHandler(LOG_LOCATION + filename, false);
fh.setFormatter(new SimpleFormatter());
this.addHandler(fh);
}
catch (Exception e) {
System.out.println("file handler not initialized for file: " + LOG_LOCATION + filename);
}
}
public static DsvLogger getInstance() throws SecurityException {
DsvLogger dsvLogger = instance == null ? (DsvLogger.instance = new DsvLogger()) : instance;
return dsvLogger;
}
}
它设置NFS目录的日志路径。最近NFS服务器存在一些问题,但Tomcat本身可以毫无问题地写入其日志消息(在相同的NFS共享但不同的目录上)。
Tomcat和应用程序在nfs vers = 3的Solaris 10服务器上运行,而NFS服务器在Redhat上运行nfs3和nfs4。
非常明显的是,在日志位置下,应用程序创建的文件不符合代码中指定的名称,但后缀为“.lck”:
2017-10-12_05-00-36_.log.lck
大小为0。 当我尝试查看创建的日志文件时,cat命令会冻结。
任何人都知道此应用程序可能出现的问题?