2016-07-05 53 views
0

我正在使用LDAP外部身份驗證登錄到JasperReports服務器。我已經配置好的ApplicationContext-externalAuth-LDAP.xml錯誤ContextLoader,localhost-startStop-1:331 - 上下文初始化失敗

即在ApplicationContext中,externalAuth-LDAP.xml:

<bean id="ldapContextSource" 
     class="com.jaspersoft.jasperserver.api.security.externalAuth.ldap.JSLdapContextSource"> 
    <constructor-arg value="${external.ldap.url}" /> 
    <property name="userDn" value="${external.ldap.username}" /> 
    <property name="password" value="${external.ldap.password}"/> 
</bean> 
the default_master.properties file contains 

external.ldapUrl=ldap://hostname:389/dc=example,dc=com 
external.ldapDn=cn=Administrator,dc=example,dc=com 

以下是錯誤消息的堆棧跟蹤:

042 ERROR ContextLoader,localhost-startStop-1:331 - Context initialization failed 
org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'ldapContextSource' defined in ServletContext resource [/WEB-INF/applicationContext-externalAuth-LDAP.xml]: Could not resolve placeholder 'external.ldapPassword' in string value "${external.ldapPassword}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'external.ldapPassword' in string value "${external.ldapPassword}" 
    at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:209) 
    at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:223) 
    at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:84) 
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:696) 
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:671) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461) 
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410) 
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) 
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) 
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5524) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) 
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) 
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649) 
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1245) 
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1895) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
    at java.lang.Thread.run(Thread.java:745) 
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'external.ldapPassword' in string value "${external.ldapPassword}" 
    at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:173) 
    at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:161) 
    at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:125) 
    at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer$PlaceholderResolvingStringValueResolver.resolveStringValue(PropertyPlaceholderConfigurer.java:258) 
    at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveStringValue(BeanDefinitionVisitor.java:282) 
    at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue(BeanDefinitionVisitor.java:204) 
    at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitPropertyValues(BeanDefinitionVisitor.java:141) 
    at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitBeanDefinition(BeanDefinitionVisitor.java:82) 
    at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:206) 
+0

此功能可從V5.6重新開始。你使用哪個服務器版本? 'default.properties'位於哪裏? – tobi6

+0

@ tobi6-我正在使用Jaspersoft版本 - jasperreport-server-cp-6.1.0。 default.properties位於C:\ Jaspersoft \ jasperreports-server-cp-6.1.0 \ buildomatic – DWBI

+0

因此,您是否運行了命令'target js-ant refresh-config'?請參閱[Buildomatic數據庫密碼加密]。剛啓動Jasperserver將不起作用。 – tobi6

回答

0

當尚未安裝時,模糊密碼非常簡單:

要確定您的屬性y由propertyConfigurer掃描,您需要搜索它是否在propertyConfigurer的位置中的某個文件中定義。例如,假設您正在尋找加密reportSchedulerMailSender bean的密碼屬性applicationContext-report-scheduling.xml

$ {} report.scheduler.mail.sender.password告訴你report.scheduler.mail.sender.password通過propertyConfigurer豆最有可能的定義。通過propertyConfigurer位置搜索進行驗證。你將能夠找到/WEB-INF/js.quartz.properties定義這個屬性:

report.scheduler.mail.sender.password=${quartz.mail.sender.password}. 

這將是一個類似的情況下,以你的js.externalAuth.properties文件,它的價值。在默認 設置quartz.mail.sender.password與期望的密碼:現在

quartz.mail.sender.password屬性可在default-master.properties加密如下-master.properties:quartz.mail.sender.password = XXYYZZ。如果安裝尚未發生,您可以取消註釋encrypt = truepropsToEncrypt = dbPassword in default-master.properties。然後,您可以添加quartz.mail.sender.passwordpropsToEncrypt

quartz.mail.sender.password=XXYYZZ 
encrypt=true 
propsToEncrypt=dbPassword,quartz.mail.sender.password 

運行後JS-安裝,驗證report.scheduler.mail.sender.password在被加密均爲default-master.properties/WEB-INF/js.quartz.properties

如果安裝已經運行,請設置上述屬性並重新運行。

當心:如果您運行的js安裝,你可能會破壞你的JasperReport安裝:

這些命令將覆蓋在步驟1中創建war文件,使服務器數據源不可訪問。如果您需要重新部署war文件,重新設置數據庫密碼(S)爲純文本,並與步驟1

Source

相關問題