views:

24

answers:

1

I have the code for a web application that's supposed to be set up in Tomcat, on my company's server. I work on this server by SSHing into it.

So I am in NetBeans 6.8 on Ubuntu 10.04, setting up a Java Web->New Web Project with Existing Sources. I can copy the code from the server onto my desktop when it asks for the location of the source files, but when it comes to Server and Settings, the server doesn't exist on my computer and I can't enter the SSH details to access it that way.

Our sysadmin is currently setting up a different copy of tomcat6 on my workstation, but I don't know if this is sufficient. I understand there are surely easier ways of doing this (as I learn more about shell scripts I presume they will become apparent), but would it work to have the WAR created from the source files on my workstation, and then copy everything back to the tomcat6/webapps folder on the server?

An associated question is, with the WAR on the server's HD, what else needs to be there? Does it encapsulate all the JSP and HTML files, or does it simply replace the WEB-INF folder?

A: 

It seems you are in quite a predicament. I will try to provide you with some explanations that might take you further into resolving the situation.

First of all you need some details into the inner workings of a web application from the server's stand point. To work properly, the first thing you must assure is the structure of the app. See the following page for what the directory structure must be.

Now, applications reside in the webapps folder of your Tomcat server, with a folder for each application, each folder containing the structure that was described in the above link.

If you place your application folder in there, after you start your server the app should be available (assuming proper folder structure and that no errors happen when you start it (I'll get to that later on)).

The WAR file is an archive of such an application folder, it's a ZIP format so you can look into it and see that it has the same structure as the application folder and contains all your app needs. It is an easy way to deploy your app (since you deal with just one file).

You place the WAR file in the webapps folder and start your server and it will automatically be exploded into the application folder.

If everything is OK, your app should be running, if not you get exceptions which are written to the server's console or log files (are you getting errors?) and your app is not started. Also, it might start but fail later when running (again look for console messages/log files).

I'm not really sure I understand this other question of yours, but Tomcat isn't compiling anything, you have to provide it with binaries (.class or .jar files), it won't compile your project if you provide it with the source files. There is an exception to this rules which involves JSP files which are translated to Java Servlet files and then compiled and run, but that is it, it won't touch your source code.

Hope this provides you with some useful info. If you need help, post again on SO providing more detailed data of what happens (stacktraces, log file content are very usefull) and people will guide you.

Best of luck to you!

P.S. I re-tagged your question to attract more users to it (8 views in 18 hours ain't much).

dpb
Tomcat compiles JSP files.
Thorbjørn Ravn Andersen
@Thorbjørn Ravn Andersen: that's what I said also: There is an exception to this rules which involves JSP files which are translated to Java Servlet files and then compiled and run
dpb