While using the AWS Toolkit for Eclipse, an error has been encountered when attempting to upload a Lambda function; the error is that that JAR creation failed. It is a simple "Hello World" application that was created to ensure that the environment is working; it follows the AWS tutorial: https://docs.amazonaws.cn/toolkit-for-eclipse/v1/user-guide/lambda-tutorial.html
The "Maven Build..." works fine to create the JAR without any error; following the steps in https://docs.amazonaws.cn/en_us/lambda/latest/dg/java-create-jar-pkg-maven-and-eclipse.html.
Eclipse is being run on a Mac and the JRE is Amazon Corretto 11 (11.0.4).
Any suggestions?
Here are the details of the errors:
Failed to upload project to Lambda
m.amazonaws.eclipse.core.exceptions.AwsActionException
at com.amazonaws.eclipse.lambda.upload.wizard.UploadFunctionWizard.doFinish(UploadFunctionWizard.java:115)
at com.amazonaws.eclipse.core.plugin.AbstractAwsJobWizard$1.run(AbstractAwsJobWizard.java:35)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.lang.NullPointerException
at com.amazonaws.eclipse.lambda.upload.wizard.util.UploadFunctionUtil.performFunctionUpload(UploadFunctionUtil.java:82)
at com.amazonaws.eclipse.lambda.upload.wizard.UploadFunctionWizard.doFinish(UploadFunctionWizard.java:111)
Unable to export project [testproject] to jar file
java.lang.reflect.InvocationTargetException: JAR creation failed. See details for additional information.
at org.eclipse.jdt.internal.ui.jarpackager.JarFileExportOperation.singleRun(JarFileExportOperation.java:1006)
at org.eclipse.jdt.internal.ui.jarpackager.JarFileExportOperation.execute(JarFileExportOperation.java:996)
at org.eclipse.ui.actions.WorkspaceModifyOperation.lambda$0(WorkspaceModifyOperation.java:110)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2295)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2322)
at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:131)
at com.amazonaws.eclipse.lambda.upload.wizard.util.FunctionJarExportHelper.exportProjectToJarFile(FunctionJarExportHelper.java:78)
at com.amazonaws.eclipse.lambda.upload.wizard.util.UploadFunctionUtil.performFunctionUpload(UploadFunctionUtil.java:68)
at com.amazonaws.eclipse.lambda.upload.wizard.UploadFunctionWizard.doFinish(UploadFunctionWizard.java:111)
at com.amazonaws.eclipse.core.plugin.AbstractAwsJobWizard$1.run(AbstractAwsJobWizard.java:35)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Related
I finally reached the point where my Elastic Beanstalk Instance / Environment got launched. (Java Corretto 11 Platform) Now it fails starting up the provided .jar file.
In the eb-engine.log file, I am not able to find any more error than this:
2021/05/27 11:36:25.889735 [INFO] Executing instruction: StageJavaApplication
2021/05/27 11:36:25.889871 [ERROR] An error occurred during execution of command [app-deploy] - [StageJavaApplication]. Stop running the command. Error: staging java app failed due to invalid zip file
The jar file is a Spring Boot application built with mvn -B package.
Locally the whole thing starts, but crashes afterwards because of not given environment variables (Expected behaviour).
But it seems AWS is not even starting the application..
Any suggestions on this?
Spring Boot apps run nicely on Elastic Beanstalk. However, you do need to set some variables. For example, have you set server-port variable to 5000?
And as you stated, to successfully use a Service Client, you can set environment variables for your creds. Here is an end to end walkthrough that shows how to successfully put a Spring BOOT app that invokes several AWS Services on Elastic Beanstalk.
Creating your first AWS Java web application
PS - your log file mentions a ZIP file. Be sure to create the JAR properly as discussed in the above example.
Just in case someone arrive here looking for an answer about this guy:
Error: staging java app failed due to invalid zip file
I was renaming my service jar in Gradle, using:
tasks.withType<org.springframework.boot.gradle.tasks.bundling.BootJar> {
archiveFileName.set("service.jar")
launchScript()
}
And ElasticBeanstalk was not happy about the renaming.
When I let it have the default name, then no zip issues and all worked like a charm.
Trying to deploy/run a springbok application (jar) on Azure App Service, but seeing an "Application Error".
Application
We built the application using Springboot and wanted to deploy the prebuilt jar file (from /target" folder.
Azure Setup
Created a new App Service using Java 11
Under "Deployment Center" linked with the Github repository that holds the code and jar file under /target
Under App service > Configuration > General Settings > Startup Command
java -jar /target/lead-processing-0.0.1-SNAPSHOT.jar
Logs
2021-05-05T22:25:23.730536337Z STARTUP_FILE=
2021-05-05T22:25:23.737427449Z STARTUP_COMMAND=java -jar /target/lead-processing-0.0.1-SNAPSHOT.jar
2021-05-05T22:25:23.738113651Z No STARTUP_FILE available.
2021-05-05T22:25:23.738719652Z Running STARTUP_COMMAND: java -jar /target/lead-processing-0.0.1-SNAPSHOT.jar
2021-05-05T22:25:24.003600232Z Finished running startup command 'java -jar /target/lead-processing-0.0.1-SNAPSHOT.jar'. Exiting with exit code 1.
2021-05-05T22:25:24.004755134Z Error: Unable to access jarfile /target/lead-processing-0.0.1-SNAPSHOT.jar
Are we missing anything?
The problem that app service cant find your jar file.
Unable to access jarfile /target/lead-processing-0.0.1-SNAPSHOT.jar
I think when you deployed from target then you jar is possible in root. Go to App Service Editor inside of your app and check location for your jar
Removing the "/" right before the target works for me
I am getting the below error when using AWS lambda with Java.
I have created a Dukascopy SDK backed java service which has been deployed in AWS lambda but getting the below error:
020-03-17 03:33:49.421 INFO FilePathManager - WL info is unavailable. Use default App folder for Platform data: /home/sbx_user1051/JForex
java.lang.RuntimeException: java.io.IOException: Unable to create file [/temp/.cache/version.txt.lck], No such file or directory
at com.dukascopy.charts.data.datacache.LocalCacheManager.<init>(LocalCacheManager.java:141)
Please help me understand the issue.
There is no such folder as /temp. For lambda it should be /tmp.
Updated to reflect Sonar-Runner
We have these projects configured:
We're using this sonar-project.properties file in the root of the folder containing our application source:
sonar.projectKey=Southern
sonar.projectName=Southern
sonar.projectVersion=1.0
sonar.sources=.
We run the sonar-runner command in the same folder in which the above properties file exists. We get the following error:
ERROR: Error during SonarQube Scanner execution
ERROR: Unable to load component class org.sonar.batch.report.ActiveRulesPublishe
r
ERROR: Caused by: Unable to load component interface org.sonar.api.batch.rule.Ac
tiveRules
ERROR: Caused by: Unable to load component class org.sonar.batch.rule.ModuleQPro
files
ERROR: Caused by: Error 500 on http://localhost:9000/api/qualityprofiles/search.
protobuf?projectKey=Southern
ERROR:
The SonarQube application and website are running and available.
Downloaded the sonar-runner.
Updated properties file: sonar-sources=src. Scans ran but hung with an error that the DB was locked.
Rebooted the machine and restarted SonarQube. Problem resolved. All scans run.
I want to build my projects on a Windows machine, so I created a slave there. First we tried the standard java application runner, but our build sets up its own environment and it always ended up deleting the existing Java installation, not giving any proper error messages, but failing. Then I switched to using Cygwin sshd and have Jenkins log in via ssh. This works for the connection (just as the standard method worked), but when I ran the build then it failed again to install the jdk. I ended up running the following command by hand:
C:\jenkins\tools\hudson.model.JDK\Latest\jdk.exe ADDLOCAL="ToolsFeature" REBOOT=ReallySuppress INSTALLDIR=C:\jenkins\tools\hudson.model.JDK\Latest /L
This is the same as Jenkins would run, but without the /s (silent) option. Now when I run the build, I get the following error:
Building remotely on jenkins-slave-win64 (Johnny5) (windows) in workspace C:\jenkins\workspace\continuous.xill
java.io.IOException: remote file operation failed: C:\jenkins\tools\hudson.model.JDK\Latest at hudson.remoting.Channel#200354fa:jenkins-slave-win64 (Johnny5): java.nio.file.AccessDeniedException: C:\jenkins\tools\hudson.model.JDK\Latest\bin\java.exe
at hudson.FilePath.act(FilePath.java:987)
at hudson.FilePath.act(FilePath.java:969)
at hudson.FilePath.deleteRecursive(FilePath.java:1171)
at hudson.tools.JDKInstaller.performInstallation(JDKInstaller.java:130)
at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:68)
at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:108)
at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
at hudson.model.JDK.forNode(JDK.java:132)
at hudson.model.AbstractProject.getEnvironment(AbstractProject.java:360)
at hudson.model.Run.getEnvironment(Run.java:2234)
at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:935)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1036)
at hudson.scm.SCM.checkout(SCM.java:485)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1277)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532)
at hudson.model.Run.execute(Run.java:1741)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:381)
Caused by: java.nio.file.AccessDeniedException: C:\jenkins\tools\hudson.model.JDK\Latest\bin\java.exe
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269)
at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
at java.nio.file.Files.delete(Files.java:1126)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at hudson.Util.deleteFile(Util.java:247)
Of course I tried everything:
Run sshd as a different (Administrator) user
Checked every error mentioned here:
https://wiki.jenkins-ci.org/display/JENKINS/SSH+slaves+and+Cygwin
here
https://wiki.jenkins-ci.org/display/JENKINS/My+software+builds+on+my+computer+but+not+on+Jenkins
and here
http://www.noah.org/ssh/cygwin-sshd.html
And nothing works. Do you have a hint where to look?
UPDATE:
Meanwhile I managed to get a bit further in the build process by deactivating the option to "Automatically install jdk" in the Jenkins settings, git clone works and gradle starts up. However, now the JAVA_HOME environment variable somehow is not accessible to the slave (although we even tried setting it in .bashrc, just to be sure). So the build fails with this message":
FAILURE: Build failed with an exception.
* Where:
Script 'http://dl.bintray.com/content/shemnon/javafx-gradle/8.1.1/javafx.plugin' line: 60
* What went wrong:
A problem occurred evaluating script.
> Could not find JavaFX Packager Tools, please set one of [jfxrtDir in Gradle Properties, JFXRT_HOME in System Environment, JAVA_HOME in System Environment, java.home in JVM properties]
For your build error after "UPDATE" I think you have to add a JDK under Manage Jenkins > Configure System > JDK or in newer versions under Manage Jenkins > Global Tool Configuration > JDK