Saturday, 31 August 2013

Deploying a Java EE webapp on ec2 instance

Deploying a Java EE webapp on ec2 instance

I am writing a web app (Java/PostgreSQL) that works fine on my local host
but when I attempt to deploy it on an Amazon ec2 instance I start running
into trouble.
I set up my postgreSQL database on my ec2 instance and reconfigured the
webapp running on my local host to use the cloud db. So far so good.
When I deploy the war on the ec2 instance and try to get the app running I
get a java.lang.NullPointerException. Now initial troubleshooting seems to
suggest that my database query is at fault. which suggests a permission
issue, but my _hba.conf files are wide open.
My question is, why would it be working fine on the localhost accessing
the db but not when it is sitting on the same host?
What am I missing and how should I go about resolving this issue.
Completely Stumped
Ok - so it works with the eclipse JVM, not my tomcat install on localhost.
Below is the stack trace. Failing because ps =
conn.prepareStatement(query) is null
enter code here
SEVERE: Servlet.service() for servlet [AddToEmailListServlet] in context
with path [/Test_e] threw exception
java.lang.NullPointerException
at data.UserDB.insert(UserDB.java:51)
at email.AddToEmailListServlet.doPost(AddToEmailListServlet.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Aug 31, 2013 5:48:15 PM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
Aug 31, 2013 5:48:16 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
Aug 31, 2013 5:48:16 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()

No comments:

Post a Comment