开发者

Java app as windows service with database connection

i'm trying to run java application as a windows service with tomcat 7. in this application i have database connection to MySql with Hibernate. when i ran the 开发者_C百科tomcat it stops in this line:

SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); 

i have all the necessary jars of the hibernate in WEB-INF\lib directory. when run this app from the eclipse its running fine. this is the run.bat file:

cd "c:\Users\sl300\Project\temp3\build\classes"
temp3.exe //IS//temp3 ^
--Install="c:\Users\sl300\Project\temp3\build\classes\temp3.exe" ^
--Description="My Watcher Service" ^
--Jvm=auto ^
--Classpath="c:\Users\sl300\Project\temp3\build\classes" ^
--StartMode=jvm --StartClass=ServiceControl ^
--StartMethod=windowsService ^
--StartParams=start ^
--StopMode=jvm ^
--StopClass=ServiceControl ^
--StopMethod=windowsService ^
--StopParams=stop ^
--LogPath="c:\Users\sl300\Project\temp3\logs" ^
--StdOutput=auto ^
--StdError=auto 
temp3w //MS//

what i need to do to make this work?


A detailed manual on how to configure Tomcat as a Windows service is available at tomcat.apache.org. This should solve your problems.

It is provided in the Windows specific ZIP downloads only, not the generic ones.

EDIT: This is not an answer, but I did want to stop chatting in the coments section:

  1. Why is your temp3.exe located in the folder ...build/classes, this does not make sense to me?
  2. Why did you rename it to temp3.exe?
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜