Attempting to implement the service registry via GIT on CAS 6.1. Using the following settings:
# ==============================
# Service registry
# ==============================
cas.service-registry.initFromJson=false
# Git repo as supported by cas-management
cas.serviceRegistry.git.repositoryUrl=https://<enterprise.git.url>/cas/casServices.git
cas.serviceRegistry.git.branchesToClone=master
cas.serviceRegistry.git.activeBranch=master
cas.serviceRegistry.git.username=<username>
cas.serviceRegistry.git.password=<password>
cas.serviceRegistry.git.cloneDirectory=file:/tmp/casServices
cas.serviceRegistry.git.pushChanges=false
cas.serviceRegistry.git.timeout=PT10S
# cas.serviceRegistry.git.privateKeyPassphrase=
# cas.serviceRegistry.git.privateKeyPath=
# cas.serviceRegistry.git.sshSessionPassword=
When the CAS server starts up I get the following error:
[2020-08-31 11:41:17,208 ERROR [org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler] - <Unexpected exception occurred invoking async method: public void org.apereo.cas.config.CasCoreServicesConfiguration.refreshServicesManagerWhenReady(org.springframework.boot.context.event.ApplicationReadyEvent)>ESC[m
java.lang.ClassCastException: class org.eclipse.jgit.transport.TransportHttp cannot be cast to class org.eclipse.jgit.transport.SshTransport (org.eclipse.jgit.transport.TransportHttp and org.eclipse.jgit.transport.SshTransport are in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @41beb473)
at org.apereo.cas.git.GitRepositoryBuilder.lambda$buildTransportConfigCallback$0(GitRepositoryBuilder.java:141) ~[cas-server-support-git-service-registry-6.1.6.jar:6.1.6]
at org.eclipse.jgit.api.TransportCommand.configure(TransportCommand.java:155) ~[org.eclipse.jgit-5.5.1.201910021850-r.jar:5.5.1.201910021850-r]
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:243) ~[org.eclipse.jgit-5.5.1.201910021850-r.jar:5.5.1.201910021850-r]
at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:296) ~[org.eclipse.jgit-5.5.1.201910021850-r.jar:5.5.1.201910021850-r]
…snip…
and when the scheduled task to refresh the service registry attempts to run:
2020-08-31 11:41:36,914 ERROR [org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler] - <Unexpected error occurred in scheduled task>ESC[m
java.lang.ClassCastException: class org.eclipse.jgit.transport.TransportHttp cannot be cast to class org.eclipse.jgit.transport.SshTransport (org.eclipse.jgit.transport.TransportHttp and org.eclipse.jgit.transport.SshTransport are in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @41beb473)
at org.apereo.cas.git.GitRepositoryBuilder.lambda$buildTransportConfigCallback$0(GitRepositoryBuilder.java:141) ~[cas-server-support-git-service-registry-6.1.6.jar:6.1.6]
at org.eclipse.jgit.api.TransportCommand.configure(TransportCommand.java:155) ~[org.eclipse.jgit-5.5.1.201910021850-r.jar:5.5.1.201910021850-r]
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:243) ~[org.eclipse.jgit-5.5.1.201910021850-r.jar:5.5.1.201910021850-r]
at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:296) ~[org.eclipse.jgit-5.5.1.201910021850-r.jar:5.5.1.201910021850-r]
at org.apereo.cas.git.GitRepository.pull(GitRepository.java:170) ~[cas-server-support-git-service-registry-6.1.6.jar:6.1.6]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
…snip…
Obviously, there is some error with my configuration, but I am at a dead end. Does anyone have any input as to what I have incorrectly in the configuration?
I found the solution to my configuration issues. The service registry Git option is using SSH to do git pull/push as the tomcat user. For the system to work properly you should setup your tomcat user to be able to do git push/pull via console. I had to set up that user with a SSH key pair and then setup the public key in the per repository key.
Final cas.properties entries:
# ==============================
# Service registry
# ==============================
#
# JSON registry
cas.serviceRegistry.init-from-json=false
#
# Git repo as supported by cas-management
cas.serviceRegistry.git.repositoryUrl=https://<enterprise.git.url>/cas/casServices.git
cas.serviceRegistry.git.cloneDirectory=file:/etc/cas/services-repo
And a tomcat user setup with SSH keys in both on system home directory and on the git repository.
--
- 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/f0b17b16c9b54610bb6f8ad9dc1c8993%40mun.ca.