在ServletContext资源[/WEB

编程入门 行业动态 更新时间:2024-10-27 14:30:16
本文介绍了在ServletContext资源[/WEB-INF/spring-security.xml]中定义了名称为'offlineTokenServices'的无效bean定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

感谢您支持以便在本地运行approuter程序包.

Thank you for supporting to run the approuter package in locally.

现在在运行 firstapp .

我添加了xs.appname xs.uaa.clientid xs.uaa.identityzone xs.uaa.verificationkey,但仅出现相同的问题.

I add xs.appname xs.uaa.clientid xs.uaa.identityzone xs.uaa.verificationkey , but getting same issue only.

请建议我必须使用Environment variable VCAP_SERVICES

[localhost-startStop-1] ERROR com.sap.xs2.securitymons.SAPVcapServicesParser - Environment variable VCAP_SERVICES not set [localhost-startStop-1] WARN org.springframework.web.context.support.XmlWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'offlineTokenServices' defined in ServletContext resource [/WEB-INF/spring-security.xml]: Environment variable VCAP_SERVICES not set; nested exception is java.lang.IllegalStateException: Environment variable VCAP_SERVICES not set [localhost-startStop-1] ERROR org.springframework.web.context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'offlineTokenServices' defined in ServletContext resource [/WEB-INF/spring-security.xml]: Environment variable VCAP_SERVICES not set; nested exception is java.lang.IllegalStateException: Environment variable VCAP_SERVICES not set at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:228) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:225) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:86) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:286) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:166) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:693) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:530) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:400) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:291) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5068) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5584) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.IllegalStateException: Environment variable VCAP_SERVICES not set at com.sap.xs2.securitymons.SAPVcapServicesParser.getAttribute(SAPVcapServicesParser.java:34) at com.sap.xs2.securitymons.SAPPropertyPlaceholderConfigurer.parseVcapServices(SAPPropertyPlaceholderConfigurer.java:44) at com.sap.xs2.securitymons.SAPPropertyPlaceholderConfigurer.readVcapServices(SAPPropertyPlaceholderConfigurer.java:67) at com.sap.xs2.securitymons.SAPPropertyPlaceholderConfigurer.resolvePlaceholder(SAPPropertyPlaceholderConfigurer.java:94) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.resolvePlaceholder(PropertyPlaceholderConfigurer.java:163) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer$PropertyPlaceholderConfigurerResolver.resolvePlaceholder(PropertyPlaceholderConfigurer.java:264) at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:145) at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer$PlaceholderResolvingStringValueResolver.resolveStringValue(PropertyPlaceholderConfigurer.java:244) at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveStringValue(BeanDefinitionVisitor.java:296) at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue(BeanDefinitionVisitor.java:217) at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitPropertyValues(BeanDefinitionVisitor.java:147) at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitBeanDefinition(BeanDefinitionVisitor.java:85) at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:225) ... 18 common frames omitted

推荐答案

如错误消息Caused by: java.lang.IllegalStateException: Environment variable VCAP_SERVICES not set所示,您需要向本地容器提供VCAP_SERVICES作为环境变量.为此,请向环境变量提供相应的参数,就像将真实的XSUAA实例绑定到您的CloudFoundry微服务时一样.对于本地部署,您的VCAP_SERVICES必须至少具有以下参数,其中verificationkey属性需要与JWT的签名匹配.此外,tags属性至关重要.

You need to provide VCAP_SERVICES as an environment variable to your local container as indicated by the error message Caused by: java.lang.IllegalStateException: Environment variable VCAP_SERVICES not set. To do so please provide the environment variable with the corresponding parameters like they are when binding a real XSUAA instance to your CloudFoundry microservice. For local deployments your VCAP_SERVICES has to have at least the following parameters where the verificationkey property needs to match the signature of your JWT. Furthermore, the tags attribute is crucial.

对于Mac/Unix

For Mac/Unix

export VCAP_SERVICES='{ "xsuaa":[ { "credentials": { "clientid":"testClient", "clientsecret":"dummy-clientsecret", "identityzone":"uaa", "url":"dummy-url", "verificationkey":"-----BEGIN PUBLIC KEY-----MIIBI...QIDAQAB-----END PUBLIC KEY-----" }, "tags":["xsuaa"] }] }'

如果正确提供了环境变量,则应该在本地环境日志输出中看到以下消息:

If you provide the environment variable correctly, you should see the following message in your local environment log output:

INFO: Got from VCAP_SERVICES: identityzone=uaa

更多推荐

在ServletContext资源[/WEB

本文发布于:2023-10-28 17:45:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1537333.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:资源   ServletContext   WEB

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!