It's all about the answers!

Ask a question

Buildtoolkit/Build version for RTC Server 5.0.2 with JAVA_HOME=JDK1.5


Giorgio Tarozzi (111) | asked May 10 '16, 6:57 a.m.
Which version of Buildtoolkit/Build is suitable for RTC Server 5.0.2 with JAVA_HOME=JDK1.5 (mandatory for application build)?

Currently i have :
OS: Linux
build engine 5.2 running with IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 Linux amd64-64 jvmxa6460sr16-20140626_204542 (JIT enabled, AOT enabled)
Apache Ant(TM) version 1.9.7

if in build definition i set JAVA_HOME=PATH_FOR_JDK1.5 i get -->

BUILD FAILED
java.lang.UnsupportedClassVersionError: Bad version number in .class file
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:88)
    at javax.xml.parsers.FactoryFinder.findJarServiceProvider(FactoryFinder.java:278)
    at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:185)
    at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:107)
    at org.apache.tools.ant.util.JAXPUtils.newParserFactory(JAXPUtils.java:122)
    at org.apache.tools.ant.util.JAXPUtils.getNSParserFactory(JAXPUtils.java:106)
    at org.apache.tools.ant.util.JAXPUtils.getNamespaceXMLReader(JAXPUtils.java:174)
    at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:245)
    at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:178)
    at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:93)
    at org.apache.tools.ant.Main.runBuild(Main.java:829)
    at org.apache.tools.ant.Main.startAnt(Main.java:236)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)

Thanks for your support.
Giorgio

Accepted answer


permanent link
Donald Nong (14.4k314) | answered May 11 '16, 12:45 a.m.
If I understand the issue correctly, that is, you have set the "Java home" under the Ant Configuration in the build definition, then it is what you get (the exceptions are thrown by Ant). Effectively, you ask Ant to run with JDK 1.5, which it fails due to mismatched class version. I believe the supplied Ant libraries are built with Java 6 and you have to run it with Java 6 or newer. So, you cannot do it that way.

Instead, to build your source with JDK 1.5, you should invoke the correct compiler (javac) in the build script. To avoid confusion, you may consider using command line rather than Ant for the build.
Ralph Schoon selected this answer as the correct answer

Comments
Giorgio Tarozzi commented May 11 '16, 5:11 a.m.

Yes you've understood the issue correctly. The main problem is that the application that has to be built, has itself in the code a check condition for JDK1.5 because it has to be intregrated with Aqualogic BMP process. So javac 1.5 is mandatory.
In fact this build definition was used for years, but with RTC Server 4.0.1 and buildtoolkit 3.0.1.
Issue started after migrating @ RTC Server 5.0.2 / buildtoolkit 5.0.2.

I also came to the conclusion that the only solution could be force a 1.5 javac inside build.xml, but I' d like to avoid code changes.

Thanks a lot for your support!


SEC Servizi commented Aug 21 '19, 4:30 a.m. | edited Aug 21 '19, 4:30 a.m.
If I understand the issue correctly, that is, you have set the "Java home" under the Ant Configuration in the build definition, then it is what you get (the exceptions are thrown by Ant).

So, we can set JBE to run with JRE 1.6 via -vm option on jbe.ini and set JAVA_HOME to JDK 1.5 location to be able to compile Java source codes at Java 5 level, which is not supported by Ant.

One other answer



permanent link
Ralph Schoon (61.5k33643) | answered May 10 '16, 7:45 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
 Please read this post:  The Day The JBE Stood Still     and use the JDK that ships with the version of RTC you use to run the JBE. Note the build process itself can use a different JDK as far as I can tell.

Comments
Ralph Schoon commented May 10 '16, 10:11 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Also note that your JBE is run with JRE 1.6, whatever your JAVA_HOME says. It is likely inconsistent.


build engine 5.2 running with IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 Linux amd64-64 jvmxa6460sr16-20140626_204542 (JIT enabled, AOT enabled) 


Giorgio Tarozzi commented May 10 '16, 11:19 a.m. | edited May 11 '16, 12:39 a.m.

Hi Ralph,
thanks for your quick answer, unfortunately I am not able to solve my issue.

I downloaded a 32-bit JDK in plain zip RTC-Client-Linux-5.0.2.
After this I edited jbe.ini in \jazz\buildsystem\buildengine\eclipse as follow :
-vm
/app/bea/oag_cm/rtc.5.0.2/jazz/client/eclipse/java32/jdk/jre/bin
--launcher.suppressErrors
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Dcom.ibm.team.filesystem.client.disable.fslistener=true


I started build engine 5.2 with 32-bit java executable :
jbe.sh -vm /app/bea/oag_cm/rtc.5.0.2/jazz/client/eclipse/java32/jdk/jre/bin/java -repository https://172.24.138.64:9443/ccm -userId build_oag -passwordFile /app/bea/oag_cm/BUILD_OAG/jazz/buildsystem/buildengine/eclipse/build_oaglegacy_pswd.txt -engineId oaglegacy.engine -verbose

Java Version:
JRE 1.6.0 IBM J9 2.4 Linux x86-32 jvmxi3260sr16-20140626_204542 (JIT enabled, AOT enabled)
J9VM - 20140626_204542
JIT  - r9_20130920_46510ifx7
GC   - GA24_Java6_SR16_20140626_1848_B204542

But my build definition that contains JAVA_HOME = /jdk150_11 still fails :

Detected Java version: 1.5 in: /beaoagj/jdk150_11/jre
Detected OS: Linux

BUILD FAILED
java.lang.UnsupportedClassVersionError: Bad version number in .class file
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:88)
    at javax.xml.parsers.FactoryFinder.findJarServiceProvider(FactoryFinder.java:278)
    at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:185)
    at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:107)
    at org.apache.tools.ant.util.JAXPUtils.newParserFactory(JAXPUtils.java:122)
    at org.apache.tools.ant.util.JAXPUtils.getNSParserFactory(JAXPUtils.java:106)
    at org.apache.tools.ant.util.JAXPUtils.getNamespaceXMLReader(JAXPUtils.java:174)
    at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:245)
    at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:178)
    at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:93)
    at org.apache.tools.ant.Main.runBuild(Main.java:829)
    at org.apache.tools.ant.Main.startAnt(Main.java:236)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)

Please note that all other build definition that have a JAVA_HOME > 1.5 with the same build engine completes successfuly.

Your answer


Register or to post your answer.