upgrading cas from 4.2.x to 5.0.x and getting Logging config file location '-Djava.util.logging.config.file' not found error

753 views
Skip to first unread message

satnam

unread,
Nov 15, 2016, 5:30:00 PM11/15/16
to CAS Community
Hello,

we are trying to upgrade cas from 4.2.x to 5.0.x and getting error that -Djava.util.logging.config.file=C:\Projects\PASS5\trunk\test\apache-tomcat\cat_base\conf\logging.properties file not found.  The logging.properties file does exist at location. Is there something we need to include?

 

2016-11-15 14:21:40,329 WARN [org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration] - <Logging config file location '-Djava.util.logging.config.file="C:\Projects\PASS5\trunk\test\apache-tomcat\cat_base\conf\logging.properties"' cannot be opened and will be ignored>

Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: ServletContext resource [/-Djava.util.logging.config.file="C:/Projects/PASS5/trunk/test/apache-tomcat/cat_base/conf/logging.properties"] cannot be resolved to URL because it does not exist
    at com.google.common.base.Throwables.propagate(Throwables.java:160)
    at org.apereo.cas.web.report.LoggingConfigController.initialize(LoggingConfigController.java:85)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:365)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:310)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133)
    ... 45 more
Caused by: java.io.FileNotFoundException: ServletContext resource [/-Djava.util.logging.config.file="C:/Projects/PASS5/trunk/test/apache-tomcat/cat_base/conf/logging.properties"] cannot be resolved to URL because it does not exist
    at org.springframework.web.context.support.ServletContextResource.getURL(ServletContextResource.java:156)
    at org.springframework.core.io.AbstractResource.getURI(AbstractResource.java:99)
    at org.apereo.cas.web.report.LoggingConfigController.initialize(LoggingConfigController.java:81)
 

Thanks for help
cas.log

Misagh Moayyed

unread,
Nov 15, 2016, 5:34:49 PM11/15/16
to cas-...@apereo.org

Guess: start using file: in front of the path and try to avoid using back slashes. They have cost humanity many lives.

 

--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/630d656c-26ed-4398-8e24-fd4ca16ac653%40apereo.org.

srikanth gnana

unread,
Nov 23, 2016, 6:16:12 PM11/23/16
to CAS Community
Hi, 

did you get the solution?  I am stuck at the same point. 

thanks.

Kira Vu

unread,
Dec 1, 2016, 9:30:43 AM12/1/16
to CAS Community
I have same problem in 5.1.0-SNAPSHOT

Vào 05:30:00 UTC+7 Thứ Tư, ngày 16 tháng 11 năm 2016, satnam đã viết:
cas.log

Yauheni Sidarenka

unread,
Dec 1, 2016, 10:06:58 AM12/1/16
to CAS Community
I had this problem running CAS 5.0.0 and 5RCs in external Tomcat container using Windows OS.

The problem is that one of Tomcat's .BAT-files (maybe catalina.bat, I cannot recall) has line something like

set LOGGING_CONFIG=blah-blah

and then when Spring is looking for "logging.config" property it is "smart" enough to consider mentioned LOGGING_CONFIG as desired logging.config.

I added line (you may set any path to your logging config for CAS, but I am satisfied with the default file):

logging.config=classpath:log4j2.xml

to cas.properties file which is by default should be placed in file:///etc/cas/config directory, but again you may control this location by spring.cloud.config.server.native.searchLocations property setting it in bootstrap.properties file (as I did) or via command line argument starting from -- (but I did not try):

--spring.cloud.config.server.native.searchLocations=whatever_you_wish

So, this problem disappeared.

By the may, placing logging.config property in application.properties file inside CAS war file didn't help me.

Regards, Yauheni.

satnam

unread,
Dec 5, 2016, 4:41:11 PM12/5/16
to CAS Community
not yet. 

Hao Li

unread,
Dec 18, 2016, 8:12:37 AM12/18/16
to CAS Community
Why  I set spring.cloud.config.server.native.searchLocations=D:\\cas-overlay-template-master\\etc\\cas\\config 
Still get same error

my bootstrap.properties:
##
# CAS Spring Cloud Config Client
#
# Name of the application for which environment settings and properties should be fetched.
# This should map to a cas.yml or cas.properties file.
spring.application.name=cas
spring.cloud.config.fail-fast=true

##
# CAS Embedded Cloud Config Server
#
# Native profile in the Config Server that doesn't use Git, but just loads the
# config files from the local classpath or file system.
#
spring.profiles.active=native
spring.cloud.config.server.native.searchLocations=D:\\cas-overlay-template-master\\etc\\cas\\config
# D:\\cas-overlay-template-master\\etc\\cas\\config

# spring.profiles.active=default
# spring.cloud.config.server.git.uri=https://github.com/repoName/config
# spring.cloud.config.server.git.uri=file://${user.home}/config
# spring.cloud.config.server.git.username=
# spring.cloud.config.server.git.password=
spring.cloud.config.server.bootstrap=true
spring.cloud.config.server.prefix=/configserver
spring.jmx.default-domain=server



在 2016年12月1日星期四 UTC+8下午11:06:58,Yauheni Sidarenka写道:

Hao Li

unread,
Dec 18, 2016, 9:06:41 PM12/18/16
to CAS Community
I fix the error.
spring.cloud.config.server.native.searchLocations=file:///D:/your_path

在 2016年12月18日星期日 UTC+8下午9:12:37,Hao Li写道:

Mathijs Giesbers

unread,
Dec 22, 2016, 12:29:05 PM12/22/16
to CAS Community
I am running into the same error. I am running my instance (cas-overlay, 5.1.0-snapshot) locally without any issues. When I deploy the instance on a TC server instance on our production servers above mentioned issue emerges. Also the fix by defining the logging.config or spring.cloud.config.server.native.searchLocations is not helping. Anyone else running into this issue or having the a solution?

Mathijs

Op maandag 19 december 2016 03:06:41 UTC+1 schreef Hao Li:

Yauheni Sidarenka

unread,
Dec 23, 2016, 4:50:03 AM12/23/16
to CAS Community
Hello.


When I deploy the instance on a TC server instance on our production servers above mentioned issue emerges

So, you are using Windows OS on production server, aren't you? Because it looks like the issue appears only using Tomcat on Windows OS. Then how and where do you specify your logging.config and spring.cloud.config.server.
native.searchLocations properties? I mean, what are your exact values for these properties and where do you place these properties exactly?
 
Regards,
Yauheni

Mathijs Giesbers

unread,
Dec 23, 2016, 5:04:21 AM12/23/16
to CAS Community
I'm on a Linux server (and locally on MacOS). On the Linux env. I've specified the properties like below, I tried multiple configurations in all possible combinations of values below:

 spring.cloud.config.server.native.searchLocations=file:///var/tcserver/current/....
 spring.cloud.config.server.native.searchLocations=classpath:/

logging.config=file:///var/tcserver/current/..../log4j2.xml
logging.config=classpath:/log4j2.xml


Op vrijdag 23 december 2016 10:50:03 UTC+1 schreef Yauheni Sidarenka:

Yauheni Sidarenka

unread,
Dec 23, 2016, 5:31:34 AM12/23/16
to CAS Community
So you have your CAS 5.0.0 overlay project. You should have bootstrap.properties in your overlay. I have Gradle overlay and my bootstrap.properties is here (see https://github.com/apereo/cas-gradle-overlay-template for file structure):
cas-gradle-overlay-template/cas/src/main/resources/bootstrap.properties
I believe in Maven overlay only project dir name may be different.

Inside this bootstrap.properties you should specify spring.cloud.config.server.native.searchLocations only once (e.g. spring.cloud.config.server.native.searchLocations=file:///var/tcserver/current/.... and I am not sure about possibility to specify multiple locations here, but property name says I can, though see Spring's docs) and this should be the name (path) of the directory which holds your external properties file for CAS (file's name must be cas.properties or application.properties)

Then put into cas.properties (or application.properties), which is located under path from that spring.cloud.config.server.native.searchLocations property, property  logging.config and again only once (e.g. logging.config=file:///var/tcserver/current/..../log4j2.xml).

So you may have this file structure:
  • your_overlay_project_dir/cas/src/main/resources/bootstrap.properties
...
spring.cloud.config.server.native.searchLocations=file:///var/tcserver/current/
...
  • /var/tcserver/current/cas.properties
...
#uncomment either this:
#logging.config=classpath:/log4j2.xml
#or this:
logging.config=file:///var/tcserver/current/log4j2.xml
...

Regards,
Yauheni

Mathijs Giesbers

unread,
Dec 23, 2016, 5:35:32 AM12/23/16
to CAS Community
This is exact the configuration I'm using, but still got the error

Op vrijdag 23 december 2016 11:31:34 UTC+1 schreef Yauheni Sidarenka:

Yauheni Sidarenka

unread,
Dec 23, 2016, 5:42:40 AM12/23/16
to CAS Community
Sorry,

It seems to me this is a correct path only in Gradle overlay:
  • your_overlay_project_dir/cas/src/main/resources/bootstrap.properties
  • your_overlay_project_dir/src/main/resources/bootstrap.properties
By the way, did you try to unzip resultant cas.war archive to see what it has in bootstrap.properties?

Regards,
Yauheni

Cesar Bonilla

unread,
Apr 3, 2017, 4:31:11 PM4/3/17
to CAS Community
Hello,

Was somebody able to solve the error? I'm trying to deploy CAS Overlay with tomcat and I am having the same error :(

Kind Regards.

Yauheni Sidarenka

unread,
Apr 4, 2017, 6:23:39 AM4/4/17
to CAS Community
Hello Cesar,

If solutions above did not help you, you may try this one (but I dislike it). Open catalina.bat or catalina.sh script from your tomcat directory, e.g. C:\apache-tomcat-8.0.33\bin\catalina.bat. Then replace every occurrence of LOGGING_CONFIG with LOGGING_CONFIG2, for example. After that save the file and try again to deploy.

And please note that I am talking about CAS 5.0.x family, I know nothing about CAS 5.1.x behavior. You did not mention the version of CAS you are using.

Regards,
Yauheni
Reply all
Reply to author
Forward
0 new messages