postgresql - Unable to connect Appfuse Spring app with Heroku Postgres database -


i'm trying deploy basic appfuse spring app heroku. when push code heroku builds, when try open page application error page. believe problem connecting heroku's postgres db , app breaks @ moment first request db made, i'm not sure how fix that.

i added beans applicationcontext.xml:

<bean class="java.net.uri" id="dburl">     <constructor-arg value="#{systemenvironment['database_url']}"/> </bean> <bean class="org.apache.commons.dbcp.basicdatasource" destroy-method="close" id="datasource">     <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] }"/>     <property name="connectionproperties" value="ssl=true;sslfactory=org.postgresql.ssl.nonvalidatingfactory;"/> </bean> 

and these logs after successful build:

    ←[36m2015-06-14t14:30:10.945012+00:00 app[web.1]:←[0m jun 14, 2015 2:30:10 pm org.apache.catalina.startup.contextconfig processannotationsjar ←[36m2015-06-14t14:30:10.959377+00:00 app[web.1]:←[0m   @ org.apache.tomcat.util.bcel.classfile.classparser.readid(classparser.java:200) ←[36m2015-06-14t14:30:10.963840+00:00 app[web.1]:←[0m   @ org.apache.catalina.startup.contextconfig.processannotationsstream(contextconfig.java:2071) ←[36m2015-06-14t14:30:10.968017+00:00 app[web.1]:←[0m   @ org.apache.catalina.startup.contextconfig.webconfig(contextconfig.java:1330) ←[36m2015-06-14t14:30:10.964296+00:00 app[web.1]:←[0m   @ org.apache.catalina.startup.contextconfig.processannotationsurl(contextconfig.java:1913) ←[36m2015-06-14t14:30:10.969138+00:00 app[web.1]:←[0m   @ org.apache.catalina.util.lifecyclebase.firelifecycleevent(lifecyclebase.java:90) ←[36m2015-06-14t14:30:10.987850+00:00 app[web.1]:←[0m   @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) ←[36m2015-06-14t14:30:10.974187+00:00 app[web.1]:←[0m   @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1565) ←[36m2015-06-14t14:30:10.968449+00:00 app[web.1]:←[0m   @ org.apache.catalina.startup.contextconfig.lifecycleevent(contextconfig.java:386) ←[36m2015-06-14t14:30:10.972076+00:00 app[web.1]:←[0m   @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150) ←[36m2015-06-14t14:30:10.948152+00:00 app[web.1]:←[0m java.io.eofexception ←[36m2015-06-14t14:30:10.948084+00:00 app[web.1]:←[0m severe: unable process jar entry [org/hibernate/type/descriptor/java/calendartimetypedescriptor.class] jar [jar:jndi:/localhost/web-inf/lib/hibernate-core-4.3.6.final.jar!/] f ←[36m2015-06-14t14:30:10.959147+00:00 app[web.1]:←[0m   @ org.apache.tomcat.util.bcel.classfile.fastdatainputstream.readint(fastdatainputstream.java:145) ←[36m2015-06-14t14:30:10.959589+00:00 app[web.1]:←[0m   @ org.apache.tomcat.util.bcel.classfile.classparser.parse(classparser.java:78) ←[36m2015-06-14t14:30:10.964066+00:00 app[web.1]:←[0m   @ org.apache.catalina.startup.contextconfig.processannotationsjar(contextconfig.java:1947) ←[36m2015-06-14t14:30:10.964540+00:00 app[web.1]:←[0m   @ org.apache.catalina.startup.contextconfig.processannotations(contextconfig.java:1898) ←[36m2015-06-14t14:30:10.968231+00:00 app[web.1]:←[0m   @ org.apache.catalina.startup.contextconfig.configurestart(contextconfig.java:889) ←[36m2015-06-14t14:30:10.968679+00:00 app[web.1]:←[0m   @ org.apache.catalina.util.lifecyclesupport.firelifecycleevent(lifecyclesupport.java:117) ←[36m2015-06-14t14:30:10.971888+00:00 app[web.1]:←[0m   @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5380) ←[36m2015-06-14t14:30:10.972496+00:00 app[web.1]:←[0m   @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1575) ←[36m2015-06-14t14:30:10.982160+00:00 app[web.1]:←[0m   @ java.util.concurrent.futuretask.run(futuretask.java:266) ←[36m2015-06-14t14:30:10.988068+00:00 app[web.1]:←[0m   @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) ←[36m2015-06-14t14:30:10.988211+00:00 app[web.1]:←[0m ←[36m2015-06-14t14:30:10.988181+00:00 app[web.1]:←[0m   @ java.lang.thread.run(thread.java:745) ←[33m2015-06-14t14:30:19.107425+00:00 heroku[router]:←[0m at=error code=h12 desc="request timeout" method=get path="/" host=iin.herokuapp.com request_id=d9f43955-4856-49fd-99e3-acb2a8726026 fwd="193.135.254.174" dyno=web.1 connect=1ms se  bytes=0 ←[36m2015-06-14t14:30:21.083301+00:00 app[web.1]:←[0m jun 14, 2015 2:30:21 pm org.apache.catalina.core.applicationcontext log ←[36m2015-06-14t14:30:21.124977+00:00 app[web.1]:←[0m jun 14, 2015 2:30:21 pm org.apache.catalina.core.applicationcontext log ←[36m2015-06-14t14:30:21.084386+00:00 app[web.1]:←[0m info: no spring webapplicationinitializer types detected on classpath ←[36m2015-06-14t14:30:21.125377+00:00 app[web.1]:←[0m info: initializing spring root webapplicationcontext ←[36m2015-06-14t14:30:36.555192+00:00 app[web.1]:←[0m debug [localhost-startstop-1] startuplistener.contextinitialized(47) | initializing context... ←[36m2015-06-14t14:30:36.556130+00:00 app[web.1]:←[0m debug [localhost-startstop-1] startuplistener.contextinitialized(84) | password encoder: bcryptpasswordencoder ←[36m2015-06-14t14:30:36.658863+00:00 app[web.1]:←[0m jun 14, 2015 2:30:36 pm org.apache.catalina.core.standardcontext listenerstart ←[36m2015-06-14t14:30:36.659668+00:00 app[web.1]:←[0m org.springframework.transaction.cannotcreatetransactionexception: not open hibernate session transaction; nested exception org.hibernate.exception.genericjdbcexception: c  ←[36m2015-06-14t14:30:36.660282+00:00 app[web.1]:←[0m   @ org.springframework.transaction.support.abstractplatformtransactionmanager.gettransaction(abstractplatformtransactionmanager.java:373) ←[36m2015-06-14t14:30:36.661208+00:00 app[web.1]:←[0m   @ org.springframework.transaction.interceptor.transactionaspectsupport.invokewithintransaction(transactionaspectsupport.java:262) ←[36m2015-06-14t14:30:36.661799+00:00 app[web.1]:←[0m   @ org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:179) ←[36m2015-06-14t14:30:36.662348+00:00 app[web.1]:←[0m   @ org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:179) ←[36m2015-06-14t14:30:36.662761+00:00 app[web.1]:←[0m   @ com.sun.proxy.$proxy126.getallroles(unknown source) ←[36m2015-06-14t14:30:36.663245+00:00 app[web.1]:←[0m   @ com.isitnormal.webapp.listener.startuplistener.contextinitialized(startuplistener.java:89) ←[36m2015-06-14t14:30:36.663643+00:00 app[web.1]:←[0m   @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5492) ←[36m2015-06-14t14:30:36.663434+00:00 app[web.1]:←[0m   @ org.apache.catalina.core.standardcontext.listenerstart(standardcontext.java:4994) ←[36m2015-06-14t14:30:36.664073+00:00 app[web.1]:←[0m   @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1575) ←[36m2015-06-14t14:30:36.664524+00:00 app[web.1]:←[0m   @ java.util.concurrent.futuretask.run(futuretask.java:266) ←[36m2015-06-14t14:30:36.664705+00:00 app[web.1]:←[0m   @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) ←[36m2015-06-14t14:30:36.664920+00:00 app[web.1]:←[0m   @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) ←[36m2015-06-14t14:30:36.665040+00:00 app[web.1]:←[0m   @ java.lang.thread.run(thread.java:745) ←[36m2015-06-14t14:30:36.665279+00:00 app[web.1]:←[0m caused by: org.hibernate.exception.genericjdbcexception: not open connection ←[36m2015-06-14t14:30:36.665769+00:00 app[web.1]:←[0m   @ org.hibernate.engine.jdbc.spi.sqlexceptionhelper.convert(sqlexceptionhelper.java:126) ←[36m2015-06-14t14:30:36.666251+00:00 app[web.1]:←[0m   @ org.hibernate.engine.jdbc.internal.logicalconnectionimpl.obtainconnection(logicalconnectionimpl.java:235) ←[36m2015-06-14t14:30:36.666737+00:00 app[web.1]:←[0m   @ org.hibernate.internal.sessionimpl.connection(sessionimpl.java:450) ←[36m2015-06-14t14:30:36.667673+00:00 app[web.1]:←[0m   @ org.apache.commons.dbcp.basicdatasource.createconnectionfactory(basicdatasource.java:1429) ←[36m2015-06-14t14:30:36.668124+00:00 app[web.1]:←[0m   @ org.apache.commons.dbcp.basicdatasource.getconnection(basicdatasource.java:1044) ←[36m2015-06-14t14:30:36.668940+00:00 app[web.1]:←[0m   @ org.hibernate.internal.abstractsessionimpl$noncontextualjdbcconnectionaccess.obtainconnection(abstractsessionimpl.java:380) ←[36m2015-06-14t14:30:36.669947+00:00 app[web.1]:←[0m   @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1571) ←[36m2015-06-14t14:30:36.555875+00:00 app[web.1]:←[0m debug [localhost-startstop-1] startuplistener.contextinitialized(82) | remember me enabled? true ←[36m2015-06-14t14:43:25.025089+00:00 app[web.1]:←[0m jun 14, 2015 2:43:25 pm org.apache.catalina.loader.webappclassloader clearreferencesthreads ←[36m2015-06-14t14:43:25.042250+00:00 app[web.1]:←[0m info: starting protocolhandler ["http-nio-49034"] ←[33m2015-06-14t14:43:25.708538+00:00 heroku[router]:←[0m at=error code=h13 desc="connection closed without response" method=get path="/" host=iin.herokuapp.com request_id=f3e08c1f-6dbc-41a2-b3f8-4458acdcb759 fwd="193.135.254.174" dyno=w =10090ms status=503 bytes=0 ←[36m2015-06-14t14:43:26.819183+00:00 heroku[web.1]:←[0m state changed crashed ←[36m2015-06-14t14:43:26.806604+00:00 heroku[web.1]:←[0m process exited status 0 

also if try run localy with:

foreman start web 

i successful build app breaks:

17:11:11 web.1  | jun 14, 2015 5:11:11 pm org.apache.catalina.loader.webappclassloader clearreferencesjdbc 17:11:11 web.1  | severe: web application [] registered jdbc driver [com.mysql.jdbc.driver] failed unregister when web application stopped. prevent memory leak, jdbc driver has been forcibly unregistere 17:11:11 web.1  | jun 14, 2015 5:11:11 pm org.apache.catalina.loader.webappclassloader clearreferencesjdbc 17:11:11 web.1  | severe: web application [] registered jdbc driver [org.postgresql.driver] failed unregister when web application stopped. prevent memory leak, jdbc driver has been forcibly unregistere 17:11:11 web.1  | jun 14, 2015 5:11:11 pm org.apache.catalina.loader.webappclassloader clearreferencesthreads 17:11:11 web.1  | severe: web application [] appears have started thread named [abandoned connection cleanup thread] has failed stop it. create memory leak. 17:11:11 web.1  | jun 14, 2015 5:11:11 pm org.apache.coyote.abstractprotocol start 17:11:11 web.1  | info: starting protocolhandler ["http-nio-8080"] 17:11:11 web.1  | jun 14, 2015 5:11:11 pm org.apache.coyote.abstractprotocol pause 17:11:11 web.1  | info: pausing protocolhandler ["http-nio-8080"] 17:11:11 web.1  | exited code 0 17:11:11 system | sending sigkill processes 

i've used herokudatabaseconfiguration.java class jhipster , it's worked quite me.

https://github.com/kissaten/jhipster-example/blob/master/src/main/java/com/mycompany/myapp/config/herokudatabaseconfiguration.java


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -