Я создал динамический веб-проект (для генерации и отправки отчета)
Иерархия проектов в Eclipse
Project
src(folder)
-metier(Package)
-Util.java(Class)
-web
-ControlleurServlet.java (Servlet)
cfg(folder)
-USERS(file)
WebContent
- gui.jsp (Html form)
Когда я запускаю класс Util (метод: sendMail) как Javaпроект работает:
Util Class:
public class Util {
static String cvsSplitBy = ";";
public static String MAILCONFIGURATION="./cfg/mailConfiguration";
public static String USERS="./cfg/users";
public static String SHIFTS="./cfg/shifts";
.
.
.
Метод sendMail получает некоторые данные из файлов.
, но когда я запускаю проект на сервере и вызываю sendMail из сервлетаЯ получил эту ошибку:
INFO: Server startup in 10135 ms
java.io.FileNotFoundException: .\cfg\users (The system cannot find the path specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at metier.Util.getUsers(Util.java:130)
at web.ControleurServlet.doGet(ControleurServlet.java:37)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1136)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Не могли бы вы помочь?
С уважением