I am deploying my first Java web application on GoDaddy. Reading their documentation, it states a Tomcat redeploy occurs every morning at around 1:00 am. I thought I could get around waiting for this by moving up the compiled class files to the WEB-INF/classes directory.
Thinking about this made me realize I am not 100% sure how deploying code works. Tomcat is my servlet container which means it handles the HTTP requests it receives and then displays the appreciate content based on the web.xml settings. With this understanding, I am not sure what the deploy does. Since I manually moved the classes files and Tomcat did not have to take a .WAR file and build the directory, is that the deploy?
Do you think I need to wait for the redeploy even though I FTPd the class files?
Also, if I FTP the web.xml file to Tomcat, do I need a redploy? I am guessing I do but to be 100% honest, I am not sure why.
Thanks in advance for your time and knowledge.
I could be completely wrong but I think that deploy means that the your class files will be compiled. So in your case at around 1 AM all of your Java code is compiled which probably means it's best to have a local dev environment to compile whenever you please and when you're satisfied with the changes upload your files via FTP.
Thank you for the response.
I am not sure I completely agree with your response. After thinking more about what occurs when an application is deployed, maybe you can fill in my gaps.
Tomcat is the servlet container which runs the JVM instance. I was able to compile my code with Java 5 and Java 6 and both executed properly on the same Tomcat instance (v5.5) locally. What this tells me is that Tomcat does not contain any specific Java dependencies (which are what I would expect since Java runs in a JVM).
Tomcat does need the web.xml to tell it how to direct the servlet requests it receives. So I can understand a redeploy is needed if I change the web.xml.
What this also tells me is that Tomcat needs the code compiled before it can deploy the code, so Tomcat is not compiling any code.
With this said and please correct me if I have misstated anything, I am not sure why I can not FTP a compiled .class file and a JSP file and have it execute right away (not wait for the redeploy).
This is the first time I have worked on a shared hosting account for a Java application so maybe this is why things are not really making sense to me.
I have successfully FTPd a .class file, .JSP file and the web.xml to the GoDaddy Linux server running Tomcat. But nothing works until after the redeploy at 1:00 am. I tested this on my local machine and I am able to put new .JSPs in Tomcat without redeploying so I am not sure why it does not work on GoDaddy’s server running Tomcat.
Sounds like it's just a caveat when using shared hosting. You might want to give GoDaddy a call and see if you can find a solution. If they say that it's just the way it works, then I'd suggest looking at some dedicated server solution.
I agree with you about a dedicated server but the cost is much higher and we are in the initial steps of the project.
As for calling GoDaddy, they are very nice and they try to help but there Servlet hosting knowledge is not the greatest. Since I did not think I needed to wait for the redeploy to display a new JSP page (since I do not have to wait locally), the help desk person said I had a scripting issue. Then when I told him that I did not have any scripting in the file, since it was basically an HTML file that I renamed to a JSP, he told me to try FTP. I said, I am sorry, the file is already on the server and his response was… I know, you need to try FTP… basically, it did not make sense. After the call, I went to bed and checked in the morning and now the JSP page displays. So for GoDaddy’s shared hosting, even JSP changes need to wait for the redeploy.
Basically, all of this lead me to question my understanding of what a redeploy does for Tomcat.
Not really certain. We do have a few tomcat apps here, and every time the devs make some change they have us recycle it. So, perhaps, they are just saying they restart tomcat every night.
I hope you got your answer to this question, but either way, for posterity:
If you upload your class files, JSP, web.xml, and everything else your app requires, theoretically, it should work, but it won't until the 1AM redeploy. That's because tomcat loads your servlets when they are first run, or compiles servlets from your JSP, and those are not replaced with new versions until tomcat is restarted, or your application is reloaded. Since GoDaddy does this once a day, at 1 AM, you will still be accessing the old files until the 'redeploy.'