You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Ashish Khaware (Jira)" <ji...@apache.org> on 2022/01/17 08:29:00 UTC

[jira] [Updated] (KARAF-7356) Hibernate Core 5.4.32.Final issue resulting in no database connection

     [ https://issues.apache.org/jira/browse/KARAF-7356?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ashish Khaware updated KARAF-7356:
----------------------------------
    Affects Version/s:     (was: 4.2.14)

> Hibernate Core 5.4.32.Final issue resulting in no database connection
> ---------------------------------------------------------------------
>
>                 Key: KARAF-7356
>                 URL: https://issues.apache.org/jira/browse/KARAF-7356
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf
>    Affects Versions: 4.2.15
>            Reporter: Ashish Khaware
>            Priority: Major
>
> Apache Karaf 4.2.14 is bundled with hibernate-core 5.4.32.Final version. But there seems some issue in fetching the database connection. 
>  
> {noformat}
> org.hibernate.orm.core - 5.4.32.Final | HHH000342: Could not obtain connection to query metadata
> org.hibernate.HibernateException: Unable to determine Dialect to use [name=, majorVersion=0]; user must register resolver or explicitly set 'hibernate.dialect'{noformat}
> h4. {{and further logs has entry }}
> {code:java}
> ERROR | CM Configuration Updater (ManagedService Update: pid=[org.apache.aries.jpa.abcd]) | configadmin                      | 11 - org.apache.felix.configadmin - 1.9.22 | [org.osgi.service.cm.ManagedService, id=426, bundle=....project bundle name...: Unexpected problem updating configuration org.apache.aries.jpa.abcd
> java.lang.IllegalArgumentException: The persistence unit abcd has incomplete configuration and cannot be created. The configuration is{hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect, hibernate.id.optimizer.pooled.prefer_lo=true, javax.persistence.spi.PersistenceUnitTransactionType=RESOURCE_LOCAL, service.pid=org.apache.aries.jpa.abcd}
>     at org.apache.aries.jpa.container.impl.AriesEntityManagerFactoryBuilder.createAndPublishEMF(AriesEntityManagerFactoryBuilder.java:365) ~[?:?]{code}
>  
> persistence.xml appears like this:
>  
> {code:java}
> <persistence
>         xsi:schemaLocation="
>         http://java.sun.com/xml/ns/persistence
>         http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
>         xmlns="http://java.sun.com/xml/ns/persistence"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         version="2.0">
>     <persistence-unit name="abcd" transaction-type="RESOURCE_LOCAL">
>         <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
>         <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=xyz)</jta-data-source>
>         <non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=xyz)</non-jta-data-source>
>         <class>.......class names here.......</class>
>         <exclude-unlisted-classes>true</exclude-unlisted-classes>
>         <properties>
>             <property name="hibernate.id.optimizer.pooled.prefer_lo" value="true"/>
>         </properties>
>     </persistence-unit>
> </persistence>
>  
> {code}
>  
> I believe dataSource is not available and hence this error is coming. All required parameters are passed through configuration (like username, password, schema etc..)
>  
> *IMPORTANT:*
> As I am upgrading from Apache Karaf 4.2.9 to 4.2.14 (and to 4.2.15 tomorrow), I have observed that in 4.2.9 JdbcEnvironmentInitiator > initiateService() was getting called twice, where connection was getting established in 2nd iteration.
> In 4.2.14, there is just one invocation and database connection is not established.
> Can someone please investigate?



--
This message was sent by Atlassian Jira
(v8.20.1#820001)