Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

re: Problem with Connecting to MongoDb from Apache Tomcat7 server

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am having a problem of connecting to Mongo DB from Apache Tomcat 7 server; and since I am relatively new to Apache Tomcat Server, I wish to get your help. Thing worked fine in my Eclipe Luna development environment where I was able to connect to Mongo DB. I have the mongo jar file at my /ehcproj/WebContent/WEB-INF/lib/mongo-2.10.1.jar . Since everything worked fine, I exported the project war file to my Apache Tomcat 7's webapps folder. I then shut down and restarted Tomcat. However, I notice that my Tomcat 7 server did not connect to my Mongo DB. I do not know what 's wrong since it was working and connected when it was at my Eclipse Luna. I wonder what are the missing pieces? I read from google and someone suggested that I need to include the mongo db driver in my apache tomcat 7 server 's lib folder which I did but it still did not work. I wish to get your help if you could shed some light into what I need to do in order to make it works.
Many thanks,
Du
 
Saloon Keeper
Posts: 22289
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your webapp depends on any IDE, then your webapp is defective. There isn't going to be any IDE when it goes into production (not if there's any sanity in your shop, anyway!)

MongoDB has a JDBC driver and presumably that driver is rated to be used as a sharable server-supplied resource like (almost) all other JDBC drivers. But that's for SQL access to MongoDb, and I'm presuming you are doing native access. To the best of my knowledge, that particular set of services cannot be shared and therefore cannot be placed into TOMCAT_HOME/lib.

Webapp libraries should always be placed in the WAR's WEB-INF/lib directory.
 
Would you turn that thing down? I'm controlling a mind here! Look ... look at the tiny ad ...
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic