Running gradlew gatlingRun
in windows fails with below stacktrace, on a default app generated with below config in Jhipster
{
"generator-jhipster": {
"baseName": "jhipster",
"packageName": "com.mycompany.myapp",
"packageFolder": "com/mycompany/myapp",
"authenticationType": "session",
"hibernateCache": "hazelcast",
"clusteredHttpSession": "no",
"websocket": "spring-websocket",
"databaseType": "sql",
"devDatabaseType": "h2Memory",
"prodDatabaseType": "mysql",
"searchEngine": "no",
"useCompass": false,
"buildTool": "gradle",
"frontendBuilder": "grunt",
"javaVersion": "8",
"rememberMeKey": "93ff732a10ab7d74fc26c1518ee79338de1cd149"
}
}
saw a similar bug on gradle forums but that one seems old and fixed https://issues.gradle.org/browse/GRADLE-2167
I tried reducing my classpath, but no use, still same error. Damn windows!! the classpath added by gradle is too long with all those generated cache folder names. saw this post so wondering if there could be some config to make gatling work on windows with gradle https://discuss.gradle.org/t/filename-too-long-in-windows/9222 any gradle experts to the rescue plz
PS D:\projects\jhtest> ./gradlew gatlingRun --stacktrace
:compileJava UP-TO-DATE
:compileScala UP-TO-DATE
:bower
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileTestJava UP-TO-DATE
:compileTestScala UP-TO-DATE
:findMainClass
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:gatlingRun FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':gatlingRun'.
> A problem occurred starting process 'command 'C:\Program Files\Java\jdk1.8.0_45\bin\java.exe''
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':gatlingRun'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.
java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46
)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskEx
ecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExec
uter.java:42)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.j
ava:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.j
ava:43)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:310)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecut
or.java:79)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecut
or.java:63)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:
51)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:88)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:68)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:55)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter
.java:90)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExe
cuter.java:50)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExe
cuter.java:27)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:40)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:169)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:23
7)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:21
0)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'C:\Program Files\Jav
a\jdk1.8.0_45\bin\java.exe''
at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:196)
at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:325)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:83)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'C:\Program Files\Java\jdk1.8.0_45\bin\java.exe'
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
at net.rubygrapefruit.platform.internal.WindowsProcessLauncher.start(WindowsProcessLauncher.java:22)
at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:65)
... 2 more
Caused by: java.io.IOException: Cannot run program "C:\Program Files\Java\jdk1.8.0_45\bin\java.exe" (in directory "D:\Pr
ojects\jhtest"): CreateProcess error=206, The filename or extension is too long
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
... 5 more
Caused by: java.io.IOException: CreateProcess error=206, The filename or extension is too long
... 6 more
BUILD FAILED
Total time: 31.59 secs
The below is the working fix for this issue, thanks to @atomfrede Manifest jar needs to be named as gatlingBooter.jar and Gatling version needs to be 2.1.6
task manifestJar(dependsOn:'compileTestScala',type: Jar) {
dependsOn configurations.testCompile
archiveName 'gatlingBooter.jar'
doFirst {
manifest {
// uri is just needed for Windows-compatibility
attributes 'Class-Path': configurations.testCompile.files.collect{ project.uri(it) }.join(' ')
}
}
}
task gatlingRun(dependsOn:'manifestJar', type: JavaExec) {
group = "gatling"
standardInput = System.in
final def sourceSet = sourceSets.test
File configFile = file('src/test/gatling/conf/gatling.conf')
def String gatlingDataFolder = "$project.rootDir.absolutePath/src/test/gatling/data"
def String gatlingReportsFolder = "$project.buildDir.absolutePath/reports/gatling"
def String gatlingBodiesFolder = "$project.rootDir.absolutePath/src/test/gatling/bodies"
def String gatlingSimulationsFolder = "$project.rootDir.absolutePath/src/test/gatling/simulations"
classpath sourceSet.output + files(manifestJar.archivePath) + files("src/test/gatling/conf")
main = "io.gatling.app.Gatling"
environment GATLING_HOME:''
args '-df', gatlingDataFolder
args '-rf', gatlingReportsFolder
args '-bdf', gatlingBodiesFolder
args "-sf", gatlingSimulationsFolder
}
Gatling 2.2 (not released yet, and no ETA) will work around Windows command line length limit by passing the classpath as a manifest only jar, see https://github.com/gatling/gatling/issues/2732.
Until release, you can use 2.2.0-SNAPSHOT published on Sonatype. Ot ditch Windows and use Linux or OSX.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With