使用此信息https://hayato-iriumi.net/2019/05/23/how-to-install-jenkins-slave-as-windows-service/,我们正在Windows服务器上设置Jenkins Slave。Jenkins代理从命令行启动。但当我们从Windows服务启动时,它会给出以下错误消息?如何解决此错误消息?
Service cannot be started. System.IO.InvalidDataException: Attribute <className> is missing in configuration XML
at winsw.Util.XmlHelper.SingleAttribute[TAttributeType](XmlElement node, String attributeName)
at winsw.Extensions.WinSWExtensionDescriptor.FromXml(XmlElement node)
at winsw.Extensions.WinSWExtensionManager.LoadExtension(String id)
at winsw.Extensions.WinSWExtensionManager.LoadExtensions()
at winsw.WrapperService.OnStart(String[] args)
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)
我们拥有的xml文件
<service>
<id>JenkinsSlave</id>
<name>Jenkins agent</name>
<description>This service runs an agent for Jenkins automation server.</description>
<executable>c:\java\jdk-11\bin\java.exe</executable>
<arguments>-Xrs -jar "c:\jenkins\slave.jar" -jnlpUrl https://jenkinsmaster/jenkins/computer/slave01/slave-agent.jnlp -secret a4b5b4ddfd34a016cd3a8eb94cbe8f908613e33a66db5fa6f5f43a080aea3116 -workDir=c:\jenkins</arguments>
<workingdirectory>c:\jenkins</workingdirectory>
<logmode>rotate</logmode>
<onfailure action="restart">
<download from="https://jenkinsmaster/jenkins/jnlpJars/slave.jar" to="c:\jenkins\slave.jar">
<extensions>
<extension enabled="false" classname="winsw.Plugins.RunawayProcessKiller.RunawayProcessKillerExtension" id="killOnStartup">
<pidfile>c:\jenkins\jenkins_agent.pid</pidfile>
<stoptimeout>5000</stoptimeout>
<stopparentfirst>false</stopparentfirst>
</extension>
</extensions>
</download>
</onfailure>
</service>
谢谢
3条答案
按热度按时间r6l8ljro1#
在链接的网页(你的网页显然是基于它的)上显示的示例“Jenkins-Slave.xml”中有一些错误。它的所有元素和属性都以小写命名,但实际上其中一些应该是大小写混合的(从错误消息中可以看出,它没有找到属性
className
)。试试这个吧:
这是从一个更详细的解释,如何安装代理作为一个Windows服务,我已经在this answer。
5us2dqdw2#
xfb7svmp3#
className
、stopTimeout
和stopParentFirst
不应为小写。