Unable to read csv file from the build folder , that get created while I run my post requests - scala-gatling

I am trying to read data from csv file for my patch and delete requests. I am not adding a csv file by myself, it is getting generated after the completion of my post requests in the build folder with the path resources/test/data/"****".csv .
Earlier when I was using dependencies as follows, it was working fine:-
testCompile group: 'io.gatling.highcharts', name: 'gatling-charts-highcharts', version: '2.2.5'
testCompile 'org.scala-lang:scala-library:2.11.12'
compile "org.scalaj:scalaj-http_2.11:2.3.0"
compile group: 'com.github.tototoshi', name: 'scala-csv_2.11', version: '1.2.2'
But now when i updated my application as follows :-
testCompile group: 'io.gatling.highcharts', name: 'gatling-charts-highcharts', version: '3.3.1'
testCompile 'org.scala-lang:scala-library:2.12.10'
compile "org.scalaj:scalaj-http_2.11:2.4.2"
compile group: 'com.github.tototoshi', name: 'scala-csv_2.12', version: '1.3.6'
it is giving me the error as
Caused by: java.lang.IllegalArgumentException: Could not locate feeder file: Resource ******.csv not found
at io.gatling.core.feeder.FeederSupport.separatedValues(FeederSupport.scala:45)
at io.gatling.core.feeder.FeederSupport.separatedValues$(FeederSupport.scala:40)
at io.gatling.core.Predef$.separatedValues(Predef.scala:24)
at io.gatling.core.feeder.FeederSupport.csv(FeederSupport.scala:34)
at io.gatling.core.feeder.FeederSupport.csv$(FeederSupport.scala:33)
at io.gatling.core.Predef$.csv(Predef.scala:24)

Your classpath is a mess as you have libraries compiled against Scala 2.11 (scalaj-http_2.11) and Scala 2.12 (scala-library:2.12.10, gatling-charts-highcharts:3.3.1).
You need to have Scala 2.12 everywhere.
Then, you file can't be located. It should be in src/test/resources. Where have you placed it? Have you checked for possible typos?

Related

Library mismatch (quartz, activiti-engine, usertype.jodatime, grails-shiro)

I am testing my old BuildConfig configuration from grails version 2.5.6 to build.gradle from grails version 4.0.1.
For that I try to generate a test application where I'm just setting up build.gradle and nothing more.
In the dependencies section I have:
// My customizations
compile "org.grails.plugins:scaffolding"
// JodaTime
// https://mvnrepository.com/artifact/org.jadira.usertype/usertype.core
compile 'org.joda:joda-money:1.0.1'
compile group: 'joda-time', name: 'joda-time', version: '2.10.5'
compile group: 'org.jadira.usertype', name: 'usertype.jodatime', version: '2.0.1'
// Activiti BPM
compile group: 'org.activiti.core.common', name: 'activiti-project-model', version: '7.1.0.M5'
compile group: 'org.activiti.api', name: 'activiti-api-runtime-shared', version: '7.1.0.M5'
compile group: 'org.activiti', name: 'activiti-process-validation', version: '7.1.0.M5'
compile group: 'org.activiti', name: 'activiti-bpmn-model', version: '7.1.0.M5'
compile group: 'org.activiti', name: 'activiti-bpmn-converter', version: '7.1.0.M5'
compile group: 'org.activiti', name: 'activiti-engine', version: '7.1.0.M5'
// Quartz
compile group: 'org.quartz-scheduler', name: 'quartz', version: '2.3.2'
// Shiro
compile group: 'org.grails.plugins', name: 'grails-shiro', version:'4.2'
With this configuration above we get the following error:
"C:\Program Files\Java\jdk1.8.0_231\bin\java.exe" -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:CICompilerCount=3 -Djline.WindowsTerminal.directConsole=false -Dfile.encoding=UTF-8 -classpath C:\Users\pedro\AppData\Local\Temp\classpath2104238730.jar org.grails.cli.GrailsCli run-app --plain-output
|Resolving Dependencies. Please wait...
CONFIGURE SUCCESSFUL in 8s
|Running application...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':bootRun'.
> A problem occurred starting process 'command 'C:\Program Files\Java\jdk1.8.0_231\bin\java.exe''
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 14s
Error |
Failed to start server (Use --stacktrace to see the full trace)
Process finished with exit code 1
The application runs perfectly if, for example, we delete one (only one) from the following libraries: quartz, usertype.jodatime, grails-shiro, activiti-engine
That is, these libraries do not all work together, I need to remove some of them for the application to run.
Could you shed some light on this issue?
Thanks a lot

Jenkins cannot resolve dependencies for global shared library

I'm trying to set-up a Jenkins pipeline with Jenkinsfile which calling methods from a self-implemented global shared library with the #Library("name-of-library") at the head of the Jenkinsfile.
However, the library I'm using is a groovy project which is organized by Gradle. That is, we have a build.gradle at the root of the whole repo of the library where dependencies are defined.
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.4.15'
compile group: 'commons-io', name: 'commons-io', version: '2.6'
compile group: 'eu.agno3.jcifs', name: 'jcifs-ng', version: '2.1.1'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.8.0-beta4'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-all:1.9.5'
testCompile group:'com.lesfurets', name:'jenkins-pipeline-unit', version:'1.0'
}
When we triggered a build based on the pipeline metioned above, we found that Jenkins might not recognized the build.gradle which leads to the following errors:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
file:/var/lib/jenkins/jobs/test-pipeline/builds/4/libs/name-of-library/src/com/test/model/SMBConnection.groovy: 4: unable to resolve class jcifs.context.BaseContext
# line 4, column 1.
import jcifs.context.BaseContext
^
file:/var/lib/jenkins/jobs/test-pipeline/builds/4/libs/name-of-library/src/com/test/model/SMBConnection.groovy: 5: unable to resolve class jcifs.config.BaseConfiguration
# line 5, column 1.
import jcifs.config.BaseConfiguration
^
file:/var/lib/jenkins/jobs/test-pipeline/builds/4/libs/name-of-library/src/com/test/model/SMBConnection.groovy: 3: unable to resolve class jcifs.CIFSContext
# line 3, column 1.
import jcifs.CIFSContext
^
3 errors
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:958)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:554)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:254)
at groovy.lang.GroovyClassLoader.recompile(GroovyClassLoader.java:761)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:718)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:787)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell$TimingLoader.loadClass(CpsGroovyShell.java:158)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:677)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:545)
at org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:185)
Caused: BUG! exception in phase 'semantic analysis' in source unit 'WorkflowScript' The lookup for com.test.controller.factory.CustboxFacadeFactory caused a failed compilaton. There should not have been any compilation from this call.
at org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:190)
at org.codehaus.groovy.control.ClassNodeResolver.findClassNode(ClassNodeResolver.java:170)
at org.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:126)
at org.codehaus.groovy.control.ResolveVisitor.resolveToOuter(ResolveVisitor.java:676)
at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:313)
at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1245)
at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:176)
at org.codehaus.groovy.control.CompilationUnit$12.call(CompilationUnit.java:663)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:943)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:554)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:131)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:125)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:560)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:521)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:320)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE
I have tried adding those dependencies at the top of Jenkinsfile with grape notation.
#Grapes([
#Grab(group='commons-io', name='commons-io', version='2.6'),
#Grab(group='eu.agno3.jcifs', name='jcifs-ng', version='2.1.1'),
#Grab(group='org.slf4j', name='slf4j-api', version='1.8.0-beta4')
])
However, that helps nothing.
As the library I'm using contains hundurads of groovy files, I don't think adding grape notation at the beginning of each groovy file is a good idea.
I also tried convert the build.gradle to pom.xml and place it in the root of library repo. However, it helpe nothing either.
Is there anything I can try without rewriting the pipeline steps into gradle tasks and use sh('./gradlew task-name') in Jenkinsfile?

#TestMixin(HibernateTestMixin) Not working Grails 3

I am trying to do a gradle test and I get the following error:
Caused by: java.lang.NoClassDefFoundError: Unable to load class grails.test.mixin.hibernate.HibernateTestMixin due to missing dependency org/codehaus/groovy/grails/commons/spring/GrailsWebApplicationContext
It appears this is related to
#TestMixin(HibernateTestMixin)
Also added dependencies:
testCompile 'org.grails:grails-datastore-core:5.0.5.RELEASE'
testCompile 'org.grails:grails-datastore-test-support:5.0.5.RELEASE'
Try replacing this import grails.web.servlet.context.GrailsWebApplicationContext in place of
org/codehaus/groovy/grails/commons/spring/GrailsWebApplicationContext

Grails : How to migrate dependencies upgrading from 2.x.x to 3.0.8?

I am attempting to upgrade an existing Grails application from version 2.4.4 to 3.0.8. I have a couple issues that I am currently unable to resolve.
First issue: The old version's BuildConfig.groovy referenced a jar file that was in the lib directory. I tried copying the same configuration from BuildConfig.groovy to build.gradle and created a lib directory with the jar but Grails is unable to resolve the dependency.
Second issue: The old version had a plugin defined. I tried copying the same plugin definition from BuildConfig.groovy into build.gradle, but this isn't working. I noticed that the plugin isn't currently listed in Bintray, is this the problem?
Below is the dependency section of the build.gradle file.
dependencies {
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-dependencies"
compile "org.grails:grails-web-boot"
compile "org.grails.plugins:hibernate"
compile "org.grails.plugins:cache"
compile "org.hibernate:hibernate-ehcache"
compile "org.grails.plugins:scaffolding"
compile "com.stripe:stripe-java:1.32.1"
compile "com.google.code.gson:gson:2.3.1"
compile "javax.mail:mail:1.4"
runtime "org.grails.plugins:asset-pipeline"
testCompile "org.grails:grails-plugin-testing"
testCompile "org.grails.plugins:geb"
// Note: It is recommended to update to a more robust driver (Chrome, Firefox etc.)
testRuntime 'org.seleniumhq.selenium:selenium-htmlunit-driver:2.44.0'
console "org.grails:grails-console"
//jar file located in lib directory
runtime "com.easypost:easypost-java:2.1.2"
//grails plugin
compile ":shiro:1.2.1"
}
Thanks in advance for any guidance provided.
Issue 1: If that jar is a standard jar and you can reference it from maven then that would be good. But still if you need to include it from some local directory then you can do this:
repositories {
flatDir {
//Directory path containing Jar
dirs 'libs'
}
}
dependencies {
//Jar File Name - No need to add suffix .jar
compile name: 'someJarFile'
}
Issue 2: If the plugin is not listed in bintray then that means it has not been upgraded for Grails 3.x. Either you can upgrade it for yourself or remove the plugin if possible.

Trouble including external jar required for an import in a src/java/{somename}.java in a grails-app( grails2.0)

I need a DHTMLXCONNECTOR.jar (a connector executable jar) in my grails app to use with my application otherwise i get errors like :
error compiling in javac connot find symbol : import com.dhtmlx.connector
please help !I tried grails install-dependencies dhtmlxconnector .. Is it, that i need to edit the buildconfig file ? like something similar to uncommenting runtime for mysql ?
(grails 2.0.1)
Add your dependency to the dependencies section of BuildConfig.groovy.
For example to add the dependency with
groupId: org.jsoup
artifactId: jsoup
version: 1.6.1
dependencies {
compile 'org.jsoup:jsoup:1.6.1'
}

Resources