aspose file tools*
The moose likes Tomcat and the fly likes Deploying a WAR file on MAC OS X Leopard Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Deploying a WAR file on MAC OS X Leopard" Watch "Deploying a WAR file on MAC OS X Leopard" New topic
Author

Deploying a WAR file on MAC OS X Leopard

Steve Sherwood
Greenhorn

Joined: Jun 01, 2008
Posts: 10
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?

Thanks
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24168
    
  30

Hi,

Welcome to JavaRanch!

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?


[Jess in Action][AskingGoodQuestions]
Steve Sherwood
Greenhorn

Joined: Jun 01, 2008
Posts: 10
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.

Totally confused:
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24168
    
  30

Thanks, but first and last name, please.

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).
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60077
    
  65

Sure, there are a whole bunch of us working on Macs ("Mac" not "MAC").

There is no difference between format of war files across platforms. First thing to check is make sure that your Tomcat installation is configured to auto-deploy the wars.

Here's a snippet from my server.xml:


Check that unpackWARs is set to true.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Steve Sherwood
Greenhorn

Joined: Jun 01, 2008
Posts: 10
Thanks for the help. I checked the unpackWars attribute and it was set to true.

There is no ~/Tomcat/Home/logs/catalina.log, which also seems strange. I'm wondering if I'm looking in the wrong location.

Do I need to set a CATALINA_HOME environment variable?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60077
    
  65

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?
Steve Sherwood
Greenhorn

Joined: Jun 01, 2008
Posts: 10
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.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60077
    
  65

Very cool. Eclipse help is available in the IDEs forum if you need it.
Leonardo Lira
Greenhorn

Joined: Jul 16, 2008
Posts: 1
Is it possible deploy a .WAR file without Tomcat? Just using Mac OS?
Tks!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60077
    
  65

Originally posted by Leonardo Lira:
Tks!

"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.

Please read this for more information.

thanks,
bear
JavaRanch sheriff
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60077
    
  65

Originally posted by Leonardo Lira:
Is it possible deploy a .WAR file without Tomcat? Just using Mac OS?

What would run the servlets and JSP then? You need a servlet container to host the web application. It doesn't necessarily have to be Tomcat, but you need something.
 
 
subject: Deploying a WAR file on MAC OS X Leopard
 
Similar Threads
JDK and Lion
tomcat 6 WAR deployment
How to use value of variable dynamically rather than hard coding...
requested resource() not found for simple HTML?
Loading custom application config files