|Re: Virgo 3.7.0 and Java 8 support [message #1755851 is a reply to message #1755792]
||Wed, 08 March 2017 15:29
| GianMaria Romanato
Registered: November 2015
Virgo is an OSGi container, but it is also a Java Enteprise Edition container. Additionally, the OSGi enterprise specification depends somehow on the Java Enterprise specification.|
The current version of Java EE is 7. Version 8 of Java Entprise Edition is not yet released, and even when released, Application Server vendors will need some time to adapt their products.
Historically Java EE was released 1 to 2 years after Java SE, but in the context of Java 8 this delay is higher, mostly due to Oracle not evolving Java EE for long time .
Now if you read the Java EE 7 spec  in section Container Requirements you will find "This specification requires that containers provide a Java Compatible™ runtime environment, as defined by the Java Platform, Standard Edition, v7 specification (Java SE). "
In other words, Java EE 7 containers must provide Java SE 7 API to deployed applications. And this is what Virgo does.
In Java Enterprise Edition containers you can somehow workaround this constraint by writing Java 8 code, compiling it with Java 8, and running the Application Server with JDK 8. However, you will not be able to use Java 8 API from packages other than java.*, because the javax.* packages will be provided by the Application Server that will ship with the Java SE/EE 7 version of such packages.
In OSGi containers there is a more formal check represented by the Execution Environment. OSGi build tools typically determine the value of the Execution Environment at compile time. If your code uses Java 8 features, the build tool will add Java 8 as the execution environment in the MANIFEST.MF and your bundle will be unresolvable on a Java 7 compliant container, even if it is executed using a Java 8 runtime.
You can work around this contraint by either removing the Execution Environment header from your manifests, or by tweaking the Java profile file of the server. In both cases, you will be subject to the same limitations related to javax.* packages, and your application will not be compliant with the specification.
Powered by FUDForum
. Page generated in 0.02008 seconds