[ 
https://issues.apache.org/jira/browse/KARAF-6607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17024314#comment-17024314
 ] 

Cor Faber commented on KARAF-6607:
----------------------------------

Thanks for looking into this. Just tried to make a sessionFactory without using 
the hibernat.cfg.xml and that did not work.

Within Karaf I see the database when using 'jdbc:ds-list' and with 'jdbc:query 
name_datasource "select ..."' I can perform queries on the database. I used the 
settings from the corresponding org.ops4j.datasource-name_datasource.cfg to 
build the settings in the source code which is used bij the registryBuilder. 
While creating registry/MetadataSources/Metadata/SessionFactory I get an 
exception after trying to create the Metadata:  
'java.lang.ClassNotFoundException: Could not load requested class : 
org.mariadb.jdbc.Driver'. Which I don't understand, because the depency is 
included in the corresponding pom.xml.

> hibernate.cfg.xml not found - upgrade Karaf 3.0.8 - 4.2.7 / Java 8-9
> --------------------------------------------------------------------
>
>                 Key: KARAF-6607
>                 URL: https://issues.apache.org/jira/browse/KARAF-6607
>             Project: Karaf
>          Issue Type: Question
>          Components: karaf
>    Affects Versions: 4.2.7
>            Reporter: Cor Faber
>            Assignee: Jean-Baptiste Onofré
>            Priority: Major
>         Attachments: pom.xml
>
>
> We are upgrading our system from Karaf 3.0.8 to Karaf 4.2.7 and Java 8 to 9 
> (10/11 will follow). We use hibernate dependencies to connect to a database. 
> In the old version of Karaf we had no issues, but now we have issues 
> connecting to the database in our feature. The datasource.cfg is correct and 
> within the Karaf console we have no issues performing queries on the 
> database, but our feature cannot connect to it. GetSessionFactory 
> (ConfigurationException): Could not locate cfg.xml resource 
> [hibernate.cfg.xml] is the error we get. The hibernate.cfg.xml is located in 
> the main/resources folder and after installing our feature the 
> hibernate.cfg.xml can be found in the root of the corresponding bundle.jar in 
> the data/cache folder. We also use all the defaults for creating a 
> sessionFactory.
> The Java working directory is the base of the apache karaf folder.
> Dependency verions:
> hibernate-jpa-2.1-api.version: 1.0.0.Final
> hibernate-core version: 5.2.10.Final
> hibernate-validator version: 5.2.5.Final
> I've include our pom.xml of our persister. [^pom.xml]
> Any ideas where to start to find a solution for this issue?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to