search cancel

Gen 8.6 Java Proxy build for Java 1.6 ("Unsupported major.minor version 52.0")

book

Article ID: 229336

calendar_today

Updated On:

Products

Gen

Issue/Introduction

Our app has proxies built in Gen 8.0, Gen 8.5 working fine ... having to redo all the proxies for Gen86 is a problem as our web app is on an older WebSphere (WAS) and a heap of Java there running 1.6 compatible libraries ... what options are there?

I read through this Community thread: Gen 8.6 Complete Release and Java Proxy Build which indicates that the runtimes for the build tool have all been upgraded to Java 1.8

Problem is, for backward compatibility with Java 1.6 , still want to build classic Java proxies in 1.6 - so the build tool no longer works as the j2ee version it wants is 1.8.
Received the error "org/apache/tools/ant/Main : Unsupported major.minor version 52.0":
+++
...
CLASSPATH=D:\APP\workspace\public\ICSdev\Gen8\proxy\java\\src;D:\APP\Programs\CA\Gen86\gen\classes\csu.jar;D:\APP\Programs\CA\Gen86\gen\classes\vwrt.jar;D:\APP\Programs\CA\Gen86\gen\classes\odc.jar;D:\APP\Programs\CA\Gen86\gen\classes\jprt.jar;D:\APP\Programs\CA\Gen86\gen\classes\jprt.xml.jar;D:\APP\Programs\CA\Gen86\gen\bt\bt.jar;D:\APP\workspace\public\Sun\SDK\jdk\lib\tools.jar

java.lang.UnsupportedClassVersionError: org/apache/tools/ant/Main : Unsupported major.minor version 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

Could not find the main class: org.apache.tools.ant.Main.  Program will exit.
...
+++

Environment

Release : 8.6

Component : CA Gen Build Tool

Resolution

1. Up until 2 very recent PTFs for Gen BT & Java runtimes (October 2021), the Gen 8.6 Java runtimes, and any generated Java code were still compiled with Java 1.6 compatibility i.e. target="1.6" and source="1.6".
So to maintain the Java 1.6 compatibility DO NOT INSTALL these 2 PTFs for "Java8 source and target update to 1.8":
BTN86207/LU02673
RTJ86207/LU02672 

2. The Technical Requirements for Gen 8.6 Compilers require the use of either a Java 1.8 or Java 11 Compiler:
https://techdocs.broadcom.com/us/en/ca-mainframe-software/devops/ca-gen/8-6/technical-requirements/third-party-software-version.html#concept.dita_9d28a1624c7e264a6508592eebe74bff636cd29d_Compilers
That requirement really relates to the Build Tool (BT) itself i.e. its compilation process and its runtimes.

3. Per #2, the BT build error is due to the compile picking up older version Java classes than 1.8.
CLASSPATH has "D:\APP\workspace\public\Sun\SDK\jdk\lib\tools.jar" at the end. That directory prefix "D:\APP\workspace\public\Sun\SDK\jdk" comes from the value of BT profile token LOC.JDK_HOME.
Per the Java 6 SE JDK test on the Community thread Gen 8.6 Complete Release and Java Proxy Build, the "org/apache/tools/ant/Main : Unsupported major.minor version 52.0" error is due to using an older JDK than 1.8, like 1.6.
It was confirmed that "D:\APP\workspace\public\Sun\SDK\jdk" is for an earlier JDK version than 1.8 and the problem was resolved after using a JDK 1.8 for LOC.JDK_HOME.