Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
JpaContainer 2.1.0 java 5 compatibility
I've just deployed a jpacontainer-based app for the first time on a java-5 based server. Soon enough I get the following exception:
java.lang.NoSuchMethodError: java.lang.String.isEmpty()Z at com.vaadin.addon.jpacontainer.fieldfactory.MultiSelectTranslator.isOwningSide(MultiSelectTranslator.java:146)
Now ofcourse this is because String,isEmpty() only exists in the java6 api.
So I look in the pom.xml for the jpa plugin and I see the following in the maven-compiler-plugin:
So any comments on:
- How come jpacontainer can compile at 1.5 if it has 1.6 api usage?
- what's the easiest way of getting this working in a 1.5 environment? (recompile jpacontainer being the obvious one)
The first question can be answered from this page from the maven-compiler-plugin:
Note: Merely setting the target option does not guarantee that your code actually runs on a JRE with the specified version. The pitfall is unintended usage of APIs that only exist in later JREs which would make your code fail at runtime with a linkage error. To avoid this issue, you can either configure the compiler's boot classpath to match the target JRE or use the Animal Sniffer Maven Plugin to verify your code doesn't use unintended APIs.
That is my bad. Latest mac versions don't have java5 libraries available easily so it is easy to make the mistake. It should be easy to fix, by just not using that new API. Would you fill in a ticket to dev.vaadin.com?
Its also good to know that we are not hanging with the Java5 support for nothing. Do you have estimates how long you will be tied to java5?
That's logged as #8746.
My current compatibility is bound by IE6 and oracle application server 10. Currently making glacial progress towards IE8+ and weblogic or vfabric so I would expect to move away from java5 some point this year.
I checked the code base of jpacontainer and there is only that one deviation from the java5 api, so my interim solution (for anyone else reading) was to rebuild jpacontainer with that one updated class file.