首先,它不是一个窗口服务器,它的Linux。
我收到以下代码引发的错误:
javax.naming.NameNotFoundException: Name comp is not bound in this Context
错误导致我上课。该类被调用如下:
ScheduledThreadPoolExecutor stpe = new ScheduledThreadPoolExecutor(1);
stpe.scheduleAtFixedRate(new UpdateHistory(), 0, 30, TimeUnit.MINUTES);
这是班级:
class Update implements Runnable {
UpdateHistory upH = new UpdateHistory ();
public void run() {
try {
upH.update();
} catch (SQLException | NamingException | InterruptedException e) {
e.printStackTrace();
}
}
}
这个类的代码在我的主类调用myServlet.class中。但它产生了第二个.class文件,所以在我的服务器目录中我有:
myServlet.class
myServlet$Update.class
我认为这是由于背景不转移或其他原因,我不是百分百肯定。我应该在我的设置中允许关闭以确保预定的类可以获取上下文吗?
编辑完整的堆栈跟踪:
javax.naming.NameNotFoundException: Name comp is not bound in this Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:152)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at my.package.database.DatabaseManager.connect(DatabaseManager.java:66)
at my.package.database.DatabaseManager.returnHistory(DatabaseManager.java:209)
at my.package.UpdateHistory.upH(update.java:89)
at my.package.myServlet$UpdateHistory.run(myServlet.java:76)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)