CAS Management 6.5.6 with JPA Service Registry is also writing JSON files

401 views
Skip to first unread message

Trevor Fong

unread,
Sep 28, 2022, 6:15:26 PM9/28/22
to CAS Community
Hi There,
I'm trying to set up a fresh CAS Management 6.5.6 instance for dev and have set it up for JPA based service registry, but it is also writing out created/updated services as JSON files.  The result is that every created/updated record is repeated in the UI.  Does anyone know how to turn off the file-base JSON functionality?  Here're my service-registry properties:

cas.service-registry.jpa.enabled=true
cas.service-registry.jpa.user=REDACTED
cas.service-registry.jpa.password=REDACTED
cas.service-registry.jpa.driverClass=oracle.jdbc.OracleDriver
cas.service-registry.jpa.url=jdbc:oracle:thin:@REDACTED:REDACTED:REDACTED
cas.service-registry.jpa.dialect=org.hibernate.dialect.Oracle12cDialect
cas.service-registry.jpa.leakThreshold=10
cas.service-registry.jpa.batchSize=1
cas.service-registry.jpa.autocommit=false
cas.service-registry.jpa.idle-timeout=5000
cas.service-registry.jpa.fail-fast-timeout=1
cas.service-registry.jpa.health-query=SELECT 1 FROM DUAL
cas.service-registry.jpa.isolate-internal-queries=false
cas.service-registry.jpa.pool.suspension=false
cas.service-registry.jpa.pool.minSize=2
cas.service-registry.jpa.pool.maxSize=5
cas.service-registry.jpa.pool.maxWait=2000
cas.service-registry.jpa.ddl-auto=validate

cas.service-registry.yaml.watcherEnabled=false
cas.service-registry.json.watcherEnabled=false
cas.service-registry.core.init-from-json=false
#cas.serviceRegistry.core.initFromJson=true
#cas.serviceRegistry.json.location=file:/etc/cas/config/services

Thanks a lot,
Trevor

Ray Bon

unread,
Sep 28, 2022, 8:44:45 PM9/28/22
to cas-...@apereo.org
Trevor,

Make sure you are not including the JSON module, https://apereo.github.io/cas/6.5.x/services/JSON-Service-Management.html

Next, try this:

cas.serviceRegistry.initFromJson=false

or less likely:

mgmt.versionControl.enabled=false

Ray

On Wed, 2022-09-28 at 15:15 -0700, Trevor Fong wrote:
Notice: This message was sent from outside the University of Victoria email system. Please be cautious with links and sensitive information.

Fotis Memis

unread,
Sep 29, 2022, 4:18:36 AM9/29/22
to cas-...@apereo.org
Hello Trevor,

The problem you face lies here
https://github.com/apereo/cas-management/blob/6.5.x/gradle/dependencies.gradle#L797

The json service registry has been wrongly included as a core dependency
in the dependencies.gradle. This ensures that the relative jar will be
included in your build despite the fact that you have not personally
included the dependency in your build.gradle file.

I have fixed the issue in the 6.6 version of the management app with a
simple PR (https://github.com/apereo/cas-management/pull/246). I have not
sumbitted the same PR for version 6.5 and 6.4 because I do not know the
CAS policy regarding backports.

Kind regards,

Fotis
> --
> - 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+u...@apereo.org.
> To view this discussion on the web visit
> https://groups.google.com/a/apereo.org/d/msgid/cas-user/a0da141c420cc800814440788ab02b98600fe926.camel%40uvic.ca.
>


Message has been deleted

Trevor Fong

unread,
Sep 29, 2022, 8:26:41 PM9/29/22
to CAS Community, fme...@uoa.gr
Hi Fotis,

Thanks a lot for your reply.  How do I remove the org.apereo.cas:cas-server-support-json-service-registry dependency if I'm using the CAS Initializr?  Is this possible?'
This is what I'm doing so far:
getcas --directory cas-management-overlay-6.5.6 --type cas-management-overlay --casVersion 6.5.6 --modules support-jpa-service-registry
Problem is that cas-management-overlay-6.5.6/gradle does not contain dependencies.gradle.
Copying one in from https://github.com/apereo/cas-management/blob/6.5.x/gradle/dependencies.gradle and removing the reference to org.apereo.cas:cas-server-support-json-service-registry and then doing a "./gradlew clean build" still produces a cas-management.war that contains org.apereo.cas:cas-server-support-json-service-registry-6.5.6.jar
I'm guessing the starter project is prebuilt with the cas-server-support-json-service-registry already configured?

I've tried building from the code from github but It doesn't seem to output a "cas-management.war" file like the output from CAS Initilizr:
git clone https://github.com/apereo/cas-management.git 
git checkout v6.5.6
#edit cas-management/gradle/dependencies.gradle

I haven't been able to compile a working cas-management webapp this way so far: running "./gradlew clean build" doesn't produce a cas-management.war file like the project from "getcas", rather it produces build/libs/cas-mgmt-6.5.6.jar which is not deployable to tomcat.  Does anyone know how to produce the war file this way?

Upgrading to cas-6.6.0/cas-mangement-6.6.0 via getcas doesn't work for me - cas-mangement seems to login OK, but then freezes at the "Loading..." page with no errors in the logs.
cas-6.5.8/cas-mangement-6.5.6 via getcas does work, but with org.apereo.cas:cas-server-support-json-service-registry-6.5.6.jar still present.

BTW - https://github.com/apereo/cas-management-overlay seems to be defunct with no updates since Jan 20, 2021 - https://github.com/apereo/cas-management seems to the current focus,

Thanks,
Trevor

Ray Bon

unread,
Sep 29, 2022, 9:22:40 PM9/29/22
to cas-...@apereo.org, fme...@uoa.gr
Trevor,

Only the 'main' branch is not updated. Versioned branches are current for cas-management-overlay.

Ray

Trevor Fong

unread,
Sep 30, 2022, 1:37:27 AM9/30/22
to CAS Community, Ray Bon, fme...@uoa.gr

Hi Ray,

Thanks a lot for your reply.  
> Versioned branches are current for cas-management-overlay.
Aha - thanks for pointing that out!  Looking at the 6.5 version at https://github.com/apereo/cas-management-overlay/tree/6.5, there is a note:
"This repository is always automatically generated from the CAS Initializr. Do NOT submit pull requests here as the change-set will be overwritten on the next sync.To learn more, please visit the CAS documentation."
so it appears this is the same project as can be generated via "getcas --directory cas-management-overlay-6.5.6 --type cas-management-overlay --casVersion 6.5.6" and then you need to manually add in whatever dependencies you need in build.gradle.
But as pointed out by Fotis, it looks like the base code that provides the cas-management-overlay-6.5.6 wrongly includes cas-server-support-json-service-registry, preconfigured, so I'll need to figure out how to create my own custom cas-management-overlay from that case code.

Thanks,
Trev

Fotis Memis

unread,
Sep 30, 2022, 5:38:04 AM9/30/22
to Trevor Fong, CAS Community

Hello Trevor,

I just submitted a PR (https://github.com/apereo/cas-management/pull/247) that backports the fix to the 6.5 version. This should solve your problem in the long term, since the change will be eventually propagated to the management-overlay. If you do not want to wait, you can build the project from the cas-management repo (as you already tried). The process that I personally follow (without claiming it is optimal, it just works for me) is the following.

  1. git clone https://github.com/apereo/cas-management.git 
  2. git checkout 6.5.6
  3. #edit the dependencies.gradle as shown in the PR.
  4. #edit the ./gradle/webapp.gradle to include the dependencies you need. (ex: implementation "org.apereo.cas:cas-server-support-jpa-service-registry:${casVersion}")
  5. cd webapp/cas-mgmt-webapp
  6. ../../gradlew clean build

You will find the produced war in the webapp/cas-mgmt-webapp/build/libs folder.

Hope it helps,

Fotis

Until then,

Trevor Fong

unread,
Oct 3, 2022, 5:08:54 PM10/3/22
to CAS Community, fme...@uoa.gr, Trevor Fong
Thank you so much Fotis and Ray!  
All your help just made my day!!  Your suggestions and directions solved this issue for me.

Thanks again,
Trev

Mukunthini Jeyakumar

unread,
Oct 18, 2023, 1:30:53 PM10/18/23
to CAS Community, Fotis Memis

Hi Fotis,

I'm having the exact same issue with cas management application. I don't see org.apereo.cas:cas-server-support-json-service-registry on dependencies.gradle https://github.com/apereo/cas-management/blob/6.6.x/gradle/dependencies.gradle .
And I've added  implementation "org.apereo.cas:cas-server-support-jpa-service-registry:${project.'casVersion'}" to webapp.gradle and did a clean build. I'm still seeing the services duplicated from management app

Every time I add a service / modify a service, It added in DB and also see a json file created under .../cas-management/WEB-INF/classes/services
Could you able to help on this?

Thanks
Thini

Fotis Memis

unread,
Oct 19, 2023, 11:41:49 AM10/19/23
to Mukunthini Jeyakumar, CAS Community

Hello,

I would start by looking for the cas-server-support-json-service-registry  jar in the lib directory of my deployed manage app, in order to ensure that it has not been included in the build. For example, if you deploy a manage.war on a tomcat server in a debian machine, you can find out this information by inspecting the output of the following command: ls -l /var/lib/tomcat9/webapps/manage/WEB-INF/lib/*json*

Best regards,

Fotis

Reply all
Reply to author
Forward
0 new messages