Note that there are some explanatory texts on larger screens.

plurals
  1. POCould not resolve placeholder for context:property-placeholder
    primarykey
    data
    text
    <p>I am trying to set my app to use different data source definitions, based on an environment variable, but I'm running into the below error. I looked at many similar questions, but they don't seem to be the same.</p> <p>I have set up multiple properties files:</p> <pre><code>env-dev.properties env-test.properties env-prod.properties env-.properties </code></pre> <p>I have created a system property called MEM_ENV with the value "dev"</p> <p>My spring xml file looks like this:</p> <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"&gt; &lt;context:property-placeholder location="classpath*:*env-${MEM_ENV}.properties" /&gt; &lt;bean id="mongoDataSource" class="com.iLearn.persistence.base.MongoDataSourceImpl"&gt; &lt;property name="server" value="${mongo.server}" /&gt; &lt;property name="port" value="${mongo.port}" /&gt; &lt;property name="dbName" value="${mongo.dbName}" /&gt; &lt;property name="userName" value="${mongo.userName}" /&gt; &lt;property name="password" value="${mongo.password}" /&gt; &lt;/bean&gt; </code></pre> <p>My properties files look like this:</p> <pre><code>mongo.server=aServer.com mongo.port=10003 monog.dbName=aDBName mongo.userName=aUserName mongo.password=aPassword </code></pre> <p>The exception I'm getting is:</p> <pre><code> message org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'mongoDataSource' defined in class path resource [springAppConfig.xml]: Could not resolve placeholder 'mongo.server' in string value "${mongo.server}" description The server encountered an internal error (org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'mongoDataSource' defined in class path resource [springAppConfig.xml]: Could not resolve placeholder 'mongo.server' in string value "${mongo.server}") that prevented it from fulfilling this request. exception javax.servlet.ServletException: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'mongoDataSource' defined in class path resource [springAppConfig.xml]: Could not resolve placeholder 'mongo.server' in string value "${mongo.server}" javax.faces.webapp.FacesServlet.service(FacesServlet.java:606) org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:357) com.iLearn.security.AccessFilter.doFilter(AccessFilter.java:43) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload