views:

615

answers:

1

I have installed and configured tomcat+solr on my personal linux machine and windows as well. I was able to get them working fine. I'm very new to Java and how the file structure works. (i.e. knowing where to put war files and what WEB-INF is) So now that I am ready to install solr and configure it on my clients shared hosting plan, the directions are different from what I did before. I dont want to mess this up and apparently the webserver reboots daily and I dont think I can do it manually which means I have one shot at this every day.

Here is the directions for installing a tomcat servlet on his hosting provider: http://www.apluskb.com/scripts/Where_do_I_put_my_answer1186.html

As you can see I need to install solr under the html/WEB-INF directory, but read what it says.. its very confusing:

"All Servlets should be uploaded in the /html/WEB-INF/classes directory. Any unpacked custom classes and resources should be uploaded in the /html/WEB-INF/classes directory, while classes and resources packed in Jar files should be uploaded to /html/WEB-INF/lib."

uhh... so which is it? /classes? or /lib? I dont think they explain that very well and I'm a little confused by this statement. Also what exactly do I install? With a normal solr install, solr is put somewhere else, the war file is copied into tomcat and the rest of solr is referenced using some kind of XML configuration file.

Also, since I'm a little new to Java and servlets, can someone explain the tomcat file structure to me (in great detail will definitely get you a +1 from me) and where things should go and why?

Thanks in advance!

+2  A: 

Web application structure is defined by J2EE spec, it's not limited (or specific) to Tomcat per se. Here is a detailed tutorial covering its layout. Briefly, however, it's as follows:

  1. There a base (root, home, whatever you want to call it) folder which serves as root of web application, everything else goes under it.
  2. All public stuff (html, images, CSS, javascript, JSP, what have you) goes under that folder (directly or via subfolders).
  3. There's one special folder, also located directly under root, called WEB-INF. It contains non-public stuff, like application descriptor (web.xml), classes (which go into WEB-INF/classes folder), libraries (WEB-INF/lib) and possibly configuration files.
  4. Application can be deployed either using expanded structure above or as WAR (web archive) which is basically an archive containing everything above starting at root folder level (but not including root).

The distinction between classes and lib folders is simple: all packaged libraries (JAR files) need to go into lib; all unpackaged classes (and resource files that need to be in classpath) have to go into classes preserving their directory structure (e.g. com.mypackage.Blah class should go into classes/com/mypackage/)

In your case, it looks like you can only have one web application deployed and it has to be deployed to /html folder. If you're deploying a war file, you need to extract it to that directory (e.g. from within that /html folder run jar xvf solr.war or whatever it's called).

ChssPly76
This is a great answer, thanks! I might ask a follow up question and I'll post a link here and you answer it I will give you the points.
DJTripleThreat
That's hilarious. I'm not THAT much of a reputation whore :-) But I'll certainly take a look at your question if / when you post it.
ChssPly76
Ha. Well I consider it commission or a tip when someone gives you good service. However, it wont matter because I convinced my client to get a dedicated server because he'll need one anyway, so I won't be subject to the restrictions that the hosting provider put on me originally. Thanks again.
DJTripleThreat