Talend tRest component causing compilation problems - talend

I'm trying to call a simple REST API in Talend. I've tried the tRestClient component but ran into problems (see here). Now i'm trying to use the tRest component but get a different error.
Talend error
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
com.sun.jersey cannot be resolved to a type
com.sun.jersey cannot be resolved to a type
com.sun.jersey.client cannot be resolved to a variable
com.sun.jersey cannot be resolved to a type
com.sun.jersey cannot be resolved to a type
com.sun.jersey.api.client.Client cannot be resolved to a type
com.sun.jersey cannot be resolved to a type
com.sun.jersey cannot be resolved to a type
com.sun.jersey cannot be resolved to a type
com.sun.jersey cannot be resolved to a type
My Talend job is just a tRest into a tLogRow. The tRest component is configured with the API call URL, HTTP Method GET, and i've added HTTP Headers "Accept" "application/*****.1.0+json" which are the values specified by the API. I can call the API on my PC from other software and i get a success response.
I've installed the latest jar file from here and have tried using a tLibraryLoad to load this jar before the tRest client but get the same error.
Any ideas?

I believe you're not using the right version of the jersey core library; Here's what the tREST looks like when you use it for the first time :
It will prompt you to install missing jars (not distributed by Talend), which are :
jersey-client-1.4.jar
jersey-core-1.4.jar
At which point you can just click "Download and install all modules available" and it will install them for you.
You don't need to use tLibraryLoad component, just delete all versions of these jars that might be present in the following locations, restart your studio, and you should get the prompt to install them again (as in the above screenshot) :
<Talend root folder>\configuration\.m2\repository\org\talend\libraries
<Talend root folder>\lib\java

Issue was solved by overwriting both jersey-client-1.4-6.0.0.jar and jersey-client-1.4-6.0.0.jar iwth the version from a colleague's PC.

Related

Artifactory & Groovy plugin - how to get a list of all repositories within Artifactory

I'm writing an Artifactory plugin using Groovy.
I need it to get a list of all the repositories within the Artifactory.
In the lib folder of the plugin I added the jar of:
artifactory-java-client-services-2.3.2.jar
And the Intellij knows to complete the methods of the artifactory objects:printscreen of the intellij
I was trying to write this in the groovy file:
import org.jfrog.artifactory.*
import org.jfrog.artifactory.client.*
....
....
def baseurl = <URL to the artifactory>
ArtifactoryClient artifactoryClient = new ArtifactoryClient();
def artifactory = artifactoryClient.create(baseurl, <the user name>, <the password>)
def allRepositories = artifactory.getRepositories()
But as I add the imports to the file, the console of the Artifactory is showing the following error:
2017-05-04 09:42:04,468 [art-groovy-plugins-reloader] [ERROR] (o.a.a.p.GroovyRunnerImpl:302) - Error loading script from '..\etc\plugins\test.groovy'.
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during class generation: java.lang.NoClassDefFoundError: Unable to load class org.jfrog.artifactory.client.ArtifactoryClient due to missing dependency org/jfrog/artifactory/client/Artifactory
java.lang.RuntimeException: java.lang.NoClassDefFoundError: Unable to load class org.jfrog.artifactory.client.ArtifactoryClient due to missing dependency org/jfrog/artifactory/client/Artifactory
at org.codehaus.groovy.control.CompilationUnit.convertUncaughtExceptionToCompilationError(CompilationUnit.java:1091)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1069)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.util.GroovyScriptEngine$ScriptClassLoader.doParseClass(GroovyScriptEngine.java:274)
at groovy.util.GroovyScriptEngine$ScriptClassLoader.parseClass(GroovyScriptEngine.java:243)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:254)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:212)
at groovy.util.GroovyScriptEngine.loadScriptByName(GroovyScriptEngine.java:555)
at org.artifactory.addon.plugin.GroovyRunnerImpl.loadScript(GroovyRunnerImpl.java:277)
at org.artifactory.addon.plugin.GroovyRunnerImpl.getScripts(GroovyRunnerImpl.java:257)
at org.artifactory.addon.plugin.GroovyRunnerImpl.reloadScripts(GroovyRunnerImpl.java:137)
at org.artifactory.addon.plugin.GroovyRunnerImpl$ScriptsReloader.run(GroovyRunnerImpl.java:451)
Caused by: java.lang.NoClassDefFoundError: Unable to load class org.jfrog.artifactory.client.ArtifactoryClient due to missing dependency org/jfrog/artifactory/client/Artifactory
at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:391)
Any idea what is going wrong here and how to fix it?
It looks like you are trying to develop an Artifactory user plugin and use the Artifactory client inside this plugin. While this is doable, it might not be the best approach.
User plugin should use the Artifactory public API (PAPI) for communicating with Artifactory.
For your use case you should be using the methods available in the Repositories class for getting the list of available repositories.
The Artifactory client is actually using the Artifactory REST API behind the scenes, which is doable from a user plugin but slower than calling the PAPI directly. In addition the client requires to specify your Artifactory URL, which is an additional concern you will need to care about when writing the plugin.
If you do want to use the client in a user plugin, you should place the relevant .jar files (client and dependencies) in the plugins lib directory.

Drools HelloWorld sample application gives error

When I first set up the sample hello world application I get errors in the rules/sample.drl files
The error is as follows:
Rule Compilation error Only a type can be imported. com.sample.DroolsTest.Message resolves to a package
Only a type can be imported. org.drools.core.spi.KnowledgeHelper resolves to a package
KnowledgeHelper cannot be resolved to a type
com.sample.DroolsTest.Message cannot be resolved to a type
org.kie.api.runtime.rule.FactHandle cannot be resolved to a type
org.kie.api.runtime.rule.FactHandle cannot be resolved to a type
java.lang.Exception cannot be resolved to a type
org.kie.api.runtime.rule.RuleContext cannot be resolved to a type
Message.GOODBYE cannot be resolved to a type
org.drools.core.util.bitmask.AllSetBitMask cannot be resolved to a type
com.sample.DroolsTest.Message cannot be resolved to a type
Also I fixed the error when I write dialect "mvel"
but for some reason I am not okay with this quick fix.
Am I missing some plugin or dependencies?
I am a newbie to drools rule engine and I followed all steps correctly.
Yes the most possible explanation is that you have missed some depedencies.
You need to include drools-core for example:
Only a type can be imported. org.drools.core.spi.KnowledgeHelper resolves to a package
suggests that Rules does not have access to KnowledgeHelper and tries to import it as a package.
Same thing happens with:
org.kie.api.runtime.rule.RuleContext
and kie-api depedency.
If you use Eclipse or some other IDE and started a new drools project then maybe drools library is not in build path.

Can't use akka in IDEA plugin development

When I develop an IDEA plugin, I want to use akka, but have some problems.
I created a demo project here: https://github.com/freewind/idea-plugin-akka-demo
You can just clone it and reproduce the problem on your computer. (Notice the Setup section)
And I copy the problem here:
Problems
1. Can't use default akka configuration
If I removed:
src/main/resources/application.conf
src/main/scala/freewind/MyAkkaConfig
and run this plugin, it will report this error when starting:
com.intellij.ide.plugins.PluginManager$StartupAbortedException:
com.intellij.diagnostic.PluginException: No configuration setting found for key 'akka'
[Plugin: com.yourcompany.unique.plugin.id]
2. Can't load the configuration from file
Then I copied the reference.conf from akka jar, to src/main/resources/application.conf, but it still report the same error. Seems akka in IDEA plugin can't find this file automatically.
3. ClassNotFoundException: akka.actor.LightArrayRevolverScheduler
So I have to use MyAkkaConfig.scala to hardcode the configuration in scala code, but this time, it reports another error:
com.intellij.ide.plugins.PluginManager$StartupAbortedException:
com.intellij.diagnostic.PluginException: ClassNotFoundException: akka.actor.LightArrayRevolverScheduler
[Plugin: com.yourcompany.unique.plugin.id]
The akka.actor.LightArrayRevolverScheduler is used in MyAkkaConfig.scala, and is included in akka-actor_2.11:2.3.12:jar. But why IDEA can't load it?
For the 3rd problem, it can be fixed by passing the classloader:
val system = ActorSystem("my-actor", MyAkkaConfig.config, this.getClass.getClassLoader)
But we also can remove the MyAkkaConfig.config, to use the file application.conf under resources

Casbah missing reference error for "MongoCursor" using Eclipse

I've been getting this error whenever I'm using Scala libraries for MongoDB.
bad symbolic reference. A signature in Implicits.class refers to type MongoCursor in
package com.mongodb which is not available. It may be completely missing from the
current classpath, or the version on the classpath might be incompatible with the
version used when compiling Implicits.class.
I get the error in response to the line:
val client = MongoClient("localhost", 27017)
I've tried different versions of the various jar files, but it hasn't fixed it. I've been using only the most up-to-date versions, so I don't know what the problem is. It won't give me a line reference, and I can't find a reference to a "MongoCursor" type in the Implicits.class source. I get the feeling that I'm missing another library, but I don't know what it would be.
I'm using:
joda-time-2.3.jar
mongo-java-driver-2.11.4.jar
casbah_2.10-2.7.0-SNAPSHOT.jar
casbah-commons_2.10-2.7.0-SNAPSHOT.jar
casbah-core_2.10-2.7.0-SNAPSHOT.jar
casbah-gridfs_2.10-2.7.0-SNAPSHOT.jar
casbah-query_2.10-2.7.0-SNAPSHOT.jar
You will need to update the Java driver as the 2.7.0-SNAPSHOT relies on the mongo-java-driver 2.12.0-SNAPSHOT - then it should be able to find MongoCursor correctly.

import lift mapper caught an error missing jar file

hi im creating a lift scala application
this is my problem
when i import net.liftweb.mapper._ package the compiler gives me error...
i tried to add lift-mapper_2.9.1-2.4-M4.jar jar file to build path ,but the error exists..!
the compiler shows..
bad symbolic reference. A signature in package.class refers to term db in package net.liftweb which is not available. It may be completely missing from
the current classpath, or the version on the classpath might be incompatible with the version used when compiling package.class.
Try to add the mapper via SBT or maven configuration?
Anyway, Scala-2.9.1 and Lift 2.4-M4 are very-very out of date. Better use something like that for a good start: https://github.com/lift/lift_25_sbt/
It works out of the box, and you'll only have to add 1 line to add the mapper support for it. (After that, all dependencies would be downloaded and added to the project automatically, by SBT.)