How to resolve JVM compatibility issues in Talend commandline - java

Hi everyone I'm executing a job on Talend 6.3.1 on the commandline using this command :
executeJob job_name -i /etc/alternatives/jre_1.8.0_openjdk/bin/java -jc DEV
and I always get the following error.
Error Line: 8113 Detail Message: com.jcraft cannot be resolved to a
type
The job is using an SFTP component that calls the jsch-0.1.53.jar, the jar is present in the job but for some reason it doesn't seem to find it. The commandline log shows :
!MESSAGE 2019-10-14 17:40:29,926 INFO
org.talend.commons.exception.CommonExceptionHandler - Missing jars:
jsch-0.1.53.jar
We also checked if the problem was the jdk version we're using but no results so far.
The job works perfectly fine when executed on the studio or even when built then executed on the server just not on the commandline.

Is it possible for you to publish the job to Nexus Repository, and then retrieve the job on TAC from Nexus ? This way, the job is only compiled once in the studio, you won't have to use the commandline (as the job is already compiled). It is simpler than resolving libraries issues with the commandline.

Related

Reason and fix for "Error: Could not find or load main class Anne" on Scala Getting started tutorial

I'm just starting out with Scala and have been following its Getting Started instructions. The second part of the instruction involves pulling the hello-world template by running the sbt new scala/hello-world.g8 command.
My problem is that it keeps on giving me this error:
Error: Could not find or load main class Anne
Caused by: java.lang.ClassNotFoundException: Anne
I'd like to know the reason for this, as well as any possible fix I might use.
The following is my insight and attempts on fixing this problem.
Insight:
1. I might have a problem with java installation/scala/sbt installation that needs this class Anne since even with other sbt commands like sbt sbtVersion I get the same error
Attempts:
1. Change command to retrieve from full url:
sbt new https://github.com/scala/hello-world.g8
2.(Edit): Previously I thought the repository scala/hello-world.g8 did not exist and tried getting from other repositories with no luck and with the same error as above. However it was pointed out below that the repository actually exists in this url https://github.com/scala/hello-world.g8, thanks Dmytro Mitin.
I was looking into the incorrect account (sbt) instead of (scala)
(Edit): Day 2
3. Uninstall/Reinstall sbt -- still getting the error
4. Checked if java running properly by compiling sample code and running ( successful )
I was actually running the command in Visual Studio Code's bash terminal. I tried running it with cmd and everything's now working fine.

Running tests on travis using mysql

I've been trying for the last week or so to make integration tests work on travis for a school project. I've debugged a fair bit of the project but now I'm blocked and need external help.
To give a bit of context, so far, I've debugged the java project so that the tests can be launched from eclipse or from maven in command line. I've worked on the travis file so that a database is created, the database scripts run and the java tests launch. However, the tests fail on travis because of a "table missing" in the database.
This is a link to our repo.
This is the travis.yml file's code:
language : java
jdk:
- oraclejdk8
service:
- mysql
before_script:
- mysql -e 'DROP DATABASE IF EXISTS koalatest'
- mysql -e 'CREATE DATABASE IF NOT EXISTS koalatest;'
- mysql -u root --default-character-set=utf8 koalatest < backend/koalacal-backend/koalacal.sql
script: cd backend && cd koalacal-backend && mvn test -X
after_success:
- bash <(curl -s https://codecov.io/bash)
The java project that is being built and run by maven is located under rootfolder -> backend -> koalacal-backend.
Here is a link to the error log maven produces on travis.
This line seems to be the source of the error:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'koalatest.Calendar' doesn't exist
I have two hypothesis:
1- The sql script that creates all the tables is not being run properly by travis.
To test this hypothesis, I changed the name of the script called by travis. As expected, I got an error saying that travis can't find the file. So at least, I know that this line of code causes travis to look up at an sql file.
- mysql -u root --default-character-set=utf8 koalatest < backend/koalacal-backend/koalacal.sql
That being said, I have no idea if the file is run properly on the database.
For the sake of putting all relevant informations in this post, here is a link to the database script.
2- The tests can't connect properly to the database.
Here is the config file that contain the info regarding which database to connect to:
TestInstance=true
user=root
password=
serverName=localhost
databaseName=koalacal
portNumber=3306
testUser=root
testPassword=
testServerName=127.0.0.1
testDatabaseName=koalatest
testPortNumber=3306</code>
If the parameter TestInstance is set to true, the tests take the informations testUser, testPassword, testServerName, testDatabaseName and testPortNumber to connect to the relevant database.
I believe the connection informations currently contained in the config file match how the travis documentation says we need to connect to a mysql database. I tried to change the testUser to something invalid (like root3) and got error messages as expected.
Maybe somehow the tests can't connect to the database and don't produce a related error message, but I doubt it.
Can someone look at my problem and see if I've missed something obvious (or not)? I don't know what else to try and I don't want to be blocked one more week on a technical issue.
For anyone who may google travis mysql and has a similar error to the one I had, I solved my problem.
The error was caused by a case sensitivity issue. The java code tried to connect to tables like 'Calendar' and 'Event' while the sql script created the tables 'calendar' and 'event'.
It took a long time to troubleshoot this because the case sensitivity didn't pose any problem on my machine. Maven can run its tests properly without any issue. It's only on the travis servers that case sensitivity of the tables started to matter.

gradle process command java finished with non-zero exit value 1

I am getting the following error when I type gradle bootRun --stacktrace --debug in the CentOS 7 terminal to use gradle to launch this sample spring boot app.
Caused by: org.gradle.process.internal.ExecException:
Process 'command '/opt/jdk1.8.0_45/bin/java'' finished with
non-zero exit value 1
I have googled this error and read other SO postings that are similar but not duplicates. For example, this is in eclipse in CentOS 7 and a web app. This is not an android app, etc. Also, commands given in other postings have not resolved this problem.
All of the code required to reproduce this problem is in the github link above, and all of the logs to diagnose the problem is in this OP below. How do I resolve this error so that I gradle bootRun can succussfully launch the sample app?
STEP BY STEP REPRODUCTION OF THE PROBLEM:
I downloaded the app as-is by navigating to /home/user/workspaces/ and typing git clone https://github.com/jrodenbostel/beyond-the-examples
I then navigated to cd /home/user/workspaces/beyond-the-examples/part-5 and typed gradle bootRun --stacktrace --debug, which resulted in the stack trace and logs that you can read by clicking on this link to a file sharing site. (The logs are too long to include in this OP.)
This was my original error message:
Changing my %JAVA_HOME% in Window's Environmental Variables from Java 9 (file directory C:\Program Files\Java\jdk-9.0.1) to Java 8 (C:\Program Files\Java\jdk1.8.0_151) was what fixed it for me. You can figure out what path you set %JAVA_HOME% to by typing echo %JAVA_HOME% in Command Prompt.
So yea, as of 12-20-2017, gradle bootRun doesn't play well with Java 9. Hopefully that will be fixed soon and I can delete this answer.
Looking at the logs this appears to be your problem:
nested exception is org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [inser t into users (username, password, enabled) values (?,?,?)]; Data truncation:
Data too long for column 'password' at row 1; nested exception is com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'password' at row 1.
Anyway you can truncate the password size? Otherwise increasing the 'password' column size should do the trick.
In My case, I was getting this error when I was trying to launch my spring boot application. The reason for the error was the port 8080 (default port for running my app in my case) was already being used by another application (mySql) on my machine.
I killed that other application and retried to launch my app, and it worked!
Just wanted to add my experience with this error. I used the Grails Application Forge and included the full package in the name when generating my Grails 5.1.2 application. When I ran it, I got the "...java'' finished with
non-zero exit value 1" error. I went back and generated the application with only the application name, removing the package, and it worked. Also, this was only a problem on Windows 10 in a command prompt. Both versions of my application worked in a Cygwin command prompt.

Building single Maven modules is not implemented for Maven 3, yet

I am getting this error while running selenium script in jenkins:
Building in workspace /home/jenkins_home/jobs/fe-integration-test/workspace
$ /usr/local/jdk1.6.0_34/bin/java -cp /home/jenkins_home/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.2.jar:/usr/local/apache-maven-3.0.4/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /usr/local/apache-maven-3.0.4 /opt/wikiandsonartomcat/apache-tomcat-7.0.30/webapps/jenkins/WEB-INF/lib/remoting-2.16.jar /home/jenkins_home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.2.jar 42127
<===[JENKINS REMOTING CAPACITY]===>channel started
Building single Maven modules is not implemented for Maven 3, yet!
Finished: ABORTED'
My server is CENT OS.
Can any one tell me how to get out of this error.
Today I got around this error by simply restarting Jenkins service (windows 7).
The root cause comes from Jenkins maven-plugin, so it should be fixed there first.
As of 2014-03-12 the code seems to have been improved.

Grails - Problem uninstalling Tomcat - Unable to delete catalina-ant.jar

I am working on a grails app and need to remove Tomcat plugin in order to be able to host on Google App Engine (Also to use Jetty for another project)
As instructed on Grails app engine documentation, I need to remove Tomcat as GAE apps only runs on their server.
However, I keep on getting this error (The error message is much longer, only post the first few lines):
: Unable to delete file C:\Users\Rama\.grails\1.3.7\projects\ccubemanager\plugins\tomcat-1.3.7\lib\catalina-ant.jar
at org.apache.tools.ant.taskdefs.Delete.handle(Delete.java:624)
at org.apache.tools.ant.taskdefs.Delete.removeDir(Delete.java:683)
at org.apache.tools.ant.taskdefs.Delete.removeDir(Delete.java:679)
at org.apache.tools.ant.taskdefs.Delete.execute(Delete.java:543)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
I am wondering if deleting the catalina-ant.jar manually would be a wise choice.
I tried to manually delete the whole /plugin directory anyway following this and it caused more mess that I cannot run any command on the app:
groovy.lang.MissingMethodException: No signature of method: java.math.BigInteger.call() is applicable for argument types: (java.lang.String) values: [target/classes]
Possible solutions: wait(), abs(), abs(), any(), wait(long), add(java.math.BigInteger)
at BuildConfig.run(BuildConfig.groovy:1)
at grails.util.BuildSettings.loadConfig(BuildSettings.groovy:653)
at grails.util.BuildSettings$loadConfig.callCurrent(Unknown Source)
at grails.util.BuildSettings.loadConfig(BuildSettings.groovy:630)
WARNING: There was an error loading the BuildConfig: No signature of method: java.math.BigInteger.call() is applicable for argument types: (java.lang.String) values: [target/classes]
Possible solutions: wait(), abs(), abs(), any(), wait(long), add(java.math.BigInteger)
I also try to start an entirely new project and uninstall tomcat, surprisingly it does not work either?
I am using Grails 1.3.7; STS 2.6.0; Windows 7
Could anyone please help, thanks alot!!
You should be able to uninstall tomcat by running the following command from the root of the project grails uninstall-plugin tomcat.
This will fail if another process has locked any of the files that the command needs to delete - this could be what is preventing catalina-ant.jar from being deleted. There are various tools available for windows that will tell you which process has a lock on a file. I've used unlocker in the past.

Categories