Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tomcat service status is stop, but it is started already #1058

Open
wzshuang opened this issue Oct 17, 2023 · 1 comment
Open

tomcat service status is stop, but it is started already #1058

wzshuang opened this issue Oct 17, 2023 · 1 comment

Comments

@wzshuang
Copy link

Problem statement

I download tomcat zip file from official website and unzip it to my disk,it can be manually start by double click startup.bat.
when I install it as windows service and start, it stop immediately after successful startup, pls help me out, thanks.

Stopping after service startup, certain services will automatically stop when not in use by other services or programs.
image
image
image

my config file:

<service>
  <id>myapp</id>
  <name>MyApp Service (powered by WinSW)</name>
  <description>This service is a service created from a sample configuration</description>
  <env name="CATALINA_HOME" value="D:\apache-tomcat-8.5.63" />
  <executable>%CATALINA_HOME%\bin\startup.bat</executable>
  <log mode="roll"></log>
  <logpath>%BASE%\logs</logpath>
</service>

myappout.log:

Using CATALINA_BASE:   "D:\apache-tomcat-8.5.63"
Using CATALINA_HOME:   "D:\apache-tomcat-8.5.63"
Using CATALINA_TMPDIR: "D:\apache-tomcat-8.5.63\temp"
Using JRE_HOME:        "D:\Program Files\Java\jdk1.8.0_261"
Using CLASSPATH:       "D:\apache-tomcat-8.5.63\bin\bootstrap.jar;D:\apache-tomcat-8.5.63\bin\tomcat-juli.jar"
Using CATALINA_OPTS:   ""

myappwrapper.log

2023-10-17 16:26:59,183 DEBUG - Starting WinSW in console mode
2023-10-17 16:27:01,557 DEBUG - Starting WinSW in console mode
2023-10-17 16:27:01,599 INFO  - Starting service 'MyApp Service (powered by WinSW) (myapp)'...
2023-10-17 16:27:02,138 DEBUG - Starting WinSW in service mode
2023-10-17 16:27:02,173 INFO  - Service 'MyApp Service (powered by WinSW) (myapp)' started successfully.
2023-10-17 16:27:02,293 INFO  - Starting D:\apache-tomcat-8.5.63\bin\startup.bat 
2023-10-17 16:27:02,324 INFO  - Started process 12352
2023-10-17 16:27:02,344 DEBUG - Forwarding logs of the process System.Diagnostics.Process (cmd) to WinSW.RollingLogAppender

but I can't find the pid 12352.

@wzshuang wzshuang changed the title service status is stop, but it is started already tomcat service status is stop, but it is started already Oct 17, 2023
@HKMV
Copy link

HKMV commented Dec 20, 2023

修改startup.bat文件在倒数第二行,也就是call调用下面一行添加:pause

附上我的xml配置文件(winsw软件和配置文件放在tomcat根目录):

<service>
  <id>Tomcat</id>
  <name>Tomcat Service (powered by WinSW)</name>

  <executable>%BASE%\bin\startup.bat</executable>
  <stopparentprocessfirst>false</stopparentprocessfirst>
  <stopexecutable>%BASE%\bin\shutdown.bat</stopexecutable>

  <logpath>%BASE%\logs</logpath>
</service>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants