Open Toejam123 opened 1 year ago
Hi @Toejam123 :wave:
you are fully correct, the problem seems to be an incompatible Java version. If you downloaded beanshooter from the release section, it is compiled for Java 8 (major-minor version 52
). Java is backward compatible regarding class loading. This means that any Java 8+ software should be able to load the tonka bean.
In your example, the server is probably running Java 7 or even older. To make beanshooter working here you need to compile it for Java 7 (or older) too. Here are the steps to fix the issue:
mvn package
within the beanshooter cloneI cannot guarantee that this will resolve the issue, as beanshooter and its dependencies may include code that is not Java 7 compatible. However, it would be interesting to know that. So, if you give it a try, please report your experiences :upside_down_face:
Best Tobias
Unfortunately, it was unsuccessful. Looks as if the beanshooter jar file isn't compatible.
This was the versions that I was using (Java 1.7 was halted once I tried compiling with maven):
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.8.0_111, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Getting the same error once I try to run the jar file:
java -jar beanshooter-4.1.0-jar-with-dependencies.jar
Exception in thread "main" java.lang.UnsupportedClassVersionError: de/qtc/beanshooter/Starter : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:442)
at java.net.URLClassLoader.access$100(URLClassLoader.java:64)
at java.net.URLClassLoader$1.run(URLClassLoader.java:354)
at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:312)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Here's my suggestions:
If the server run jdk 7, you can mvn package
the tonka-bean
maven project, not the beanshooter
project. And then use custom stager to stage your compiled tonka-xxx.jar. For better ease of use, I used Jetbrains IDEA CE to do these things.
But if the server run jdk 6 or lower, you may find that IDEA does not support such low versions of jdk (either does the maven).
So you need to build tonka.jar using jar
executable by yourself. You can check the article below.
https://stackoverflow.com/questions/4597866/java-creating-jar-file
Thanks for sharing your experiences. @Toejam123 when the server runs Java 7, you need to compile the tonka bean with Java 7. Any build using Java 8 (regardless of the minor version) will not work.
@peter5he1by described a possible workflow. I will check whether it is possible to compile the tonka bean per default with Java 7 within my release workflows. If it is, I will adopt it :)
@qtc-de Any update on this perhaps? I'm still seeing Java 7 environments often enough so this would definitely be great to have support for.
For some reason, I'm unable to deploy Tonka. I was able to download / load the file successfully with:
java -jar beanshooter-4.1.0-jar-with-dependencies.jar mlet load 127.0.0.1 1234 tonka http://127.0.0.1 --jmxmp
The unsupported version error makes me think the tonka jar file is not compatible with the current java version running on the server. Would you have any ideas on how to resolve?