I purchased Murach's "Java Servlets and JSP," which comes with downloadable code to help in the learning process. Clearly, Murach used a PC to develop all of the code he describes in his book;however, I am working on a MAC Pro.
He has a war file for one of his applications, which I tried deploying on my MAC by dropping it into the webapps directory of my Tomcat Installation while Tomcat was running. When you do this on the PC, the application is automatically deployed. However, on the MAC nothing happened.
Is there a difference in WAR files created for a PC from those create for a MAC? Is anyone here working on a MAC? If so, can they descirbe what I need to do special to deploy this application?
First, a bit of business: you may not have read our naming policy on the way in. It requires that you use a full, real (sounding) first and last name for your display name. "Handles" aren't acceptable at the Ranch. You can change your display name here. Thanks!
As for your question: works exactly the same on a Mac. Are you sure Tomcat is running?
Yes, I'm sure Tomcat is running. I've pulled up the welcome page.
Perhaps I just don't know the particulars with respect to a MAC. Are you familiar with the MAC?
I placed the Tomcat directory in ~/Library/Tomcat/apache-tomcat-6.0.16 I created a link ~/Library/Tomcat/Home -> ~/Library/Tomcat/apache-tomcat-6.0.16 I started Tomcat by running ~/Library/Tomcat/Home/bin/startup.sh I then moved application.war into ~/Library/Tomcat/Home/webapps
The file showed up there but nothing happened. It wasn't deployed. I'm also trying to setup myEclipse and I'm having a similar problem running a project. I've setup Tomcat in myEclipse and I'm able to start and stop Tomcat from myEclipse. When I select my project, right click and select Run As... and then select the Tomcat server, the server starts up, but the project is NOT deployed into webapps.
Obviously, I'm doing something wrong or I don't have all of the pieces installed on my system. I installed the Developer tools from the Mac OS X installation CD; however, I've been unable to find a JDK directory. All I'm able to find is references to several versions of JVMs. The instructions said if a JDK was not selected for the Tomcat server and exception would result. That didn't happen, so I'm wondering if the JDK is in the JVM, which seems kind of strange.
author and iconoclast
On a Mac, your JDK home directory is /Library/Java/Home (a symlink maintained by the Java control panel thingy). You ought to see /Library/Java/Home/bin/javac, for example.
As far as your WAR file issues: check in webapps to see if the WAR file is at least being unpacked (delete any unpacked directory, hit the URL, check to see if the directory has appeared); maybe it's being unpacked but not working out for some reason. Check TOMCAT/log/catalina.log for any indication that the server is at least trying to deploy the WAR file.
Since nothing in this thread has anything to do with "beginning Java", the topic of this forum, I'm going to move this thread to our Tomcat forum, where we can continue (follow the link above).
Originally posted by Steve Sherwood: Thanks for the help. I checked the unpackWars attribute and it was set to true.
What about autoDeploy?
Do I need to set a CATALINA_HOME environment variable?
No, that's set by the startup script.
What version of Tomcat and how are you starting it?
Joined: Jun 01, 2008
I downloaded apache-tomcat-6.0.16.
I put that directory on the Mac at ~/Library/Tomcat/apache-tomcat-6.0.16 I created a link ~/Library/Tomcat/Home -> ~/Library/Tomcat/apache-tomcat-6.0.16 I was starting tomcat using myEclipse, and that was the problem. I don't have something configured correctly in myEclipse.
When I started tomcat directly via ~/Library/Tomcat/Home/bin/startup.sh, the WAR file unpacked and deployed flawlessly.
Thanks for all your help. Now, on to debugging my eclipse installation.
"Tks"? Please use real words when posting to the forums. Abbreviations such as "tks" in place of "thanks" only serve to make your posts more difficult to read and less likely to generate useful responses.