I got it : the value of DATABASE_URL was not right so getUserInfo was null 


Le mercredi 2 juillet 2014 10:11:18 UTC+2, zog a écrit :
>
> Hello,
> i am using spring 3.0.6-RELEASE with an XML configuration :
>
> <bean name="propertyConfigurer"
>           
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
>           p:ignoreUnresolvablePlaceholders="true"
>           p:ignoreResourceNotFound="true">
>         <property name="systemPropertiesModeName" 
> value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
>         <property name="searchSystemEnvironment" value="true" />
>         <property name="locations">
>             <list>
>                 <value>classpath:db.properties</value>
>             </list>
>         </property>
>     </bean>
>     
>     
>        <bean class="java.net.URI" id="dbUrl">
>             <constructor-arg value="#{systemEnvironment.DATABASE_URL}"/>
> </bean>
>
> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
>     <property name="driverClassName" value="org.postgresql.Driver"/>
>     <property name="url" value="#{ 'jdbc:postgresql://' + @dbUrl.getHost() 
> + ':' + @dbUrl.getPort() + @dbUrl.getPath() }"/>
>     <property name="username" value="#{ @dbUrl.getUserInfo().split(':')[0] 
> }"/>
>     <property name="password" value="#{ @dbUrl.getUserInfo().split(':')[1] 
> }"/>
> </bean>
>
> I have a system variable called DATABASE_URL which is set. WHen i launch 
> from eclipse or from a command line i get the folllowing stack trace :
>
> 2014-07-02 10:05:48.276::WARN:  Nested in 
> org.springframework.beans.factory.BeanCreationException: Error creating 
> bean with name 'dataSource' defined
> in class path resource [persistence-config.xml]: Initialization of bean 
> failed; nested exception is 
> org.springframework.beans.factory.BeanExpressionEx
> ception: Expression parsing failed; nested exception is 
> org.springframework.expression.spel.SpelEvaluationException: EL1011E:(pos 
> 21): Method call: At
> tempted to call method split(java.lang.String) on null context object:
> org.springframework.expression.spel.SpelEvaluationException: EL1011E:(pos 
> 21): Method call: Attempted to call method split(java.lang.String) on null c
> ontext object
>
> Which means that the variable DATABASE_URL is not get by spring.
>
> Has anyone any ideas ?
> Thanks a lot !
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Heroku" group.

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"Heroku Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to