Sorry, the app starts automatically at the end of "git push heroku
master."  At runtime, I am showing the env.* variables available to my
app. I added a spring bean that logs env variables on Spring context
init.

On Apr 14, 11:24 pm, "James Ward" <[email protected]> wrote:
> Right now your env vars are not available at build time (on git push).  They 
> are only available at runtime.  Why do you need the DATABASE_URL at build 
> time?
>
> -James
>
>
>
>
>
>
>
> -----Original Message-----
> From: Andrew Clifford <[email protected]>
>
> Sender: [email protected]
> Date: Sat, 14 Apr 2012 08:15:16
> To: Heroku<[email protected]>
> Reply-To: [email protected]
> Subject: Can't find DATABASE_URL using Spring context
>
> Trying to follow the Java/Spring/Hibernate example.  Can't access the
> system environment variable DATABASE_URL using Spring properties as
> Java/Spring sample suggests.  The 5mb Postgres db was created by
> default but I dropped and added it back to see if that would help -
> nothing.  It shows up in "heroku config" but not through JVM's
> System.getenv() or Spring's #{systemEnvironment['DATABASE_URL']} or
> Spring's ${DATABASE_URL}.
>
> My Spring applicationContext.xml has:
>
>         <context:property-placeholder location="classpath*:META-INF/spring/
> *.properties" />
>         <context:spring-configured />
>         <context:annotation-config />
>         <bean class="java.net.URI" id="dbUrl">
>                 <constructor-arg value="#{systemEnvironment['DATABASE_URL']}" 
> />
>         </bean>
>         ....
>
> heroku config shows:
>
> DATABASE_URL        => 
> postgres://shtkg####:####@ec2-23-21-###-###.compute-1.amazonaws.com/####
> JAVA_OPTS           => -Xmx384m -Xss512k -XX:+UseCompressedOops
> MAVEN_OPTS          => -Xmx384m -Xss512k -XX:+UseCompressedOops
> PATH                => /usr/local/bin:/usr/bin:/bin
> SHARED_DATABASE_URL => 
> postgres://shtkg####:####@ec2-23-21-###-###.compute-1.amazonaws.com/####
>
> heroku info shows:
>
> Addons:        Shared Database 5MB
> Database Size: 192k
> Git URL:       [email protected]:###-###-###.git
> Owner:         ###@##.com
> Repo Size:     162M
> Slug Size:     90M
> Stack:         cedar
> Web URL:       http://###-###-###.herokuapp.com/
>
> heroku addons shows:
>
> shared-database:5mb
>
> On git push, I am dumping to log the System.getenv() (no DATABASE_URL
> here!) :
>        env.OLDPWD : /tmp/build_###
>        env.SHELL : /bin/bash
>        env.SHLVL : 2
>        env.GIT_DIR : .
>        env.JAVA_HOME : /usr/lib/jvm/java-6-openjdk
>        env.MAVEN_OPTS : -Xmx512m
>        env.PATH : :/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/
> sbin:/sbin
>        env.SSH_CLIENT : 10.93.##.### 362## 110##
>        env.MAIL : /var/mail/u#####
>        env.USER : u#####
>        env.LOG_TOKEN : ###..
>        env.PWD : /tmp/build_###
>        env.HOME : /app/
>        env.LOGNAME : u#####
>        env._ : /app/tmp/repo.git/.cache/.maven/bin/mvn
>        env.SSH_CONNECTION : 10.93.##.### 36### 10.92.##.## 11###
>        env.LD_LIBRARY_PATH : /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/
> server:/usr/lib/jvm/java-6-openjdk/jre/lib/amd64:/usr/lib/jvm/java-6-
> openjdk/jre/../lib/amd64
>
> git push heroku master shows:
> ...
>        2012-04-14 14:19:24,031 [main] ERROR
> org.springframework.web.context.ContextLoader - Context initialization
> failed
>        org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'dbUrl' defined in file [/tmp/build_###/target/
> myapp-1.0-SNAPSHOT/WEB-INF/classes/META-INF/spring/
> applicationContext.xml]: Instantiation of bean failed; nested
> exception is org.springframework.beans.BeanInstantiationException:
> Could not instantiate bean class [java.net.URI]: Constructor threw
> exception; nested exception is java.lang.NullPointerException
> ...
> Discovering process types
>        Procfile declares types -> web
> -----> Compiled slug size is 90.4MB
> -----> Launching... done, v13
>        http://###-###-###.herokuapp.com deployed to Heroku
>
> Should I add a -D param to the Procfile which the sample does not
> have?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Heroku" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/heroku?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to [email protected].
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.

Reply via email to