I need to add search functionality to my Java webapp running on tomcat, along with the database as well on the same machine.
Since I\'m planning to use Solr on this
The page you reference answers your question. You run Solr on the same machine in its own JVM, as a service, and interact with it over HTTP (to localhost).