Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 366162

Summary: [Hibernate] CDO with hibernate cannot be used standalone due to NPE in HibernateUtil.createMappingProviderFactory
Product: [Modeling] EMF Reporter: Missing name Mising name <stephen.rowles>
Component: cdo.coreAssignee: Martin Taal <mtaal>
Status: CLOSED FIXED QA Contact: Eike Stepper <stepper>
Severity: major    
Priority: P3 CC: mtaal, stepper
Version: 4.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Stack trace
none
List of jar files used
none
config xml file
none
Main java file none

Description Missing name Mising name CLA 2011-12-09 04:54:27 EST
Build Identifier: 4.0.0.v20110608-1440

Attempting to run a CDO server with a hibernate store, but without an equinox environment (simple Java main class).

Having posted on the forum:

http://www.eclipse.org/forums/index.php/m/763125/#msg_763125

I cannot get any further due to the HibernateUtil.createMappingProviderFactory making a static all to get the extension registry, but in my case it is null as I'm not running inside equinox:

IExtensionRegistry registry = Platform.getExtensionRegistry(); - Line 193

This code should work outside of Equinox. My original problem in the repositoryConfigurator was solved by manually adding the storeFactory. Possibly a similar technique could be used here to prevent HibernateStoreFactory.getMappingProvider() method going to the registry to find a mapping provider if one has already been configured, or just allowing manual addition of mapping providers and failing gracefully with a null check on the extension point code.

Reproducible: Always

Steps to Reproduce:
1. Import attached java main and supplied cdo-server.xml configuration file into an eclipse Java project
2. Use attached list of jar files in the class path
2. Run java main file
3. Observe attached stack trace.
Comment 1 Missing name Mising name CLA 2011-12-09 04:54:58 EST
Created attachment 208150 [details]
Stack trace
Comment 2 Missing name Mising name CLA 2011-12-09 04:55:18 EST
Created attachment 208151 [details]
List of jar files used
Comment 3 Missing name Mising name CLA 2011-12-09 04:55:47 EST
Created attachment 208152 [details]
config xml file
Comment 4 Missing name Mising name CLA 2011-12-09 04:56:03 EST
Created attachment 208153 [details]
Main java file
Comment 5 Martin Taal CLA 2011-12-13 13:32:30 EST
Solved in 4.0, use the static:
HibernateUtil.setMappingProviderFactoryInstance(new TeneoHibernateMappingProviderFactory());

call to set a mapping provider.
Comment 6 Eike Stepper CLA 2012-09-21 06:50:32 EDT
Closing.