[keycloak-user] Photoz Authz example DB issue

Ilya Korol llivezking at gmail.com
Mon Apr 10 03:05:47 EDT 2017


Hi, i'm trying to realize how does authz work in keycloak, therefore i 
tried to run keycloak/examples/authz/photoz project. I failed to run it 
from git sources (i'm even failed to build or test it!), so i downloaded 
examples.zip from keycloak.org. I successfully built and deployed jars 
to keycloak instance, but when i go to specified in README.md urls 
(http://localhost:8080/photoz-html5-client/#/album/create ...) i see 
NPEs in keycloak logs. This errors refers to any code like:

this.entityManager.createQuery("from Album where name = :name and userId 
= :userId");

I checked persistence.xml:

     <persistence-unit name="primary" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>

<class>org.keycloak.example.photoz.entity.Album</class>
<class>org.keycloak.example.photoz.entity.Photo</class>

         <properties>
             <property name="hibernate.dialect" 
value="org.hibernate.dialect.H2Dialect" />
             <property name="hibernate.connection.driver_class" 
value="org.h2.Driver" />
             <property name="hibernate.connection.url" 
value="jdbc:h2:~/keycloak-photoz-example" />
             <property name="hibernate.connection.user" value="sa" />
             <property name="hibernate.flushMode" value="FLUSH_AUTO" />
             <property name="hibernate.hbm2ddl.auto" value="update" />
             <property name="hibernate.show_sql" value="false" />
         </properties>
     </persistence-unit>


Do i have to make any DB bootstrapping actions or this project should 
work right out of the box?



More information about the keycloak-user mailing list