webobjects

WebObjects Unsupported major.minor version 49.0 error


I have been asked to update some old code I worked on years ago. All in xCode no eclipse and the change is needed urgently so do not have time to migrate away from xCode ATM.

I got my hands on a OS 10.5.8 box installed xcode 3.1.4 and the code compiled fine locally.

Tried to deploy never worked " Unsupported major.minor version 49.0 error" seems the server is running JVM 1.4.2 I have 1.6 locally. I followed some instructions on how to downgrade my local machine to java 1.4.2 without success.

So I gave up and put an old copy of the site back on the server. But now ALL the sites on the server get that same error message and none of them will start even though they have not been touched in 3-4 years. Not sure what happened? my only logically explanation is i accidentally did one action on the server instead of locally? Either way I have no idea what is wrong or how to fix it?


Solution

  • Was this project a framework or an Application? If it is a framework that is depended-on by the other WebObjects projects, that would explain why everything started failing when you updated this project.

    By default, Xcode did not include (or "embed") any depended-upon libraries or frameworks in the Project.woa bundle. Apps built this way depend upon any required resources being available in a few specific locations and then load them at launch. If they all now link to a framework or library that is incompatible, then they'll all stop working.

    As far as the actual "Unsupported major.minor version" error goes, you do not need to downgrade the version of Java on your Mac, you can simply tell the compiler to target an older version of Java.

    I can't remember if Xcode used Ant to do its Java compiling, but if it did and you are using Ant 1.7 or later, you can force Ant to compile 1.4-compatible binaries with Java 1.6 by editing the build.xml file so the javac tag includes a "target" parameter such as: <javac target="1.4" ... /> or by passing in the ant.build.javac.target property when you call Ant, either via command line or by modifying a properties file that Ant will load. I believe build.properties still existed in Xcode-based WebObjects projects. If it does this would be a good place for the property.

    The basics are covered by this stackoverflow question: How to compile classes to JDK1.5 when ant is running in JDK1.6