play application startup isses with VM variable -Dprecopiled=true? - java

I'm using play1-1.3.0. In production mode, I'm starting up my application, by using this command play start MyApp -Dprecompiled=true i got this error message in logs.
play:424 - Precompiled classes are missing!!
I exactly don't know why I'm getting this error message.

You need to of ran play precompile first this will compile classes ready to use

Related

Elastic Beanstalk fails creating

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.

Application crashes whenever instantiating (empty) constructor

I'm creating an Android extension intended to connect to a remote SSH host based on the well known JSch library, so that once the button is pressed, the class is instantiated this way, with no compilation error:
JSch jsch = new JSch();
...but, application crashes!
Looking at the JSch() constructor, there is nothing inside:
public JSch(){
// here there are several commented instructions that need to be
// used just at MAC operational systems (not my OS).
}
If I remove initiation, compiler complains that variable jsch is not initalized.
JSch jsch;
Once I'm compiling with Apache Ant, there is no debug resources that I could use to trace the runtime error.
All tests are being made either within threads or callback methods, giving the same result; I simply cannot initiate the jsch variable, this yields a runtime exception com.jcraft.jsch.JSch.
Does someone has some insights on how to solve that issue ?
I was able to install the Android SDK-tools and after capturing the Log via line command ADB logcat > file.txt, there were the following sentence many times:
java.lang.NoClassDefFoundError: com.jcraft.jsch.JSch
Which means that the extension file (.aix) compiled with apache command ant extensions did not embed the above class within it.
This explains the issue at all (application crashing instantiating above constructor - absent), and the next step is to discover how to encapsulate dependencies - surely in another thread, if I will not be able to do on my own.

Error when push Liberty for Java application in IBM Bluemix

when I run sample IBM Bluemix Liberty for Java application https://github.com/ibmjstart/bluemix-java-postgresql-uploader.git following error:
-----> Downloaded app package (1.9M)
-----> Downloaded app buildpack cache (4.0K)
OK
/var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:101:in build_pack': Unable to detect a supported application type (RuntimeError) from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:74:inblock in compile_with_timeout'
from /usr/lib/ruby/1.9.1/timeout.rb:68:in timeout' from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:73:incompile_with_timeout'
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:54:in block in stage_application' from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:50:inchdir'
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:50:in stage_application' from /var/vcap/packages/dea_next/buildpacks/bin/run:10:in'
FAILED
Server error, status code: 400, error code: 170001, message: Staging error: cannot get instances since staging failed
TIP: use 'cf logs jpu-henryhan --recent' for more information
The top error looks like you left off the -p <path_to_war> parameter when doing a push. If you just push a directory containing a WAR file, it will not be detected by the Java buildpack.
The tip provided in the output of your cf push request is relevant.
TIP: use 'cf logs jpu-henryhan --recent' for more information
Running that command will tail the log files produced during the staging process and let you see what error may have been raised. Often, it can be a missing dependency or a transient failure of some sort.
I just successfully deployed the sample using the "deploy to Bluemix" button and manually via the cf command line tool. Unless you changed the code, it is most likely that this error is a transient failure.
Run following command:
$ cf push jpu- -b https://github.com/cloudfoundry/java-buildpack --no-manifest --no-start -p PostgreSQLUpload.war
add the parameter to set the buildpack "-b https://github.com/cloudfoundry/java-buildpack"

ClassFormatError: 154>, Exception caught in Display class

I am running a midlet application already deployed & run on Nokia S60 sdk. I want to make my app run on every java & symbian device. I tried to run the application on Java_ME_platform_SDK_3.4 but getting an error in the code when i am trying to switch the screen from Login to Home
HomeForm homeForm=new HomeForm(objLoginMidlet, objCommonBean);
Display.getDisplay(objLoginMidlet).setCurrent(homeForm);
Code in Home Form is as follows-
class HomeForm extends Form
{
public HomeForm(LoginMidlet objLoginMidlet,CommonBean objCommonBean)
{
this.objLoginMidlet=objLoginMidlet;
this.objCommonBean=objCommonBean;
setTimer();
initHomeForm();
}
}
My MIDP is set to 2.1. Even I changed it to 2.0 but still getting exception as follows
warning**
*Untrusted user classes must never be put
***on the system class path
TRACE: <at java.lang.Error: ClassFormatError: 154>, Exception caught in Display class
java.lang.Error: ClassFormatError: 154
- java.lang.Class.invoke_verify(), bci=0
- java.lang.Class.initialize(), bci=100
- ezypoint.forms.LoginForm.register(LoginForm.java:202)
- ezypoint.forms.LoginForm.commandAction(LoginForm.java:91)
Even I tried to change compilance level but still exception appears.
I don't know the Nokia S60, but this usually happens on CLDC devices when compiled Java class files are being deployed without having them "preverified". This is an additional build step that is required to run them on embedded JavaME devices. See this StackOverflow question.
If you hava a full-blown development environment, this is usually set up automatically (maybe you need to choos the correect target device). However, if you try to compile the Java files by yourself and then run them on your device, it will crash. In this case, you need to call %YOUR_WTK_HOME%\bin\preverify.exe with your class files (and probably add to your ANT script or similar):
%YOUR_WTK_HOME%\bin\preverify.exe -classpath <your-classpath> -d <your-destination-dir> <your-source-directory>

UnsatisfiedLinkError and NoClassDefFoundError : Running Java Mapscript on Ubuntu 11.10

We have coded and run a dynamic web application using MAPSERVER(Version 6.0.1) on windows platform using Java Technology. Now, there is need of deploying it on Ubuntu 11.10. We have installed Apache Tomcat 6.0, Mapserver 6.0.1, Apache 2.0, and FWTools-2.0.1(As this package contain all required tools for mapserver if I am not wrong, so I didn't feel any other tools to be installed). We have deployed the war file(and put application without) in Apache Tomcat 's Webapps folder. I even got the index page which dont have code related with mapscript api. But while fetching the other servlet with mapscript we are getting following error...
java.lang.UnsatisfiedLinkError: no mapscript in java.library.path
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1681)
java.lang.Runtime.loadLibrary0(Runtime.java:840)
java.lang.System.loadLibrary(System.java:1047)
edu.umn.gis.mapscript.mapscriptJNI.<clinit>(mapscriptJNI.java:23)
edu.umn.gis.mapscript.mapObj.<init>(mapObj.java:283)
Again while refreshing the browser page where the above error was displayed, I got a change,
java.lang.NoClassDefFoundError: Could not initialize class
edu.umn.gis.mapscript.mapscriptJNI
edu.umn.gis.mapscript.mapObj.<init>(mapObj.java:283)
I searched on net about the above problem. But finally blank. Please, provide idea about the above problem.
I'm not going to explain why you're getting the UnsatisfiedLinkError, but instead I'll explain why you are getting the NoClassDefFoundError when you reload the page.
A NoClassDefFoundError with a message Could not initialize class ... is thrown by the JVM when it attempts to initialize a class that it has already tried and failed to initialize.
The first of your two stacktraces contains the line
edu.umn.gis.mapscript.mapscriptJNI.<clinit>(mapscriptJNI.java:23)
The method name <clinit> denotes the static initializer, of the class mapscriptJNI. So, at the point that the UnsatisfiedLinkError was thrown, the JVM was trying to initialize this class. Looking at the error message, it seems that this static initializer tried to load the native code library mapscript but failed.
This UnsatisfiedLinkError causes the mapscriptJNI class to fail to initialize successfully. The JVM keeps a record of all classes that fail to initialize, and if you attempt to initialize one of those classes again, you'll get a NoClassDefFoundError with a message saying that it could not initialize that class.
When you refresh the page, you end up causing the JVM to attempt to initialize the class mapscriptJNI a second time. Of course, this class failed to initialize the previous time. Your second stacktrace contains exactly the error I've described.
In short, the UnsatisfiedLinkError is the real error here. Fix that and the other one will go away.
I would check the following 2 items:
Is the mapscript.jar file on Tomcat or at least your webapp's classpath? (NoClassDefFoundError is your big clue here)
Is the libmapscript.so on either your LD_LIBRARY_PATH or -Djava.library.path? (UnsatisfiedLinkError since the shared object cannot be found)
Try having a look at this post, near the Running Java Mapscript (on Linux) section.
Hope that helps!

Categories