Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

postgresql conection refuse through war file.

 
sarojni agrwal
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I write this command (java -jar MedoolPatientServices-1.0.war postgres 'postgres3' @ 'localhost'
) on terminal, but it gives error,basically , in my application, i compiled my code through maven with command line(mvn clean -X package) and then after write (java -jar MedoolPatientServices-1.0.war postgres 'postgres3' @ 'localhost') this command , but it gives error.
 
Dave Tolls
Ranch Hand
Posts: 2103
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What error are you getting.
Include any stack trace, and the relevant code.
 
Tim Holloway
Saloon Keeper
Posts: 18365
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Either you are very confused about how Java works or there's a lot of missing information here.

You are attempting to execute a WAR file via the stand-alone Java "-jar" option. WAR files are designed to be handled by a web application container, not run stand-alone.

Furthermore, any application complex enough to need a JDBC driver requires extra build options. Because that ups the module count from one (executable JAR) to at least 2, unless you unpack the JDBC driver jar and pour its contents into the application JAR (which isn't recommended).

As a final note, a true WAR shouldn't be directly requesting database connections at all. Because the application container's JDBC Connection Pool resources can usually do the job more efficiently.

Is this question related to the one you asked in the Tomcat forum (http://www.coderanch.com/t/667059/Tomcat/Migration-java-tomcat-postgre-ubuntu ?)
 
Dave Tolls
Ranch Hand
Posts: 2103
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, I didn't even notice it was a .war file...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic