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 254488 - java.util.ServiceConfigurationError: javax.xml.transform.TransformerFactory: Provider net.sf.saxon.TransformerFactoryImpl not found
Summary: java.util.ServiceConfigurationError: javax.xml.transform.TransformerFactory: ...
Status: REOPENED
Alias: None
Product: web
Classification: Unclassified
Component: HTML Editor (show other bugs)
Version: 8.1
Hardware: All All
: P3 normal with 1 vote (vote)
Assignee: Milutin Kristofic
URL:
Keywords:
: 254886 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-08-18 15:43 UTC by sreimers
Modified: 2017-01-11 15:14 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 219205


Attachments
stacktrace (3.22 KB, text/plain)
2015-08-18 15:43 UTC, sreimers
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sreimers 2015-08-18 15:43:27 UTC
This issue was reported manually by sreimers.
It already has 1 duplicates 


Build: NetBeans IDE Dev (Build nbms-and-javadoc-183-on-20150803)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.20-b10, Java(TM) SE Runtime Environment, 1.8.0_20-ea-b11
OS: Linux

User Comments:
sreimers: After trying to send problem report




Stacktrace: 
java.util.ServiceConfigurationError: javax.xml.transform.TransformerFactory: Provider net.sf.saxon.TransformerFactoryImpl not found
   at java.util.ServiceLoader.fail(ServiceLoader.java:239)
   at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
   at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372)
   at java.util.ServiceLoader$LazyIterator.access$700(ServiceLoader.java:323)
   at java.util.ServiceLoader$LazyIterator$2.run(ServiceLoader.java:407)
   at java.security.AccessController.doPrivileged(AccessController.java:0)
Comment 1 sreimers 2015-08-18 15:43:29 UTC
Created attachment 155430 [details]
stacktrace
Comment 2 sreimers 2015-08-18 15:53:14 UTC
Looking into message.log I found this

WARNING [org.netbeans.ProxyClassLoader]: Will not load class net.sf.saxon.TransformerFactoryImpl arbitrarily from one of ModuleCL@264f0bd2[org.netbeans.modules.html.validation] and ModuleCL@57ef644e[org.nbheaven.sqe.wrapper.saxon] starting from SystemClassLoader[906 modules]; see http://wiki.netbeans.org/DevFaqModuleCCE


SQE Plugin has a SAXON implementation on board for PMD (wrapped as a library). Now the two saxon libraries (hte one from the html validation and the one from SQE) seem to compete for the javax.xml.transform.TransformerFactory service lookup. I think both modules do not intend to provide the service but probably have dependencies to classes from the saxon implementation (e.g. saxon xpath...)

Any ideas how to fix this? Should probably be done in both modules...
Comment 3 Milutin Kristofic 2015-08-19 09:22:04 UTC
It should be fixed in PMD4.2 https://netbeans.org/bugzilla/show_bug.cgi?id=239852#c8

*** This bug has been marked as a duplicate of bug 239852 ***
Comment 4 sreimers 2015-08-19 09:31:24 UTC
No this is not a duplicate in my point of view. This issue was caused by SQE not EasyPMD. The problem is not PMD but the duplication of the saxon library, which registers a META-INF/service for javax.xml.transform.TransformerFactory.

This is where things get messy. The IDE triggers the usage of TransformerFactory all the magic lookup things happen and suddenly due to duplicate classes the IDE blows up since no TransformerFactory can be instantiated.

I figured out that I could remove the registration from the library to work around the problem - still I would like to have an official statement how this should be handled.

In case we need a more generic issue to cover this problem (I found the next one concerning hibernate module - see https://netbeans.org/bugzilla/show_bug.cgi?id=149161).

Perhaps we just need a jaxen module in the IDE...
Comment 5 Svata Dedic 2015-08-19 18:10:31 UTC
There's IMHO no real way how to prioritize the classes once they are exported into the module system (Jarda Havlin / Tulach should know better).

Possible solutions: 
1/ HTML validation + SQE will use a common saxon library wrapper (provided they can live with the same saxon impl).

2/ HTML validation will use OpenIDE-Module-Covered-Packages to PREVENT saxon's packages to be exported outside the module; probably the transformer construction code would have to be changed.

3/ The SQE module will do (2), or both modules :)
Comment 6 sreimers 2015-08-21 10:53:00 UTC
So how does OpenIDE-Module-Covered-Packages work? Be willing to try it out.
Comment 7 Svata Dedic 2015-08-21 10:55:23 UTC
Covered-Packages enumerates packages which can be seen from other classloaders. So if a package P is NOT enumerated in module X, that module can still use freely classes in P, but other modules dependent on X will not see them.
Comment 8 Milutin Kristofic 2015-09-08 13:13:07 UTC
I am decreasing priority for this bug to P3. This is not a regression, since saxon is in html validation from 2011. There is a workaround for third-party plugins to deal with this issue. I will look at Covered-Modules in next releases, but 8.1 is very close (this month)
Comment 9 Tomas Stupka 2015-09-08 15:01:06 UTC
*** Bug 254886 has been marked as a duplicate of this bug. ***
Comment 10 fvogler 2015-09-18 13:13:35 UTC
I'm working on a NB8.1 release of the SQE project and try to cleanup and fix available bug reports.

While trying to figure out a fix for this bug, I discovered that the "Covered-Packages" feature is broken due to an bug in the ProxyClassLoader. (See the email on the netcat mailing list: subject "Classloading and Covered-Packages" - no response yet). I will fill an separate issue for that.

Nevertheless this feature is not the right way to fix this bug, because I can only declare covered packages e.g. META-INF/services as a whole. Service based filtering is not possible. A module can not provide own services while hiding services provided by 3rdParty libs (included in that module).

From my point of view a feature called "Covered-Services" would be the right solution.
Comment 11 Svata Dedic 2015-09-18 13:34:45 UTC
What is the definition of 'Covered-Services' ? netcat is not ideal for discussing implementation detail or features. Try nbdev@netbeans.org or dev@platform.netbeans.org