This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 269101 - Module classpath isolation
Summary: Module classpath isolation
Status: REOPENED
Alias: None
Product: platform
Classification: Unclassified
Component: Module System (show other bugs)
Version: 8.2
Hardware: PC All
: P2 normal (vote)
Assignee: Tomas Hurka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-24 05:37 UTC by Peter Nabbefeld
Modified: 2016-12-02 11:21 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Sample project (4.29 MB, application/zip)
2016-11-28 22:15 UTC, Peter Nabbefeld
Details
New Sample Project (7.51 MB, application/zip)
2016-12-02 10:47 UTC, Peter Nabbefeld
Details
IDE Log from testing environment (63.36 KB, text/plain)
2016-12-02 10:49 UTC, Peter Nabbefeld
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Nabbefeld 2016-11-24 05:37:48 UTC
It needs to be possible for modules, to narrow classpath to it's own jar files and classes.

The problem is e.g. javax.persistence privacy:

Looking up the hibernate provider already fails because the same package is already loaded for eclipselink, but of course the hibernate provider is not a subtype of javax.persistence.PersistenceProvider of the eclipselink package.

Adding some other persistance framework like datanucleus doesn't work, either.

IMO, a perfect solution would be to put all those jars into one project, adding persistence.xml and a management class, but providing no more classes but those standard java classes and probably those added as dependencies.
Comment 1 Tomas Hurka 2016-11-25 13:29:19 UTC
Can you please attach sample project, which demonstrates this problem. Thanks.
Comment 2 Peter Nabbefeld 2016-11-28 22:15:30 UTC
Created attachment 163062 [details]
Sample project

Well, the structure of the sample project is incorrect, too, but sufficient to show the problem.

To see the problem, You must have activated JEE, as this brings up JPA from EclipseLink and Hibernate, which cause conflicts beetween those and also with "my" private JPA, in this case DataNucleus.

Without JEE, You'll get a ClassNotFoundException, which is another problem with module classpaths (I'll need to pack my entity classes into the same module as private JPA, as otherwise I'd need a circular dependency).
Comment 3 Peter Nabbefeld 2016-12-01 07:48:07 UTC
In the meantime, I've found this:
OpenIDE-Module-Hide-Classpath-Packages: javax.lang.model.*, com.sun.source.**

at:
http://bits.netbeans.org/6.1/javadoc/org-openide-modules/overview-summary.html

I'll go to investigate this further, if it helps to get the required behaviour. If yes, IMHO it would be a good idea to add some GUI for this feature to the project properties panel.
Comment 4 Peter Nabbefeld 2016-12-02 07:49:01 UTC
I've found the sample project to be invalid, as DataNucleus needs an additional enhancement step, which I've noticed too late, sorry. I wanted to use some JPA not existant in NetBeans, just to work around my problems with duplicated classes.

I'll try to use Hibernate together with "OpenIDE-Module-Hide-Classpath-Packages" now. Because I couldn't make sure if this will work or not up to now, I reduce priority for now. Depending on my results, I'll either raise priority again or close the issue.
Comment 5 Peter Nabbefeld 2016-12-02 10:47:07 UTC
Created attachment 163127 [details]
New Sample Project

I've tried again now with Hibernate and hiding modules, still fails.
Comment 6 Peter Nabbefeld 2016-12-02 10:49:44 UTC
Created attachment 163128 [details]
IDE Log from testing environment

IDE Log from testing environment
Comment 7 Peter Nabbefeld 2016-12-02 10:50:59 UTC
Increasing priority again, as nothing seems to help.
Comment 8 Geertjan Wielenga 2016-12-02 11:04:19 UTC
Please, steps to reproduce. I.e.:

1. Get the sample project attached to this issue.

2. Open it in NetBeans IDE 8.??? on windows? Mac? any of them?

3. Do...

4. The expected result is...

5. However, instead of that...
Comment 9 Peter Nabbefeld 2016-12-02 11:21:22 UTC
Hi Geertjan,

1. Sample project already attached

2. As it concerns JPA, connection in persistence.xml has to be configured. "create" must be enabled first time.

3. Klick "Windows" -> "Try JPA write".

4. Expected: Tables created on first try. Next try "create" must be disabled. Nothing visible expected, as nothing is really written currently.

5. Currently, if no Java modules are enabled, this even works.

6. Enable Java SE, Java EE, Mod. Development (all those I'm enabling usually).

7. Now, an exception is thrown (see message log, already attached).

Kind regards
Peter