Git Product home page Git Product logo

Comments (7)

proton5000 avatar proton5000 commented on July 20, 2024 6

I have the same issue.
When I use the user-storage-jpa as is, without any updates. Create the jar file by mvn clean package then copy it to the <keycloak_path>/providers directory, then <keycloak_path>/bin/kc build, then <keycloak_path>/bin/kc start-dev i have received the error:

ERROR: Unexpected error when starting the server in (development) mode
ERROR: Failed to start quarkus
ERROR: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
ERROR: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
For more details run the same command passing the '--verbose' option. Also you can use '--help' to see the details about the usage of the particular command.

from keycloak-quickstarts.

pedroigor avatar pedroigor commented on July 20, 2024 2

We should be looking at that ASAP. We need to review the support for multiple PUs and data sources.

from keycloak-quickstarts.

serhii900 avatar serhii900 commented on July 20, 2024 1

I have the same issue. When I use the user-storage-jpa as is, without any updates. Create the jar file by mvn clean package then copy it to the <keycloak_path>/providers directory, then <keycloak_path>/bin/kc build, then <keycloak_path>/bin/kc start-dev i have received the error:

ERROR: Unexpected error when starting the server in (development) mode
ERROR: Failed to start quarkus
ERROR: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
ERROR: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
For more details run the same command passing the '--verbose' option. Also you can use '--help' to see the details about the usage of the particular command.

I have the same problem

from keycloak-quickstarts.

niki17nl avatar niki17nl commented on July 20, 2024 1

У меня такая же проблема. Когда я использую user-storage-jpa как есть, без каких-либо обновлений. Создайте файл jar, mvn clean packageзатем скопируйте его в <keycloak_path>/providersкаталог, <keycloak_path>/bin/kc buildзатем <keycloak_path>/bin/kc start-devя получил сообщение об ошибке:

ERROR: Unexpected error when starting the server in (development) mode
ERROR: Failed to start quarkus
ERROR: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
ERROR: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
For more details run the same command passing the '--verbose' option. Also you can use '--help' to see the details about the usage of the particular command.

I have the same issue. When I use the user-storage-jpa as is, without any updates. Create the jar file by mvn clean package then copy it to the <keycloak_path>/providers directory, then <keycloak_path>/bin/kc build, then <keycloak_path>/bin/kc start-dev i have received the error:

ERROR: Unexpected error when starting the server in (development) mode
ERROR: Failed to start quarkus
ERROR: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
ERROR: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
For more details run the same command passing the '--verbose' option. Also you can use '--help' to see the details about the usage of the particular command.

I have the same problem...

from keycloak-quickstarts.

nostra83 avatar nostra83 commented on July 20, 2024 1

Same problem here as well.

У меня такая же проблема. Когда я использую user-storage-jpa как есть, без каких-либо обновлений. Создайте файл jar, mvn clean packageзатем скопируйте его в <keycloak_path>/providersкаталог, <keycloak_path>/bin/kc buildзатем <keycloak_path>/bin/kc start-devя получил сообщение об ошибке:

ERROR: Unexpected error when starting the server in (development) mode
ERROR: Failed to start quarkus
ERROR: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
ERROR: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
For more details run the same command passing the '--verbose' option. Also you can use '--help' to see the details about the usage of the particular command.

I have the same issue. When I use the user-storage-jpa as is, without any updates. Create the jar file by mvn clean package then copy it to the <keycloak_path>/providers directory, then <keycloak_path>/bin/kc build, then <keycloak_path>/bin/kc start-dev i have received the error:

ERROR: Unexpected error when starting the server in (development) mode
ERROR: Failed to start quarkus
ERROR: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
ERROR: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
For more details run the same command passing the '--verbose' option. Also you can use '--help' to see the details about the usage of the particular command.

I have the same problem...
Same problem here as well

from keycloak-quickstarts.

NubiaNetworks avatar NubiaNetworks commented on July 20, 2024 1

Support for multiple PUs is available in Quarkus when using the quarkus-hibernate-orm extension (See: https://quarkus.io/guides/hibernate-orm). The way to configure it is by using the application.properties file. For the Quickstart example it is supposed to read something like this:

quarkus.datasource.users.db-kind=postgresql
quarkus.datasource.users.jdbc.url=jdbc:postgresql://localhost/mydb
quarkus.datasource.users.username=myuser
quarkus.datasource.users.password=mypw
quarkus.datasource.users.min-size=2
quarkus.datasource.users.max-size=8

While we don’t have direct access to the application.properties file, as per https://www.keycloak.org/migration/migrating-to-quarkus we can apply Quarkus level configuration options in conf/quarkus.properties.

Note that you need to remove the existing persistence.xml as these settings cannot coexist.

In theory we should be able to simply inject the EntityManager in EjbExampleUserStorageProvider.java like this:


public class EjbExampleUserStorageProvider implements UserStorageProvider,
...

    @Inject
    @PersistenceUnit("users")
    protected EntityManager em;

Sadly, adding the above options to quarkus.properties, does not yield a valid EntityManager.

The alternative would be bringing back our persistence.xml and add the datasource there:



<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
            http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
            version="2.1">
        <persistence-unit name="users" transaction-type="RESOURCE_LOCAL">    
            <properties>
                <!-- Connection specific -->
                <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL95Dialect"/>
                <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"/>
                <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost/mydb"/>
                <property name="javax.persistence.jdbc.user" value="myuser"/>
                <property name="javax.persistence.jdbc.password" value="mypw"/>
                <property name="hibernate.show_sql" value="true"/>
                <property name="hibernate.format_sql" value="true"/>
                <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
                <property name="javax.persistence.validation.mode" value="NONE"/>
            </properties>
        </persistence-unit>
</persistence>

The build step now succeeds, but the same error appears:

ERROR: Unexpected error when starting the server in (development) mode
ERROR: Failed to start quarkus
ERROR: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
ERROR: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set

The hibernate.dialect is probably misleading. It is more likely that Quarkus is not happy with the persistence.xml.

For reference, I attempted to create a fresh Quarkus application and didn't manage to get it working with a persistence.xml. The equivalent application.properties approach DID work as expected.

I'm happy to spend some time to get this working. Any help is highly appreciated!

PS my WiP fork project can be found here: https://github.com/NubiaNetworks/keycloak-quickstarts

from keycloak-quickstarts.

ahus1 avatar ahus1 commented on July 20, 2024

There is now a a more recent issue #303 that also contains a linked PR. Therefore I close this issue as a duplicate.

from keycloak-quickstarts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.