While automating dataloader with ANT tool, datalaoder unable to login automatically - ant

While automating DataLoader using ANT, I updated process-conf.xml file using build.xml file. Now when I am running ANT command the DataLoader unable to login automatically. and finally it says Build Failed.
In build.xml file when I am using com.salesforce.dataloader.process.ProcessRunner class then getting the below error.
Error: Main method not found in class com.salesforce.dataloader.process.ProcessRunner, please define the main method as: [java] public static void main(String[] args) [java] or a JavaFX application class must extend javafx.application.Application [java] Java Result: 1
and when I am using com.salesforce.dataloader.process.DataLoaderRunner class then the DataLoader starts but not logging and not processing bean from process-conf.xml file.
Please guide with the solution.

Related

Run Stories in Parallel using Jbehave

I am trying to run BDD stories in Parallel using JBehave. Following the below guides. https://github.com/jbehave/jbehave-core/tree/master/examples/threads https://jbehave.org/reference/stable/multi-threading.html.
Getting below error. Any help appreciated.
Failed to execute goal org.jbehave:jbehave-maven-plugin:5.0:run-stories-as-embeddables (default-cli) on project jbehave-threads-example: Failed to run stories as embeddables: class org.jbehave.examples.threads.steps.ThreadsSteps cannot be cast to class org.jbehave.core.Embeddable (org.jbehave.examples.threads.steps.ThreadsSteps is in unnamed module of loader org.jbehave.core.embedder.EmbedderClassLoader #58b67519; org.jbehave.core.Embeddable is in unnamed module of loader org.codehaus.plexus.classworlds.realm.ClassRealm #5395ea39) -> [Help 1]

Grails 3.1.10 exclude spring-boot-starter-tomcat plugin from war generation

If I leave the "spring-boot-starter-tomcat" plugin dependency set to compile in the gradle build file I get the following error messages deploying to a standalone Tomcat 7 server:
INFO: validateJarFile(/usr/share/tomcat/webapps/ROOT/WEB-INF/lib/tomcat-embed-core-8.0.36.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Aug 18, 2016 2:51:19 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/usr/share/tomcat/webapps/ROOT/WEB-INF/lib/tomcat-embed-el-8.0.36.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
If I change the dependency to provided I can deploy to Tomcat but get the following error attempting to run or debug within IntelliJ IDEA 15:
ERROR org.springframework.boot.SpringApplication - Application startup failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [orderserver.Application]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
...
Caused by: java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
...
Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletContext
...
Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContext
How can I exclude these dependencies from the war file generation while retaining the ability to run/debug within IDEA?
Even better is there a way to generate a single war file that has embedded Tomcat for standalone execution that can also be deployed to a Tomcat container?
This issue was resolved by changing the dependency to provided and using a "Grails" run/debug configuration instead of the "Application" configuration that was set when I created the project with IDEA 15.

forked execution breaks includeTargets in Grails _Events.groovy plugin

seem to have more stupid issues with forked Execution in grails than anything else
using grails 2.4.4 on GGTS 3.6.3, groovy 2.3.7, 64bit
trying to repair another plugin (its out of date and i'm trying to fixit). had problems. pared all back to a simple plugin and demo project that includes the plugin from the local workspace
in DemoProject I do the local include of the plugin like this in buildConfig.groovy
grails.plugin.location.DummyPlugin = "../DummyPlugin"
so far so good. without adding an _Events.grooy and running the DemoProject all starts ok and plugin loads.
now add an _Events.groovy to the plugins /script folder. In that file I have this line right at top
import grails.util.BuildSettingsHolder as build
import groovy.xml.MarkupBuilder
includeTargets << grailsScript("_GrailsPackage")
now when you run the demo project you get an error like this
|Running Grails application
Error |
Error loading event script from file [E:\workspace\ggts3.6.2-workspace\DummyPlugin\scripts\_Events.groovy] No such property: classLoader for class: java.lang.Object (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
groovy.lang.MissingPropertyException: No such property: classLoader for class: java.lang.Object
at grails.util.BuildSettings$1.doCall(BuildSettings.groovy:409)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270)
at _Events.run(_Events.groovy:29)
at org.grails.plugins.tomcat.fork.ForkedTomcatServer.createEventListener(ForkedTomcatServer.groovy:147)
at org.grails.plugins.tomcat.fork.ForkedTomcatServer.createTomcatRunner(ForkedTomcatServer.groovy:104)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270)
at org.grails.plugins.tomcat.fork.ForkedTomcatServer.runInternal(ForkedTomcatServer.groovy:82)
at org.grails.plugins.tomcat.fork.ForkedTomcatServer.run(ForkedTomcatServer.groovy:66)
at org.grails.plugins.tomcat.fork.ForkedTomcatServer$run.call(Unknown Source)
at org.grails.plugins.tomcat.fork.ForkedTomcatServer.main(ForkedTomcatServer.groovy:60)
Error |
Error loading event script from file [E:\workspace\ggts3.6.2-workspace\DummyPlugin\scripts\_Events.groovy] No such property: classLoader for class: java.lang.Object
|Server running. Browse to http://localhost:8080/DemoDummyProject
if you got back to the DemoProject and stopped forked Execection by setting grails.project.fork =[] and run again it all works fine - no errors.
so essentially forked execution screws up the plugins includeTargets action.
how do you fix this whilst std forked config is now enabled as default - any clues? advice requested

Groovy classpath not set up properly by <groovy> Ant task

My Groovy script depends on some libraries. This is what I have at the top of my script.
#Grapes([
#Grab(group = 'net.sf.json-lib', module = 'json-lib', version = '2.3',
classifier = 'jdk15'),
#Grab(group = 'org.codehaus.groovy.modules.http-builder',
module = 'http-builder', version = '0.7.1'),
#Grab(group = 'commons-cli', module = 'commons-cli', version = '1.2')])
When I run the script from command line using groovy executable, everything works properly. The artefacts get downloaded and the script runs.
However, if I try to execute the same script from Apache Ant using <groovy src="myscript.groovy" fork="true" /> (simplified), the artefacts also get resolved and downloaded but then I get [groovy] Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException.
The Apache Ant installation uses groovy-all-2.3.6.jar that I have copied from the Groovy installation that I have installed, so they should be pretty much identical.
What am I missing? How can I make the <groovy> task work and use the downloaded jars?
UPDATE I
The issue I believe is that Grape and Ant use different classloaders so the artifacts aren't visible to Ant. Can you try adding this: #GrabConfig(systemClassLoader = true) to your groovy script after the #Grape annotations?
If I do that I get General error during conversion: No suitable ClassLoader found for grab.
UPDATE II
I have also tried this now:
import groovy.grape.Grape;
Grape.grab(group:"commons-cli", module:"commons-cli", version:"1.2", classLoader:this.class.classLoader.rootLoader)
//...
It does not help. I get compile time error then:
[groovy] Exception in thread "main" Script Failed: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
[groovy] C:\Users\xxx\AppData\Local\Temp\embedded_script_in_2825216891785993632groovy_Ant_task: 18: unable to resolve class groovyx.net.http.HTTPBuilder
[groovy] # line 18, column 1.
[groovy] import groovyx.net.http.HTTPBuilder
[groovy] ^
Get rid of the #Grab and use the static .grab() method Grape offers. It allows you to specify a the rootLoader classloader which Ant can see:
import groovy.grape.Grape;
Grape.grab(group:"commons-cli", module:"commons-cli", version:"1.2", classLoader:this.class.classLoader.rootLoader)
<repeat for rest of #Grab>

Ant System Class Loader does not honor $CLASSPATH, honors $LOCALCLASSPATH

I am implementing an ant task as a wrapper for another class, which loads other several classes using the system class loader. Now, the task is in the same jar of these other classes, so I wonder why it is not finding them, since the task is running
Please notice that my classes are in the $CLASSPATH env variable. The problem will not occur if I export LOCALCLASSPATH=$CLASSPATH
Minimal example:
<taskdef name="mytask" classname="my.package.MyTask" />
<target name="compile">
<mytask />
</target>
you can easily see the problem here
public class MyTask extends Task {
public void execute() throws BuildException {
try {
ClassLoader cl = ClassLoader.getSystemClassLoader();
// this will only print the ant jar file path
for(URL url: ((URLClassLoader)cl).getURLs()){
log(url.getFile());
}
cl.loadClass("my.package.OtherClass"); // throws an exception
} catch (Exception ex) {
throw new BuildException(ex);
}
}
}
The ant shell script reworks the classpath internally, so the SystemClassLoader contains only a minimal part of the "real" classpath
tl;dr: use
ClassLoader cl = Thread.currentThread().getContextClassLoader();
instead of
ClassLoader cl = ClassLoader.getSystemClassLoader();
From the Mailing List, Rainer Noack:
if you're launching ant via shell script, it is using
oata.launcher.Launcher.java
This class reorganises the classpath a bit. The env variable CLASSPATH
and the classpath commandline argument are stripped and replaced by
the minimum classpath used to launch ant. A child classloader of the
system classloader is created with the original CLASSPATH entries.
The oata.Project is then loaded with this classloader.
The problem is that the loader in ClassLoader.getSystemClassLoader() is actually untouched, the one that changes (i.e., the one that honors $CLASSPATH, -lib, etc.) can be retrieved using Thread.currentThread().getContextClassLoader().

Resources