We are trying to use Dynamic Class Data Sharing (Dynamic CDS) with our spring boot application.
Created the CDS archive using the following command
java -Xlog:cds -XX:DumpLoadedClassList=cds.jsa -jar app-0.0.1-SNAPSHOT.jar
And trying to use the archive using the following command
java -Xlog:cds -XX:SharedArchiveFile=cds.jsa -jar app-0.0.1-SNAPSHOT.jar
But getting the following error in the beginning of the application startup
[0.009s][info][cds] trying to map cds.jsa
[0.009s][info][cds] Opened archive cds.jsa.
[0.009s][info][cds] _magic expected: 0xf00baba2
[0.009s][info][cds] actual: 0x4f4e2023
[0.009s][info][cds] UseSharedSpaces: The shared archive file has a bad magic number.
[0.009s][info][cds] UseSharedSpaces: Unable to map shared spaces
openjdk version "17" 2021-09-14 (build 17+35-2724)
Springboot 2.6.3
The option --XX:DumpLoadedClassList=cds.jsa does not create a CDS archive - it is one step in creating a static CDS Archive File.
To create a Dynamic CDS Archive file you must use
java -Xlog:cds -XX:ArchiveClassesAtExit=cds.jsa -jar app-0.0.1-SNAPSHOT.jar
Source: https://docs.oracle.com/en/java/javase/17/docs/specs/man/java.html#creating-cds-archives
Related
So I was trying to make a 1.17.1 minecraft server on my mac. I couldn't open my 1.17.1_server.jar with Java 8 so I download Java 16.0.2.
Unfortunately, everytime I was opening the 1.17.1_server.jar file, I got
"The Java JAR file "1.17._server.jar" could not be launched." .
I first thought that it was because the file was launch by Java 8 instead of 16.
So I went into the terminal and run :<path to java> -jar 1.17.1_server.jar
I then got this : Error: Unable to access jarfile 1.17.1_server.jar
Finally i tried to put the path of the jar file in the command...
So I've run : path to java -jar path to server
and got this :
[main/ERROR]: Failed to load properties from file: server.properties
[15:57:35] [main/WARN]: Failed to load eula.txt
[15:57:35] [main/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.
So why I have to agreed Eula if i've never launched it ? Does it think that he already been launched ?
As stated in the error message
[15:57:35] [main/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.
You have to open the file and check yes
Okay find the solution: my eula and server properties file were in my user folder dk why (never moved them so...)
I'm trying to automate the build process of my Scala application for producing a msi installer.
When doing so, windows claims that certain files cannot be found. Here is the command that gets run
[21:39:01.842] Running C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe in C:\Users\RUNNER~1\AppData\Local\Temp\jdk.jpackage6105194214114584024\images\win-msi.image\krystalbull
and further down, i start seeing errors like this:
C:\Users\runneradmin\AppData\Local\Temp\jdk.jpackage6105194214114584024\config\bundle.wxf(56) : error LGHT0103 : The system cannot find the file 'C:\Users\RUNNER~1\AppData\Local\Temp\jdk.jpackage6105194214114584024\images\win-msi.image\krystalbull\app\classes\com\krystal\bull\gui\FileMenu$anon$2.class'.
C:\Users\runneradmin\AppData\Local\Temp\jdk.jpackage6105194214114584024\config\bundle.wxf(71) : error LGHT0103 : The system cannot find the file 'C:\Users\RUNNER~1\AppData\Local\Temp\jdk.jpackage6105194214114584024\images\win-msi.image\krystalbull\app\classes\com\krystal\bull\gui\dialog\ViewEventDialog$anon$10$anon$21$anonfun$lessinit$greater$1.class'.
C:\Users\runneradmin\AppData\Local\Temp\jdk.jpackage6105194214114584024\config\bundle.wxf(81) : error LGHT0103 : The system cannot find the file 'C:\Users\RUNNER~1\AppData\Local\Temp\jdk.jpackage6105194214114584024\images\win-msi.image\krystalbull\app\classes\com\krystal\bull\gui\SettingsMenu$anon$5.class'.
You can see more instances of this error in the build log here:
https://github.com/bitcoin-s/krystal-bull/runs/2697961906?check_suite_focus=true#step:8:11
My question is this:
What are the limitations in the windows file system or the program candle.exe that prevent the pre-processor from reading Scala files that include things like $anon$
Is there a valid syntax guide somewhere?
Will I need to manually rename all of these files?
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 have previously been deploying a java application successfully in Cloud Foundry. However, now the developers have added a shared library compiled from C. I have added the .so to the .zip file (I'm using universal packager and deploying to Cloud Foundry by zip file) and ensured the .so is executable. However, when I deploy I get an error:
2016-12-23T14:39:01.013+00:00 [STG/0] [OUT] -----> Java Buildpack Version: eba4df6 | git://github.com/cloudfoundry/java-buildpack.git#eba4df6
2016-12-23T14:39:01.017+00:00 [STG/0] [ERR] [Buildpack] ERROR Compile failed with exception #<RuntimeError: No container can run this application. Please ensure that you’ve pushed a valid JVM artifact or artifacts using the -p command line argument or path manifest entry. Information about valid JVM artifacts can be found at https://github.com/cloudfoundry/java-buildpack#additional-documentation.
2016-12-23T14:39:01.017+00:00 [STG/0] [ERR] No container can run this application. Please ensure that you’ve pushed a valid JVM artifact or artifacts using the -p command line argument or path manifest entry. Information about valid JVM artifacts can be found at https://github.com/cloudfoundry/java-buildpack#additional-documentation.
2016-12-23T14:39:01.022+00:00 [STG/0] [ERR] Failed to compile droplet
2016-12-23T14:39:01.024+00:00 [STG/0] [OUT] Exit status 223
So my understanding is that I need to created a Custom Buildpack from the Java Buildpack. However, I am getting stuck with the code at this point:
https://github.com/ONSdigital/java-buildpack/blob/master/bin/compile#L28
# Adding crf tagger library
status "Adding crf tagger support"
cp $bp_dir/parsers/src/main/resources/libbackend.so $build_dir/vendor/
# update the PATH
status "Building runtime environment"
mkdir -p $build_dir/.profile.d
echo "export PATH=\"$HOME/bin:\$HOME/vendor/:\$PATH\";" > $build_dir/.profile.d/crftagger.sh
echo "export LD_LIBRARY_PATH=\"\$HOME/vendor/\";" >> $build_dir/.profile.d/crftagger.sh
From what I can gather I only need to modify the compile stage. What do I need to do to copy over the .so and have the Buildpack run successfully.
Please take a look to this https://docs.cloudfoundry.org/devguide/deploy-apps/deploy-app.html#profile
Pre-Runtime Hooks that's you need. I can't give you more details because you haven't provided enough information (project structure, do you have .profile in you root and etc.).
If you need to add shared libs try to use attr_reader :additional_libraries https://github.com/cloudfoundry/java-buildpack/blob/master/docs/extending-droplet.md
I have an Jar file that is working perfectly fine on my Mac using console:
MacBook-Pro-Pavel:PDFparser pavelpigalev$ java -jar PDFparser.jar
Usage: java PDFparser <input-pdf> -p1 <password> -c1 -i0 -s1
-p1 : PDF password
-c1 : write JSON to console
-i0 : don't extract images
-s1 : take page screenshots [WARNING: currently in beta]
MacBook-Pro-Pavel:PDFparser pavelpigalev$ java -jar PDFparser.jar f5.pdf
MacBook-Pro-Pavel:PDFparser pavelpigalev$
It creates a folder and puts out images that I need in that folder.
But if I use it on the web server (also using console) it gives me this error:
[root#somesite.com pdfparser]$ ls
ffive.pdf lib PDFparser.jar README.TXT
[root#somesite.com pdfparser]$ java -jar "PDFparser.jar"
Usage: java PDFparser <input-pdf> -p1 <password> -c1 -i0 -s1
-p1 : PDF password
-c1 : write JSON to console
-i0 : don't extract images
-s1 : take page screenshots [WARNING: currently in beta]
[root#somesite.com pdfparser]$ java -jar "PDFparser.jar" ffive.pdf
Exception in thread "main" java.lang.ClassNotFoundException: javax.vecmath.Vector2d not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:PDFparser.jar], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.10)
at java.lang.ClassLoader.loadClass(libgcj.so.10)
at java.lang.ClassLoader.loadClass(libgcj.so.10)
at java.lang.reflect.Field.getType(libgcj.so.10)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.excludeField(ReflectiveTypeAdapterFactory.java:56)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:111)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
at com.google.gson.Gson.getAdapter(Gson.java:353)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory.create(CollectionTypeAdapterFactory.java:52)
at com.google.gson.Gson.getAdapter(Gson.java:353)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:82)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:81)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:118)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
at com.google.gson.Gson.getAdapter(Gson.java:353)
at com.google.gson.Gson.toJson(Gson.java:578)
at com.google.gson.Gson.toJson(Gson.java:565)
at com.google.gson.Gson.toJson(Gson.java:520)
at com.google.gson.Gson.toJson(Gson.java:500)
at pdfparser.PDFparser.main(PDFparser.java:163)
I didn't make this Jar file, I don't really know much about Java. I work with PHP and I really need this program working well on server. Can someone help me with that?
Place vechmath .jar in your class path
Or - Add your supporting .jars to the classpath
export CLASSPATH=$CLASSPATH:/path/to/vecmath.jar
Or - Supply at the Runtime
java -cp vecmath-xxx.jar -jar Yourjar.jar
Importance of Classpath
You're not using the same JVM that the one in your macbook. You're using GNU JVM as seen in not found in gnu.gcj.runtime.SystemClassLoader
Try a java -version to confim that and then change your JVM
Try to find vecmath-1.3.1.jar file on you Mac and place it in the same dir as PDFparser.jar is located. Try to run. If no success then try to run as follow:
java -cp vecmath-1.3.1.jar -jar "PDFparser.jar"