getting service registry to load into jpa database

586 views
Skip to first unread message

Toby Archer

unread,
Jul 14, 2017, 10:05:14 AM7/14/17
to CAS Community
Making great strides getting cas up and running, but I've bumped into a new challenge with trying to get the service registry into my database. I have the following configuration:

cas.serviceRegistry.watcherEnabled=true
cas.serviceRegistry.repeatInterval=120000
cas.serviceRegistry.startDelay=15000
cas.serviceRegistry.initFromJson=true
cas.serviceRegistry.config.location=file:/etc/cas/config/services

cas.serviceRegistry.jpa.url=jdbc:sqlserver://dev-sql06.usd.edu;databaseName=CAS5
cas.serviceRegistry.jpa.user=cas_user
cas.serviceRegistry.jpa.password=super secure password, no peeking!
cas.serviceRegistry.jpa.failFast=true
cas.serviceRegistry.jpa.dialect=org.hibernate.dialect.SQLServerDialect
cas.serviceRegistry.jpa.autocommit=true
cas.serviceRegistry.jpa.ddlAuto=create-drop

As I understand it, this should connect to the database, specifically the database name "CAS5" in our dev sql box, create the necessary tables, and then initialize the data in those tables from the JSON files I have been using to boot strap this into working. This works up to the initializing data. CAS connects to the database just fine and creates the appropriate tables, but that's where it stops. In the logs I see:

Hibernate: alter table RegisteredServiceImpl_Props drop constraint FK1xan7uamsa94y2451jgksjkj4
Hibernate: alter table RegisteredServiceImpl_Props drop constraint FK5ghaknoplphay7reury7n3vcm
Hibernate: drop table hibernate_sequence
Hibernate: drop table RegexRegisteredService
Hibernate: drop table RegexRegisteredServiceProperty
Hibernate: drop table RegisteredServiceImpl_Props
Hibernate: create table hibernate_sequence (next_val numeric(19,0))
Hibernate: insert into hibernate_sequence values ( 1 )
Hibernate: insert into hibernate_sequence values ( 1 )
Hibernate: create table RegexRegisteredService (expression_type VARCHAR(15) DEFAULT 'ant' not null, id numeric(19,0) not null, access_strategy image, attribute_release image, description varchar(255), evaluation_order int not null, informationUrl varchar(255), logo varchar(255), logout_type int, logout_url varchar(255), mfa_policy image, name varchar(255) not null, privacyUrl varchar(255), proxy_policy image, public_key image, required_handlers image, serviceId varchar(255) not null, theme varchar(255), username_attr image, primary key (id))
Hibernate: create table RegexRegisteredServiceProperty (id numeric(19,0) not null, property_values image, primary key (id))
Hibernate: create table RegisteredServiceImpl_Props (AbstractRegisteredService_id numeric(19,0) not null, properties_id numeric(19,0) not null, properties_KEY varchar(255) not null, primary key (AbstractRegisteredService_id, properties_KEY))
Hibernate: alter table RegisteredServiceImpl_Props add constraint UK_i2mjaqjwxpvurc6aefjkx5x97 unique (properties_id)
Hibernate: alter table RegisteredServiceImpl_Props add constraint FK1xan7uamsa94y2451jgksjkj4 foreign key (properties_id) references RegexRegisteredServiceProperty
Hibernate: alter table RegisteredServiceImpl_Props add constraint FK5ghaknoplphay7reury7n3vcm foreign key (AbstractRegisteredService_id) references RegexRegisteredService

Looks good. but then I never see anything more from hibernate. Later I see:

2017-07-14 08:45:36,875 INFO [org.apereo.cas.services.DefaultServicesManager] - <Loaded [3] service(s) from [JsonServiceRegistryDao].>

So clearly the json files are being loaded. But why do the services then never get loaded into the database? I feel like I'm missing just one command or property some where, but I'm not sure what. "initFromJson" sound like a pretty darn likely one, but it has failed me. :(

Any further advice on what's missing?

Toby Archer

unread,
Jul 18, 2017, 4:40:28 PM7/18/17
to CAS Community
So I figured out that I had two Service Registry's setup. I disabled the Json registry and JPA took over. But I still am not getting it to init from JSON. Any clues to that one? It seems to be doing something like that, since there are 2 services placed in the database as soon as it spins up. So it's loading from somewhere, but despite setting the path to the json files. So I guess at this point my question is: I have it initializing from Json, how can I get it to initialize from my Json?

Misagh Moayyed

unread,
Jul 18, 2017, 4:45:53 PM7/18/17
to cas-...@apereo.org

Sounds like it’s ignoring your config location and loading the registry from “default” JSON services that ship with CAS.

 

--Misagh

--
- CAS gitter chatroom: https://gitter.im/apereo/cas
- CAS mailing list guidelines: https://apereo.github.io/cas/Mailing-Lists.html
- CAS documentation website: https://apereo.github.io/cas
- CAS project website: https://github.com/apereo/cas
---
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+u...@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/33cbd9ee-3a7e-46b1-a304-e277f08497cf%40apereo.org.

Toby Archer

unread,
Jul 19, 2017, 9:13:40 AM7/19/17
to CAS Community, mmoa...@unicon.net
yes. any ideas on why it is ignoring my files and what I could do to make it not ignore my files?

casuser

unread,
Jan 16, 2018, 10:23:49 PM1/16/18
to CAS Community, mmoa...@unicon.net
Hi Toby I am also having the same problem, zero services are loaded from the jpa service registry. Did you able to solve it?

Toby Archer

unread,
Jan 17, 2018, 10:46:48 AM1/17/18
to CAS Community, mmoa...@unicon.net
I did, but it's been so long ago and I didn't keep notes of what I did since it was before I was working in a git repo. But what I can tell you is what's different between my cas.properties file above and now. There honestly isn't a lot of difference, but there are two things I do see:

cas.serviceRegistry.jpa.ddlAuto=update
cas.serviceRegistry.jpa.driverClass=com.microsoft.sqlserver.jdbc.SQLServerDriver

The first is ddlauto is now update instead of create-drop. And I specified the SQL driver specifically. My gut says that my problem was probably stemming from having a wrong SQL driver. Working with MS SQL can be quite bother some. Give those things a try and if not I'll see what else I can suggest.

matrix development

unread,
Jan 17, 2018, 9:18:37 PM1/17/18
to cas-...@apereo.org
thanks I got it,

--
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG

---
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+unsubscribe@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/d3cb5046-e6d6-425e-a682-804b7a751a4f%40apereo.org.



--
-Fazla.
Reply all
Reply to author
Forward
0 new messages