Jenkins构建失败,“无法找到资源”

时间:2016-06-10 19:04:27

标签: java batch-file jenkins jar

我正在尝试使用这个简单的Windows批处理命令从jar运行此jenkins文件:

cd "c:\bitbucket-backup-client"
"C:\Program Files\Java\jdk1.8.0_91\bin\java.exe" -jar bitbucket-backup-client.jar

并不断收到此错误:

Started by user anonymous
Building in workspace C:\Program Files (x86)\Jenkins\workspace\GitNightlyBackup
[GitNightlyBackup] $ cmd /c call C:\Windows\TEMP\hudson5635751839942755496.bat

C:\Program Files (x86)\Jenkins\workspace\GitNightlyBackup>cd "c:\bitbucket-backup-client" 

c:\bitbucket-backup-client>"C:\Program Files\Java\jdk1.8.0_91\bin\java" -jar bitbucket-backup-client.jar 
12:32:33,501 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
12:32:33,501 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
12:32:33,501 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/C:/bitbucket-backup-client/lib/bitbucket-backup-core-3.2.0.jar!/logback.xml]
12:32:33,517 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@76b1e9b8 - URL [jar:file:/C:/bitbucket-backup-client/lib/bitbucket-backup-core-3.2.0.jar!/logback.xml] is not of type file
12:32:33,829 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
12:32:34,032 |-INFO in ch.qos.logback.core.joran.action.ConversionRuleAction - registering conversion word pcComplete with class [com.atlassian.bitbucket.internal.backup.client.logback.PercentCompleteConverter]
12:32:34,032 |-INFO in ch.qos.logback.core.joran.action.DefinePropertyAction - About to instantiate property definer of type [com.atlassian.bitbucket.internal.backup.client.logback.ConsoleFormatPropertyDefiner]
12:32:34,048 |-INFO in ch.qos.logback.core.joran.action.DefinePropertyAction - Popping property definer for property named [console.format] from the object stack
12:32:34,048 |-INFO in ch.qos.logback.core.joran.action.DefinePropertyAction - About to instantiate property definer of type [com.atlassian.bitbucket.internal.backup.client.logback.LogDirectoryPropertyDefiner]
12:32:34,126 |-INFO in ch.qos.logback.core.joran.action.DefinePropertyAction - Popping property definer for property named [log.dir] from the object stack
12:32:34,189 |-INFO in ch.qos.logback.core.joran.action.DefinePropertyAction - About to instantiate property definer of type [com.atlassian.bitbucket.internal.backup.client.logback.LogFormatPropertyDefiner]
12:32:34,204 |-INFO in ch.qos.logback.core.joran.action.DefinePropertyAction - Popping property definer for property named [log.format] from the object stack
12:32:34,204 |-INFO in ch.qos.logback.core.joran.action.DefinePropertyAction - About to instantiate property definer of type [com.atlassian.bitbucket.internal.backup.client.logback.LogTimestampPropertyDefiner]
12:32:34,204 |-INFO in ch.qos.logback.core.joran.action.DefinePropertyAction - Popping property definer for property named [log.timestamp] from the object stack
12:32:34,360 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
12:32:34,376 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [console]
12:32:34,376 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
12:32:34,485 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.FileAppender]
12:32:34,485 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [log]
12:32:34,485 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
12:32:34,485 |-INFO in ch.qos.logback.core.FileAppender[log] - File property is set to [R:\Mobile\GitBackup\log/atlassian-sbc-2016-06-10-1232.log]
12:32:34,501 |-ERROR in ch.qos.logback.core.FileAppender[log] - Failed to create parent directories for [R:\Mobile\GitBackup\log\atlassian-sbc-2016-06-10-1232.log]
12:32:34,501 |-ERROR in ch.qos.logback.core.FileAppender[log] - openFile(R:\Mobile\GitBackup\log/atlassian-sbc-2016-06-10-1232.log,true) call failed. java.io.FileNotFoundException: R:\Mobile\GitBackup\log\atlassian-sbc-2016-06-10-1232.log (The system cannot find the path specified)
    at java.io.FileNotFoundException: R:\Mobile\GitBackup\log\atlassian-sbc-2016-06-10-1232.log (The system cannot find the path specified)
    at  at java.io.FileOutputStream.open0(Native Method)
    at  at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at  at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at  at ch.qos.logback.core.recovery.ResilientFileOutputStream.<init>(ResilientFileOutputStream.java:28)
    at  at ch.qos.logback.core.FileAppender.openFile(FileAppender.java:149)
    at  at ch.qos.logback.core.FileAppender.start(FileAppender.java:108)
    at  at ch.qos.logback.core.joran.action.AppenderAction.end(AppenderAction.java:96)
    at  at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:317)
    at  at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:196)
    at  at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:182)
    at  at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:149)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:135)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:99)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:49)
    at  at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
    at  at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:148)
    at  at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
    at  at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
    at  at org.slf4j.LoggerFactory.bind(LoggerFactory.java:140)
    at  at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:119)
    at  at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:328)
    at  at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:280)
    at  at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:301)
    at  at org.slf4j.LoggerFactory$getLogger.call(Unknown Source)
    at  at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at  at com.atlassian.bitbucket.internal.backup.client.BackupMain.<clinit>(BackupMain.groovy:22)
    at  at java.lang.Class.forName0(Native Method)
    at  at java.lang.Class.forName(Class.java:264)
    at  at com.atlassian.bitbucket.internal.backup.client.JavaVersionCheckingShim.invokeClientClassMain(JavaVersionCheckingShim.java:64)
    at  at com.atlassian.bitbucket.internal.backup.client.JavaVersionCheckingShim.run(JavaVersionCheckingShim.java:85)
    at  at com.atlassian.bitbucket.internal.backup.client.JavaVersionCheckingShim.access$000(JavaVersionCheckingShim.java:14)
    at  at com.atlassian.bitbucket.internal.backup.client.JavaVersionCheckingShim$BackupMain.main(JavaVersionCheckingShim.java:32)
12:32:34,986 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to WARN
12:32:34,986 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [console] to Logger[ROOT]
12:32:34,986 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [log] to Logger[ROOT]
12:32:34,986 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.atlassian.bitbucket] to INFO
12:32:34,986 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.atlassian.bitbucket.internal.backup.client.spring.SpringMain$ClassPathXmlWithSingletonsApplicationContext] to WARN
12:32:34,986 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [liquibase] to OFF
12:32:34,986 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.springframework] to WARN
12:32:34,986 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.springframework.beans.factory.config.PropertiesFactoryBean] to ERROR
12:32:34,986 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.springframework.web.client.RestTemplate] to ERROR
12:32:35,001 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
12:32:35,001 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@248e319b - Registering current configuration as safe fallback point

2016-06-10 12:32:35,079 INFO         Initializing
2016-06-10 12:32:36,423 WARN         Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'backupHome' defined in class path resource [META-INF/spring/common-spring.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.atlassian.bitbucket.internal.backup.client.layout.DefaultBackupHome]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Could not create R:\Mobile\GitBackup
2016-06-10 12:32:36,439 ERROR        The application could not be started. An unexpected error prevented the Spring
ApplicationContext from being created. Details of the error follow.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'backupHome' defined in class path resource [META-INF/spring/common-spring.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.atlassian.bitbucket.internal.backup.client.layout.DefaultBackupHome]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Could not create R:\Mobile\GitBackup
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:275) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1143) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    ... 14 more frames available in the log file

c:\bitbucket-backup-client>exit 2 
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE

我在Config部分添加了JAVA_HOME,当我在我的机器上执行批处理命令时,批处理命令正常工作。

编辑:

仍然不确定这种方法有什么问题,但我只需拨打start就可以了解它:

start "C:\path\to\file.jar"

0 个答案:

没有答案