我尝试在Windows Server 2008中安装tomcat作为服务。
我在stackoverflow中搜索并且无法找到这个问题的任何答案,我可以看到所有这些问题都不相同的其他相关问题(与代码错误0相关,我的是代码错误1 )或者没有有效的答案,所以我决定创建这个问题。
我用它来创建服务:
https://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html#Installing_services
tomcat7 //IS//Tomcat7 --DisplayName="Apache Tomcat 7" \
在命令之后,我可以在我的服务列表中看到Apache Tomcat 7服务,问题是它已经停止,如果我尝试启动它,我可以看到这个错误:
Windows could not start the Apache Tomcat 7 on Local Computer. For
more information, review the System Event Log. If this is a
non-Microsoft service, contact the service vendor, and refer to
service-specific error code 1.
在系统事件查看器中,我可以看到此日志中的错误:
The Apache Tomcat 7 service terminated with service-specific error Incorrect function..
我正在使用java 64位,并且我使用tomcat 32和64位进行测试,在两者中我都有同样的问题。我还尝试使用管理员权限打开cmd.exe,我也有同样的问题......
感谢您的帮助
仅供参考:如果我使用startup.bat手动启动tomcat,它会正确启动
答案 0 :(得分:3)
我解决了它只是用其他方法安装服务:
service.bat install
此命令将卸载服务:
service.bat uninstall
要启动它并启用自动启动,您必须进入Windows的服务管理器(西班牙语版本的Servicios)并启动该服务并启用自动启动。
如果你在tomcat / bin目录中找到service.bat文件,请阅读:
apache-tomcat-[version].zip or .tar.gz
Base distribution. These distributions do not include the Windows service wrapper nor the compiled APR/native library for Windows.
apache-tomcat-[version]-windows-x86.zip
32-bit Windows specific distribution that includes the Windows service wrapper and the compiled APR/native library for use with 32-bit JVMs on both 32 and 64 bit Windows platforms.
apache-tomcat-[version]-windows-x64.zip
64-bit Windows specific distribution that includes the Windows service wrapper and the compiled APR/native library for use with 64-bit JVMs on x64 Windows platforms.
答案 1 :(得分:0)
我无法在Windows 10或Windows 2012中将Apache Tomcat安装为服务。运行Service.bat install
命令后,例程会找到JDK,但总是失败,例如:服务安装失败。
我的解决方案:创建指向
的Windows任务计划程序任务C:\tomcat7\bin\startup.bat
并使该任务在系统启动时启动,无需系统登录。在两个操作系统中都像魅力一样。
HTH。
答案 2 :(得分:0)
答案 3 :(得分:0)
这是因为您的JDK / Java运行时环境和您的Tomcat安装不匹配。两者都必须是32位或64位。
步骤1:卸载Apache Tomcat。第2步:卸载java和jdk。
第2步:下载相同的架构安装。
第3步:重新安装。
这将解决您的问题。