First off, its not a window server, its Linux.
I'm getting this errors thrown by the following code:
javax.naming.NameNotFoundException: Name comp is not bound in this Context
The error leads back to a class I have. The class is called like so:
ScheduledThreadPoolExecutor stpe = new ScheduledThreadPoolExecutor(1);
stpe.scheduleAtFixedRate(new UpdateHistory(), 0, 30, TimeUnit.MINUTES);
And this is the class:
class Update implements Runnable {
UpdateHistory upH = new UpdateHistory ();
public void run() {
try {
upH.update();
} catch (SQLException | NamingException | InterruptedException e) {
e.printStackTrace();
}
}
}
This class' code is inside my main class call myServlet.class. But it produces a second .class file so on my server directory I have:
myServlet.class
myServlet$Update.class
I think this is due to the context not transferring or something, I'm not 100% sure. Should I allowLinking in my settings to make sure the scheduled class can obtain the context?
Edit full stacktrace:
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)