CAS 6.x Error while deploying cas.war in tomcat

791 views
Skip to first unread message

Juan Carlos Giménez Moncada

unread,
Oct 17, 2019, 11:26:55 AM10/17/19
to cas-...@apereo.org
Hello everyone,

I am Ubuntu Bionic whith Tomcat 9.0.16 and CAS 6.1.0-SNAPSHOT

I build the war with the command via overlay:

build.sh package

I copy cas.war in the webapps directory here is the log:

2019-10-17 17:19:27,064 INFO
[org.apereo.cas.configuration.DefaultCasConfigurationPropertiesSourceLocator]
- <Configuration files found at [/etc/cas/config] are [[file
[/etc/cas/config/cas.properties]]] under profile(s) [[standalone]]>
2019-10-17 17:19:27,246 INFO
[org.apereo.cas.web.CasWebApplicationServletInitializer] - <The
following profiles are active: standalone>
2019-10-17 17:19:46,297 DEBUG
[org.apereo.cas.support.saml.OpenSamlConfigBean] - <Initialized OpenSaml
successfully.>
2019-10-17 17:19:46,613 WARN
[org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext]
- <Exception encountered during context initialization - cancelling
refresh attempt:
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'tomcatServletWebServerFactory' defined in class path
resource
[org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryConfiguration$EmbeddedTomcat.class]:
Initialization of bean failed; nested exception is
java.lang.NoSuchMethodError: 'void
org.apache.catalina.valves.RemoteIpValve.setHostHeader(java.lang.String)'>
2019-10-17 17:19:46,659 WARN
[org.springframework.boot.context.properties.migrator.PropertiesMigrationListener]
- <
The use of configuration keys that have been renamed was found in the
environment:

Property source 'bootstrapProperties':
Key: cas.authn.throttle.appcode
Replacement: cas.authn.throttle.app-code


Each configuration key has been temporarily mapped to its replacement
for your convenience. To silence this warning, please update your
configuration to use the new keys.
>
2019-10-17 17:19:46,703 ERROR
[org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter] - <

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt
was made from the following location:


org.springframework.boot.autoconfigure.web.embedded.TomcatWebServerFactoryCustomizer.customizeRemoteIpValve(TomcatWebServerFactoryCustomizer.java:186)

The following method did not exist:

'void
org.apache.catalina.valves.RemoteIpValve.setHostHeader(java.lang.String)'

The method's class, org.apache.catalina.valves.RemoteIpValve, is
available from the following locations:


jar:file:/usr/share/java/tomcat9-catalina-9.0.16.jar!/org/apache/catalina/valves/RemoteIpValve.class

jar:file:/var/lib/tomcat9/webapps/cas/WEB-INF/lib/tomcat-catalina-9.0.27.jar!/org/apache/catalina/valves/RemoteIpValve.class

jar:file:/var/lib/tomcat9/webapps/cas/WEB-INF/lib/tomcat-embed-core-9.0.27.jar!/org/apache/catalina/valves/RemoteIpValve.class

It was loaded from the following location:

file:/usr/share/java/tomcat9-catalina-9.0.16.jar


Action:

Correct the classpath of your application so that it contains a single,
compatible version of org.apache.catalina.valves.RemoteIpValve


Thanks.

--
Juan Carlos Giménez Moncada
Ticarum / Universidad de Murcia
Campus de Espinardo
30100 Murcia

MW

unread,
Oct 17, 2019, 12:20:23 PM10/17/19
to CAS Community
Try running java -jar /path/to/cas.war

It kinda looks like you compiled with embedded tomcat, if correct and you want to run it in tomcat you need to change the appServer type and recompile

Juan Carlos Giménez Moncada

unread,
Oct 17, 2019, 1:37:58 PM10/17/19
to cas-...@apereo.org
Me appServer is set to -tomcat in gradle.properties, which is the
correct appServer

******************************************
cas.version=6.1.0-SNAPSHOT
springBootVersion=2.2.0.RC1

appServer=-tomcat
executable=false

gradleVersion=5.6.2
tomcatVersion=9.0.16

group=org.apereo.cas
sourceCompatibility=11
targetCompatibility=11

jibVersion=1.6.0

# Location of the downloaded CAS shell JAR
shellDir=build/libs
ivyVersion=2.4.0
gradleDownloadTaskVersion=3.4.3
gradleMavenPluginVersion=3.8.4
gradleLogVersion=0.1.0
*********************************************

Thanks.

El 17/10/19 a las 18:20, MW escribió:
> --
> - 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
> <mailto:cas-user+u...@apereo.org>.
> To view this discussion on the web visit
> https://groups.google.com/a/apereo.org/d/msgid/cas-user/487a6e30-4d9c-498f-a340-d9c74cfa576c%40apereo.org
> <https://groups.google.com/a/apereo.org/d/msgid/cas-user/487a6e30-4d9c-498f-a340-d9c74cfa576c%40apereo.org?utm_medium=email&utm_source=footer>.

--
Juan Carlos Giménez Moncada

Tfno. 668 889 980

Patrick Proniewski

unread,
Oct 17, 2019, 1:42:29 PM10/17/19
to cas-...@apereo.org
Hello

We are trying to use the latest release of CAS branch 6.0 with MFA: it works
We are trying to use the latest release of CAS branch 6.0 with Surrogate / delegated auth: it works

When we try to do both, like authenticating as someone else while our real login uses MFA, it fails totally.

Does anyone here got both MFA and surrogate work on CAS 6.0.x ?

Thanks

Patrick Proniewski

Juan Carlos Giménez Moncada

unread,
Oct 18, 2019, 5:22:27 AM10/18/19
to cas-...@apereo.org
Hi, without embedded tomcat is not run. I put appServer blank and the
error is:

2019-10-18 10:37:32,074 WARN
[org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext]
- <Exception encountered during context initialization - cancelling
refresh attempt:
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'tomcatServletWebServerFactory' defined in class path
resource
[org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryConfiguration$EmbeddedTomcat.class]:
Initialization of bean failed; nested exception is
java.lang.NoSuchMethodError: 'void
org.apache.catalina.valves.RemoteIpValve.setHostHeader(java.lang.String)'>
2019-10-18 10:37:32,124 WARN
[org.springframework.boot.context.properties.migrator.PropertiesMigrationListener]
- <
The use of configuration keys that have been renamed was found in the
environment:

Property source 'bootstrapProperties':
Key: cas.authn.throttle.appcode
Replacement: cas.authn.throttle.app-code


Each configuration key has been temporarily mapped to its replacement
for your convenience. To silence this warning, please update your
configuration to use the new keys.
>
2019-10-18 10:37:32,170 ERROR
[org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter] - <

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt
was made from the following location:


org.springframework.boot.autoconfigure.web.embedded.TomcatWebServerFactoryCustomizer.customizeRemoteIpValve(TomcatWebServerFactoryCustomizer.java:186)

The following method did not exist:

'void
org.apache.catalina.valves.RemoteIpValve.setHostHeader(java.lang.String)'

The method's class, org.apache.catalina.valves.RemoteIpValve, is
available from the following locations:


jar:file:/usr/share/java/tomcat9-catalina-9.0.16.jar!/org/apache/catalina/valves/RemoteIpValve.class

It was loaded from the following location:

file:/usr/share/java/tomcat9-catalina-9.0.16.jar


Action:

Correct the classpath of your application so that it contains a single,
compatible version of org.apache.catalina.valves.RemoteIpValve

Thanks a lot :)

El 17/10/19 a las 18:20, MW escribió:
> --
> - 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
> <mailto:cas-user+u...@apereo.org>.
> To view this discussion on the web visit
> https://groups.google.com/a/apereo.org/d/msgid/cas-user/487a6e30-4d9c-498f-a340-d9c74cfa576c%40apereo.org
> <https://groups.google.com/a/apereo.org/d/msgid/cas-user/487a6e30-4d9c-498f-a340-d9c74cfa576c%40apereo.org?utm_medium=email&utm_source=footer>.

--
Juan Carlos Giménez Moncada

Tfno. 668 889 980

MW

unread,
Oct 18, 2019, 10:48:06 AM10/18/19
to CAS Community
I bet it would run with this command: java -jar /path/to/cas.war

However, remove the line in your gradle.properties 

tomcatVersion=9.0.16

Then, replace -tomcat as your appServer value and recompile. 




On Thursday, October 17, 2019 at 9:26:55 AM UTC-6, moncada wrote:

Nicolas Teste

unread,
Nov 13, 2019, 8:50:12 AM11/13/19
to CAS Community
I had the same issue a few days ago trying to upgrade from 6.0 to 6.1 on Debian 9 and Tomcat 8.5.38 (from backport).
It looks like the method is really missing.

Online ressources
seems to indicate that the method is quite new and not available in our distro packaged Tomcat

Fixed in:
- master for 9.0.23 onwards
- 8.5.x for 8.5.44 onwards
- 7.0.x for 7.0.97 onwards

Dmitriy Kopylenko

unread,
Nov 13, 2019, 8:58:43 AM11/13/19
to cas-...@apereo.org
For what it's worth - if anyone is deploying CAS 6.1 to external Tomcat versions that do not have the newer API, and do not want to either upgrade Tomcat or use CAS in the embedded mode, add this line to your cas.properties -> spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration

and you should be good to go.

Cheers,
D.
--

- 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/42755d7d-96b2-46b0-8d24-72e15a5065e4%40apereo.org.

William Jojo

unread,
Jan 8, 2020, 9:49:55 AM1/8/20
to CAS Community, dkopy...@unicon.net
Dmitriy,

Late to the party on this one. This solution worked for me on Ubuntu 18.04 with distro packaged Tomcat 9.0.16. Thank you!

What are the ramifications of setting this value?

Bill


On Wednesday, November 13, 2019 at 8:58:43 AM UTC-5, Dmitriy Kopylenko wrote:
For what it's worth - if anyone is deploying CAS 6.1 to external Tomcat versions that do not have the newer API, and do not want to either upgrade Tomcat or use CAS in the embedded mode, add this line to your cas.properties -> spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration

and you should be good to go.

Cheers,
D.

To unsubscribe from this group and stop receiving emails from it, send an email to cas-...@apereo.org.

Dmitriy Kopylenko

unread,
Jan 8, 2020, 10:30:59 AM1/8/20
to cas-...@apereo.org, William Jojo
None. It disables embedded tomcat auto configuration which creates an API conflict when deploying to external tomcat with versions less than used in distributed CAS versions if present.

D.


From: William Jojo <joj...@gmail.com>
Reply: cas-...@apereo.org <cas-...@apereo.org>
Date: January 8, 2020 at 9:49:59 AM
To: CAS Community <cas-...@apereo.org>
Cc: dkopy...@unicon.net <dkopy...@unicon.net>
Subject:  Re: [cas-user] Re: CAS 6.x Error while deploying cas.war in tomcat
Dmitriy,

Late to the party on this one. This solution worked for me on Ubuntu 18.04 with distro packaged Tomcat 9.0.16. Thank you!

What are the ramifications of setting this value?

Bill

On Wednesday, November 13, 2019 at 8:58:43 AM UTC-5, Dmitriy Kopylenko wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to cas-...@apereo.org.
--
- 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.
Reply all
Reply to author
Forward
0 new messages