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 149161 - Hibernate lib module makes dom4j world accessible
Summary: Hibernate lib module makes dom4j world accessible
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: Hibernate (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: Sergey Petrov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-04 21:53 UTC by sreimers
Modified: 2016-07-07 08:53 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sreimers 2008-10-04 21:53:59 UTC
I am trying to update the findbugs libraries to latest versions and I got stuck with upgrading to latest dom4j. If you
want to use some special features you need e.g. jaxen to be on classpath for dom4j (e.g. by putting this in an extra
library wrapper). Now it seems that although I have an own module for dom4j - dom4j may still try to load classes via
the global classloader (Thread.currentThread.getContextClassLoader()) and may with this retrieve classes from the
hibernatelib module (a proper warning is printed on the console about clashing classloaders).

So what shall I do - I cannot alter the package statements since all I have are 3rdParty libraries. I am still trying to
figure out if I can work around all problems (deactivating hibernate module took me step further) or if I have to stay 
with old version of FindBugs so I can get SQE to work correct with 6.5.

I know it is already quite late in the schedule for 6.5 but I would appreciate anything that could be done to get this
working - maybe you could just create correct dom4j/jaxen modules so I can just use those.
Comment 1 sreimers 2008-10-04 23:46:42 UTC
The warning I get is the following

WARNUNG [org.netbeans.ProxyClassLoader]: Will not load class org.dom4j.DocumentFactory arbitrarily from one of
org.netbeans.StandardModule$OneModuleClassLoader@433545[org.dom4j] and
org.netbeans.StandardModule$OneModuleClassLoader@327236[org.netbeans.modules.hibernatelib]; see
http://wiki.netbeans.org/DevFaqModuleCCE
WARNUNG [org.netbeans.ProxyClassLoader]: Will not load class org.dom4j.tree.QNameCache arbitrarily from one of
org.netbeans.StandardModule$OneModuleClassLoader@433545[org.dom4j] and
org.netbeans.StandardModule$OneModuleClassLoader@327236[org.netbeans.modules.hibernatelib]; see
http://wiki.netbeans.org/DevFaqModuleCCE

It seems as if I was able to get around the other problems by moving some classes from my jaxen module to my dom4j
module so that using xpath from dom4j via jaxen now works. 

Still trying to figure out if those warnings above may have bad side effects.
Comment 2 Dongmei Cao 2008-10-06 19:39:01 UTC
I'm not quite sure I understand the problem yet. What was the old version you were using? The hibernatelib uses 1.6.1.
Comment 3 sreimers 2008-10-06 20:17:21 UTC
Before I used an old dom4j-full.jar but now the dependency was upgraded from to the project to 1.6.1 and there I have to
go with a real modules and correct dependencies now.

The main thing this is about is that there is not a separate module for dom4j available within the IDE. It just becomes
visible through the hibernatelib.
Comment 4 Jayashri Visvanathan 2008-10-06 22:28:48 UTC
 What exactly is the problem ? Looks like what the version you need (1.6.1) is the same as what Hibernate uses.
Comment 5 sreimers 2008-10-06 23:07:41 UTC
I need the complete dom4j functionality including those using jaxen. This dependency is missing from the hibernate lib.
Besides this I really have the feeling that a dependency to hibernatelib just to use dom4j seems to be wrong in terms of
modularity.
Comment 6 Dongmei Cao 2008-10-07 00:08:51 UTC
Is it true that jaxen is in a different jar? Are you trying to create a wrapper module wrapping around the dom4j and
jaxen jar? If you have a such module already, can you mail it to me? I'll try to change the hibernatelib module to
depend on your wrapper module and see if everything is fine?  Please make sure dom4j is 1.6.1.
Comment 7 Dongmei Cao 2008-10-07 01:18:18 UTC
Please try to workaround the issue in 6.5 by declaring dependency on hibernatelib. We can try to create separate wrapper
module for dom4j and jaxen in the next release. 
Comment 8 sreimers 2008-10-07 11:19:03 UTC
I have two modules one for dom4j and one for jaxen since there are other 3rd party libraries just using at jaxen. I will
try to extract those two modules from my suite and attach the necessary information here.I had to circumvent a
dependency problem between jaxen und dom4j the dom4j for jaxen adapter is part of the jaxen library so I had to move
those classes to the dom4j library-wrapper also. Still looking for the best way to get this done.

I looked at the code in the hibernate module (it seems to be the only one using hibernatelib?) and looked for the dom4j
dependency. I just found one class referencing it and I am not quite sure if this is really needed to be done via dom4j
- HQLEditorController). Besides this it seems that the dom4j and the other 3rd party libraries (besides hibernate
itself) are just supplied to make org.netbeans.modules.hibernate.util.CustomClassLoader work. As indicator for this I
took that I could not find any references to antlr for example, yet it is declared as a public package inside
hibernatelib. Even freemarker packages are declared public although they are an external dependency (not packaged with
hibernatelib). So maybe there is even more cleanup necessary here. Perhaps a complete different strategy would allow for
packaging those libraries in a complete different way.
Comment 9 Dongmei Cao 2008-10-07 18:24:47 UTC
(cc vadiraj, who created the custom classloader and HQL editor)

The packages declared public because they needed for the Hibernate tools for reverse engineering and HQL editor via the
custom class loader.
Comment 10 Jayashri Visvanathan 2008-10-07 23:26:45 UTC
We are freezing for 6.5 this week, so at this point we won't be able to make major changes or fix issues that has side
effects or can cause regressions. If there is any simple change/work around that can provide a temporary fix to your
issue, we'll be happy be consider it for 6.5 but you'll have to let us know by tomorrow. If not, we'll definitely fix it
post 6.5.

Thanks
Comment 11 Dongmei Cao 2008-10-09 18:11:47 UTC
We're running out of time on 6.5. Let's look into this post 6.5.
Comment 12 Vadiraj Deshpande 2008-11-20 09:19:36 UTC
Will re-look in 7.0
Comment 13 Vadiraj Deshpande 2008-11-20 09:20:08 UTC
Will re-look in 7.0
Comment 14 sreimers 2009-01-19 09:07:54 UTC
Any progress on this? The milestone is currently 70M1 but I can not see anything going on.
Comment 15 Vadiraj Deshpande 2009-01-20 07:14:39 UTC
Targeting for 7.0M2
Comment 16 sreimers 2009-03-17 19:06:13 UTC
Any chance this will make it at least in M3?
Comment 17 Sergey Petrov 2014-07-15 13:35:34 UTC
5 years from last update, hibernate itself still use dom4j but version may be different now, also it may be possible to depend on hibernate instead of separate dom4j module, as it's in java cluster and I suppose it should be available form base n distribution. I'm not sure the issue is still valid or required to fix after this time. On other side, separate dom4j module may be used in hibernate too.
Comment 18 Sergey Petrov 2014-07-21 12:45:22 UTC
if anybody still interested in separate dom4j module, it's possible to create and hibernate to make dependent, but please reopen the issue in this case or if the issue is valid yet and need to be handled some other way
Comment 19 sreimers 2015-08-19 09:30:36 UTC
Still interested in getting this sorted out by having a separate module for dom4j
Comment 20 sreimers 2015-08-19 09:31:52 UTC
Similiar problem with jaxen library -> https://netbeans.org/bugzilla/show_bug.cgi?id=254488
Comment 21 Martin Balin 2016-07-07 08:53:35 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss