Monday, September 19, 2011

Unsupported major.minor version 51.0 while patching component in LiveCycle ES2

Got this when patching a component in my local LiveCycle ES 2.

When trying to patch the component I got the following unhelpful error from (Eclipse based) Adobe LiveCycle Workbench ES2:

ALC-DSC-027-000: com.adobe.idp.dsc.registry.component.IncompatiblePatchException: Cannot patch component: au.com.blah.NotMyRealComponentName with component having id of: au.com.blah.NotMyRealComponentName
   at com.adobe.idp.dsc.registry.component.impl.ComponentRegistryImpl._update(ComponentRegistryImpl.java:563)
   at com.adobe.idp.dsc.registry.component.impl.ComponentRegistryImpl.modify(ComponentRegistryImpl.java:517)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   ... snip *yawn*

I tried un-installing and then re-installing the component, and got an equally unhelpful error from Workbench:

ALC-DSC-000-000: com.adobe.idp.dsc.DSCRuntimeException: Internal error.
   at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionBMTAdapterBean.doRequiresNew(EjbTransactionBMTAdapterBean.java:249)
   at sun.reflect.GeneratedMethodAccessor644.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
... snip *yawn*

Finally I remembered to look in server.log and found the smoking gun: Unsupported major.minor version 51.0.

2011-09-19 15:03:27,064 ERROR [org.jboss.ejb.plugins.LogInterceptor] RuntimeException in method: public abstract java.lang.Object com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionBMTAdapterLocal.doBMT(com.adobe.idp.dsc.transaction.TransactionCallback) throws com.adobe.idp.dsc.DSCException:
ALC-DSC-000-000: com.adobe.idp.dsc.DSCRuntimeException: Internal error.
   at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionBMTAdapterBean.doRequiresNew(EjbTransactionBMTAdapterBean.java:249)
   at sun.reflect.GeneratedMethodAccessor644.invoke(Unknown Source)
... snip
Caused by: java.lang.UnsupportedClassVersionError: au/com/blah/datatype/PukErrorListCombo : Unsupported major.minor version 51.0
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClass(Unknown Source)
... snip

From this old java.net post called Unsupported major.minor version 51.0: It means that you compiled your classes under a specific JDK, but then try to run them under older version of JDK. So, you can't run classes compiled with JDK 6.0 under JDK 5.0. The same with classes compiled under JDK 7.0 when you try to run them under JDK 6.0.

I have had this before, when I had to switch major versions e.g. revert from using JDK5 for development to JDK4 because the end server used that version. In my case, it was a lot narrower. I was building the component jar using JDK 1.6.0_26 whereas the LiveCycle ES2 uses JDK 1.6.0_14 (which I found by looking at what Java it installed: C:\Adobe\Adobe LiveCycle ES2\Java\jdk1.6.0_14\bin\javaw.exe). So I reverted my build script to use the earlier JDK.

The next problem I found is that merely patching the component still fails. I had to un-install and then re-install the component to get it to work.