Unnamed module and duplicate package
Alan Bateman
Alan.Bateman at oracle.com
Fri Mar 11 10:42:55 UTC 2016
On 11/03/2016 10:04, Neil Bartlett wrote:
> :
>
> Whatever the motivation, I referred to this package as “broken” because it has caused a great many problems for OSGi users. Applications that import the javax.transaction package may encounter NoClassDefFoundError due to the missing types if they wire to the platform export. The most commonly employed practical solution is to add back those types with the application ClassLoader.
Deploying the classes on the class path (application class loader) meant
some types in javax.transaction defined to the boot loader (because of
delegation) and some to the application class loader. A sad state of
affairs that would not have worked if there had been any reliance on
anything package private.
Going forward then it requires deploying the EE version of the
java.transaction module on the upgrade module path.
>
> A properly constructed set of OSGi bundles *should* never throw NoClassDefFoundError or ClassNotFoundException, and I would hope this will also be the case in Jigsaw.
If it compiles then it should run so I would not expect
NoClassDefFoundError. ClassNotFoundException hints of Class.forName and
core reflection usage so the compiler cannot help.
> :
> Would this include the javax.sql.* packages? Since javax.sql exposes XAResource via its method signatures, it would be necessary for the classloader of javax.sql to have visibility of those types also.
>
Yes, except the types in the javax.sql.rowset package as that is a
different module.
The definition for both the java.sql and java.sql.rowset modules can be
found here:
http://cr.openjdk.java.net/~mr/jigsaw/ea/module-summary.html#java.sql
or if you have the EA builds then `java
-listmods:java.sql,java.sql.rowset` will describe these modules.
In terms of visibility then both modules are currently defined to the
boot loader and hence their types are visible via any of the built-in
class loaders. We are on a mission to move non-core modules out of the
boot loader so that they don't have all permissions by default. Easier
said that done of course but we have already moved all the modules
shared with EE so that they can be upgraded by app servers.
I hope we can move java.sql.rowset module, I don't know about java.sql
yet. There is a small spec change needed to do the latter because
currently only the boot loader can defined java.* types (one of the
comments in your mail suggests you are aware of this detail).
-Alan
More information about the jigsaw-dev
mailing list