CAS 7.0.x: How to prevent cas.war from containing Oracle driver?

163 views
Skip to first unread message

Ed O.

unread,
Feb 26, 2024, 9:24:36 PM2/26/24
to CAS Community
I'm new to CAS and I'm trying to use jdbc query authentication running on JBOSS 8.0.

In gradle.properties I have set the appServer entry to blank since I'll be using an external servlet container.
appServer=

and in the build.gradle I specify I need jdbc support.
implementation "org.apereo.cas:cas-server-support-jdbc"

In my cas.properties, I have specified the driver class and the datasource name to be used from the standalone.xml datasource details in JBOSS. I've also specified the cas.authn.jdbc.query[0].sql and fields.

cas.authn.jdbc.query[0].driver-class=oracle.jdbc.driver.OracleDriver

cas.authn.jdbc.query[0].data-source-name=jdbc/ivrsadminDS

The problem is that the CAS war is built with an oracle JDBC driver, which is not needed....but more importantly the JBOSS server cannot index this driver..and fails to deploy the war.   

So my two part question is, ...when configuring for an external server when a server datasource is specified , should a db driver be bundled in the WAR, and if it is by default, is there a way to exclude the oracle jdbc driver from the war file when specifying jdbc support? 

Thanks!




Ed O.

unread,
Feb 26, 2024, 10:59:52 PM2/26/24
to CAS Community, Ed O.
A co-worker directed me on how to use the Maven overlay POM to exclude components....so I'm giving that a try.

Ray Bon

unread,
Feb 27, 2024, 1:57:39 PM2/27/24
to cas-...@apereo.org
Ed,

Are you including the oracle jdbc jar in JBOSS?
My understanding is that the application server creates a jndi object independent of the application being deployed (i.e. it does not look to the application for drivers).

Ray

On Mon, 2024-02-26 at 15:22 -0800, Ed O. wrote:
Notice: This message was sent from outside the University of Victoria email system. Please be cautious with links and sensitive information.

Ed O.

unread,
Mar 11, 2024, 11:39:33 PM3/11/24
to CAS Community, Ray Bon
Hi Ray,
   JBOSS runs a Jandex indexer to index all class files found in the WAR file. There is something incorrectly formatted in the latest oracle driver included in CAS 7, ojdbc11-23.3.0.23.09.jar, which causes the indexer to throw errors and server to fail to start (reference https://github.com/keycloak/keycloak/issues/24983). As you mentioned, since I have a JNDI datasource configured within my app server, I don't need that Jar included in the final generated CAS.war, but because it is a transitive dependency of JDBC support, it is included in the WAR file.
Unfortunately I have not yet found a way to exclude it via the Overlay build.gradle script.  I've tried to add an exclude statement to the war definition, but it is still including it.

war {
entryCompression = ZipEntryCompression.STORED
enabled = false
exclude("ojdbc11-23.3.0.23.09.jar") <=====
}

I've also tried using ;

rootSpec.exclude("ojdbc11-23.3.0.23.09.jar")

instead of the exclude statement but nothing so far has worked.
Any suggestions for what to include in my build.gradle config to exclude the ojdbc war from the final war file WEB-INF/lib directory?

Any suggestions are appreciated.
Thanks,
 Ed O.


Ray Bon

unread,
Mar 18, 2024, 10:47:14 PM3/18/24
to edward.j....@gmail.com, cas-...@apereo.org
Ed,

I have excludes in the 'configurations' stanza, rather than 'war'.

configurations {
all {
resolutionStrategy {
....

}
....

// slf4j causes grief for unit tests
exclude group:"org.apache.logging.log4j", module: "log4j-slf4j2-impl"
....
}
}


Ray

On Mon, 2024-03-11 at 15:48 -0700, Ed O. wrote:
Notice: This message was sent from outside the University of Victoria email system. Please be cautious with links and sensitive information.



-- 
Ray Bon
Programmer Analyst
Development Services, University Systems

I acknowledge and respect the lək̓ʷəŋən peoples on whose traditional territory the university stands, and the Songhees, Esquimalt and WSÁNEĆ peoples whose historical relationships with the land continue to this day.

Ed O.

unread,
Mar 18, 2024, 10:47:14 PM3/18/24
to Ray Bon, cas-...@apereo.org
Thank you Ray! 
I'll give that a try!
Ed
Reply all
Reply to author
Forward
0 new messages