The system cannot find the file specified at...

最近做一个项目,利用winsw将Springboot项目做成可作为Windows服务启动,
然而有一个问题,在Win10和Windows2012 R2上可以正常运行,而到了Windows2008 R2就会产生异常,下面是异常和系统日志.

图片描述

Service cannot be started. 
System.ComponentModel.Win32Exception: The system cannot find the file specified 
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) 
at winsw.WrapperService.StartProcess(Process processToStart, String arguments, String executable) 
at winsw.WrapperService.OnStart(String[] _) 
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)

谁遇到过这类问题?是什么原因呢?

阅读 5.2k
1 个回答

我今天也遇到这个问题,抱着期待的激情点进来,发现没人回答。

花了点时间找到了属于自己场景的解决方法,可能楼主已经不需要了。留给后人乘凉吧。

提示系统文件没有找到,第一时间想到的是Java,可是系统已经配置了全局路径,抱着试试的心态将' <executable>java</executable>' 的java改成了全路径。结果服务可以正常启动。

这应该不是根本问题,我在win10可以正常启动。再winserver2012 r2却要换成全路径,楼主在win2012却是好的。估计是系统配置的问题。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题