Bug 1022988

Summary: Out-of-the-box installation: improve UF error message "Could not initialize class ...FileSystemProviders$FileSystemProvidersHolder"
Product: [Retired] JBoss BRMS Platform 6 Reporter: Geoffrey De Smet <gdesmet>
Component: Business CentralAssignee: Alexandre Porcelli <porcelli>
Status: CLOSED CURRENTRELEASE QA Contact: Lukáš Petrovický <lpetrovi>
Severity: high Docs Contact:
Priority: high    
Version: 6.0.0CC: etirelli, porcelli
Target Milestone: ER5   
Target Release: 6.0.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-06 20:19:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Geoffrey De Smet 2013-10-24 12:14:20 UTC
Problem: the real exception gets eaten because of the static constructors.

When running kie-wb from maciesj zip that works for everyone but me, I get this error message:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.uberfire.java.nio.file.api.FileSystemProviders$FileSystemProvidersHolder
        at org.uberfire.java.nio.file.api.FileSystemProviders.getProvider(FileSystemProviders.java:99)
        at org.uberfire.java.nio.file.api.FileSystemProviders.resolveProvider(FileSystemProviders.java:92)
        at org.uberfire.java.nio.file.FileSystems.newFileSystem(FileSystems.java:117)
        at org.uberfire.java.nio.file.FileSystems.newFileSystem(FileSystems.java:83)
        at org.uberfire.io.impl.AbstractIOService.newFileSystem(AbstractIOService.java:206)
        at org.uberfire.metadata.io.IOServiceIndexedImpl.newFileSystem(IOServiceIndexedImpl.java:123)
        at org.uberfire.backend.server.config.ConfigurationServiceImpl.setup(ConfigurationServiceImpl.java:67)
        ... 79 more

The real exception probably happened in
FileSystemProvidersHolder.buildProviders()
or
FileSystemProvidersHolder.buildProvidersMap()
but that exception got eaten so I am dead in the water to figure out what's wrong on my system (which could be anything from disk space to write permissions to startup speed to ...).

Solution: Don't use static constructors. They are very complex to use correctly (see Java puzzlers on deadlocks with static constructors). PS: IIRC, all static constructors are run in the exact same thread, so synchronized is pointless for a static constructor.

Comment 2 Geoffrey De Smet 2013-10-24 12:29:08 UTC
How to reproduce:

Inside one of the 2 methods of FileSystemProvidersHolder, just add this line:
throw new IllegalStateException("This bug is caused by jack the ripper.");

Then build run kie-wb.war. Notice that not a single error message mentions that jack the ripper did it.

Comment 3 Lukáš Petrovický 2013-10-29 09:19:36 UTC
I do agree that we need to make the code not eat the exception. Debugging these things is very painful.

Comment 4 Alexandre Porcelli 2013-10-30 19:02:43 UTC
Issue fixed and pushed to Uberfire master and 0.3.x branches:

https://github.com/droolsjbpm/uberfire/commit/0f6548af0
https://github.com/droolsjbpm/uberfire/commit/46539438e

Comment 5 Lukáš Petrovický 2013-11-23 21:23:44 UTC
Confirmed fixed in the code.