2016-07-05 41 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

相关问题