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:       g...@heroku.com:###-###-###.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 heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.

Reply via email to