Hello Yan,

I don't know the detailed explanation, by I think the solution is the
following configuration

   spring.main.allow-bean-definition-overriding=true

on your CAS server web app "application.properties" file (if that's the
file you are using).


Regards



Yan Zhou <[email protected]> escreveu no dia segunda, 17/07/2023 à(s)
18:36:

> hi there,
>
> i am following CAS doc to setup Intellij to start up CAS via embedded
> tomcat container, but keeps getting this error.
>
> I do not understand why it keeps saying the bean is already registered..
>
> thanks in advance!
> Yan
>
> <Exception encountered during context initialization - cancelling refresh
> attempt:
> org.springframework.beans.factory.support.BeanDefinitionOverrideException:
> Invalid bean definition with name 'messageSource' defined in class path
> resource
> [org/apereo/cas/config/CasCoreWebConfiguration$CasCoreWebMessageSourceConfiguration.class]:
> Cannot register bean definition [Root bean: class [null]; scope=refresh;
> abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0;
> autowireCandidate=true; primary=false;
> factoryBeanName=CasCoreWebMessageSourceConfiguration;
> factoryMethodName=messageSource; initMethodName=null;
> destroyMethodName=(inferred); defined in class path resource
> [org/apereo/cas/config/CasCoreWebConfiguration$CasCoreWebMessageSourceConfiguration.class]]
> for bean 'messageSource': There is already [Root bean: class [null];
> scope=; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0;
> autowireCandidate=true; primary=false;
> factoryBeanName=org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration;
> factoryMethodName=messageSource; initMethodName=null;
> destroyMethodName=(inferred); defined in class path resource
> [org/springframework/boot/autoconfigure/context/MessageSourceAutoConfiguration.class]]
> bound.>
>
> here is the output console.
>
> "C:\Program Files\Java\jdk-11.0.12\bin\java.exe"
> -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:54125,suspend=y,server=n
> -Duser.timezone=UTC -Dspring.profiles.active=standalone
> -Dcas.standalone.configuration-directory=C:\apereocas66x\config
> -javaagent:C:\Users\y..\AppData\Local\JetBrains\IdeaIC2023.1\groovyHotSwap\gragent.jar
> -javaagent:C:\Users\y..\AppData\Local\JetBrains\IdeaIC2023.1\captureAgent\debugger-agent.jar=file:/C:/Users/y../AppData/Local/Temp/capture1.props
> -Dfile.encoding=UTF-8
> @C:\Users\y..\AppData\Local\Temp\idea_arg_file593654062
> org.apereo.cas.web.CasWebApplication
> Connected to the target VM, address: '127.0.0.1:54125', transport:
> 'socket'
> 2023-07-17 15:10:36.066  INFO 18084 --- [  restartedMain]
> .c.c.CasConfigurationPropertiesValidator : Validated CAS property sources
> and configuration successfully.
> 2023-07-17 15:10:39.022  INFO 18084 --- [  restartedMain]
> .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults
> active! Set 'spring.devtools.add-properties' to 'false' to disable
>
>
>      _    ____  _____ ____  _____ ___     ____    _    ____
>     / \  |  _ \| ____|  _ \| ____/ _ \   / ___|  / \  / ___|
>    / _ \ | |_) |  _| | |_) |  _|| | | | | |     / _ \ \___ \
>   / ___ \|  __/| |___|  _ <| |__| |_| | | |___ / ___ \ ___) |
>  /_/   \_\_|   |_____|_| \_\_____\___/   \____/_/   \_\____/
>
>
> CAS Version: Not Available
> CAS Branch: master
> CAS Commit Id: Not Available
> CAS Build Date/Time: 2023-07-14T19:43:48.113Z
> Spring Boot Version: 2.7.3
> Spring Version: 5.3.22
> Java Home: C:\Program Files\Java\jdk-11.0.12
> Java Vendor: Oracle Corporation
> Java Version: 11.0.12
> JVM Free Memory: 195 MB
> JVM Maximum Memory: 7 GB
> JVM Total Memory: 610 MB
> OS Architecture: amd64
> OS Name: Windows 10
> OS Version: 10.0
> OS Date/Time: 2023-07-17T15:10:47.610637600
> OS Temp Directory: C:\Users\Y...\AppData\Local\Temp\
> ------------------------------------------------------------
> Apache Tomcat Version: Apache Tomcat/9.0.76
> ------------------------------------------------------------
>
>
> 2023-07-17 15:10:47.861  INFO 18084 --- [  restartedMain]
> c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at :
> http://localhost:8888
> 2023-07-17 15:10:50.339  INFO 18084 --- [  restartedMain]
> c.c.c.ConfigServicePropertySourceLocator : Connect Timeout Exception on Url
> - http://localhost:8888. Will be trying the next url if available
> 2023-07-17 15:10:50.339  WARN 18084 --- [  restartedMain]
> c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource:
> I/O error on GET request for "http://localhost:8888/application/standalone":
> Connection refused: connect; nested exception is java.net.ConnectException:
> Connection refused: connect
> 2023-07-17 15:10:50.456  INFO 18084 --- [  restartedMain]
> tCasConfigurationPropertiesSourceLocator : Configuration files found at
> [C:\apereocas66x\config] are [[file
> [C:\apereocas66x\config\application-standalone.properties], file
> [C:\apereocas66x\config\application-standalone.properties]]] under
> profile(s) [[standalone]]
> 2023-07-17 15:10:50.521  INFO 18084 --- [  restartedMain]
> b.c.PropertySourceBootstrapConfiguration : Located property source:
> [BootstrapPropertySource
> {name='bootstrapProperties-casCompositePropertySource'}]
> 2023-07-17 15:10:51,019 INFO [restartedMain]
> [org.apereo.cas.configuration.CasConfigurationPropertiesValidator] -
> <Validated CAS property sources and configuration successfully.>
> 2023-07-17 15:10:51,019 INFO [restartedMain]
> [org.apereo.cas.web.CasWebApplication] - <The following 1 profile is
> active: "standalone">
> 2023-07-17 15:10:59,279 WARN [restartedMain]
> [org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext]
> - <Exception encountered during context initialization - cancelling refresh
> attempt:
> org.springframework.beans.factory.support.BeanDefinitionOverrideException:
> Invalid bean definition with name 'messageSource' defined in class path
> resource
> [org/apereo/cas/config/CasCoreWebConfiguration$CasCoreWebMessageSourceConfiguration.class]:
> Cannot register bean definition [Root bean: class [null]; scope=refresh;
> abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0;
> autowireCandidate=true; primary=false;
> factoryBeanName=CasCoreWebMessageSourceConfiguration;
> factoryMethodName=messageSource; initMethodName=null;
> destroyMethodName=(inferred); defined in class path resource
> [org/apereo/cas/config/CasCoreWebConfiguration$CasCoreWebMessageSourceConfiguration.class]]
> for bean 'messageSource': There is already [Root bean: class [null];
> scope=; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0;
> autowireCandidate=true; primary=false;
> factoryBeanName=org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration;
> factoryMethodName=messageSource; initMethodName=null;
> destroyMethodName=(inferred); defined in class path resource
> [org/springframework/boot/autoconfigure/context/MessageSourceAutoConfiguration.class]]
> bound.>
> 2023-07-17 15:10:59,306 INFO [restartedMain]
> [org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener]
> - <
>
> Error starting ApplicationContext. To display the conditions report re-run
> your application with 'debug' enabled.>
> 2023-07-17 15:11:24,641 ERROR [restartedMain]
> [org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter] - <
>
> ***************************
> APPLICATION FAILED TO START
> ***************************
>
> Description:
>
> Error creating bean named messageSource, with resource description class
> path resource
> [org/apereo/cas/config/CasCoreWebConfiguration$CasCoreWebMessageSourceConfiguration.class],
> due to: Invalid bean definition with name 'messageSource' defined in class
> path resource
> [org/apereo/cas/config/CasCoreWebConfiguration$CasCoreWebMessageSourceConfiguration.class]:
> Cannot register bean definition [Root bean: class [null]; scope=refresh;
> abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0;
> autowireCandidate=true; primary=false;
> factoryBeanName=CasCoreWebMessageSourceConfiguration;
> factoryMethodName=messageSource; initMethodName=null;
> destroyMethodName=(inferred); defined in class path resource
> [org/apereo/cas/config/CasCoreWebConfiguration$CasCoreWebMessageSourceConfiguration.class]]
> for bean 'messageSource': There is already [Root bean: class [null];
> scope=; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0;
> autowireCandidate=true; primary=false;
> factoryBeanName=org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration;
> factoryMethodName=messageSource; initMethodName=null;
> destroyMethodName=(inferred); defined in class path resource
> [org/springframework/boot/autoconfigure/context/MessageSourceAutoConfiguration.class]]
> bound.  caused by BeanDefinitionOverrideException: Invalid bean definition
> with name 'messageSource' defined in class path resource
> [org/apereo/cas/config/CasCoreWebConfiguration$CasCoreWebMessageSourceConfiguration.class]:
> Cannot register bean definition [Root bean: class [null]; scope=refresh;
> abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0;
> autowireCandidate=true; primary=false;
> factoryBeanName=CasCoreWebMessageSourceConfiguration;
> factoryMethodName=messageSource; initMethodName=null;
> destroyMethodName=(inferred); defined in class path resource
> [org/apereo/cas/config/CasCoreWebConfiguration$CasCoreWebMessageSourceConfiguration.class]]
> for bean 'messageSource': There is already [Root bean: class [null];
> scope=; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0;
> autowireCandidate=true; primary=false;
> factoryBeanName=org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration;
> factoryMethodName=messageSource; initMethodName=null;
> destroyMethodName=(inferred); defined in class path resource
> [org/springframework/boot/autoconfigure/context/MessageSourceAutoConfiguration.class]]
> bound.
>
> Action:
>
> Review the properties available for the configuration. Enable debug
> logging on
> org.apereo.cas.util.spring.boot.BeanDefinitionStoreFailureAnalyzer to see
> exception stack trace
> >
> Disconnected from the target VM, address: '127.0.0.1:54125', transport:
> 'socket'
>
> Process finished with exit code 0
>
> --
> - 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/a/apereo.org/d/msgid/cas-user/f4793815-abdf-4e86-9930-7d60f9f0bfban%40apereo.org
> <https://groups.google.com/a/apereo.org/d/msgid/cas-user/f4793815-abdf-4e86-9930-7d60f9f0bfban%40apereo.org?utm_medium=email&utm_source=footer>
> .
>

-- 
- 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/CAFi-zbgt%2B317q8rhQUsUV13_jKDB1WsLatXr8cfofsVQ%3D_%2Bj5g%40mail.gmail.com.

Reply via email to