This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to create Beer-V1 war  RSS feed

 
satya mahapatra
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I am able to run the Beer-V1 application. But I want to create a Beer-V1 war file and deploy the same in tomcat.

Can anybody help in this.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A war file is nothing more than a zip file with a ".war" extension.

To do this with Java's jar command, cd to the root directory of your webapp and type:


This will create a war file named myApp.war in the root of your C drive.

To deploy in Tomcat, just move that war file to your webapps directory.
 
satya mahapatra
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ben,
Normally my application is workin fine. But when I created the war file and deployed the same in webapps of tomcat it sin't running. Do
I need to give any entries in any of the web.xml file. Or anywhere else I
need to change?

Thanks,
satya
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat looks for war in webapps folder.It its not able to deploy the web application then you would get exceptions in Tomcat log.What is tomcat log saying ?
You can even see in the following folder to check whether tomcat was able to unjar the war or not.

TOMCAT_HOME\work\Catalina\localhost
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First look to the logs in tomcat/logs to see what, if anything is going wrong.

In cases like this I like to stop Tomcat, delete all the log files in tomcat/logs, then start it up and try to deploy the app.

This way you won't have to sift through reams of old logging messages to find what's relevant.
 
satya mahapatra
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rahul/Ben,

Your guess is correct. Tomcat isn't able to unjar the war file. I checked at the location you specified. TOMCAT_HOME\work\Catalina\localhost.

Log File:

2007-05-03 17:54:40 StandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
2007-05-03 17:54:41 StandardContext[/jsp-examples]ContextListener: contextInitialized()
2007-05-03 17:54:41 StandardContext[/jsp-examples]SessionListener: contextInitialized()
2007-05-03 17:54:41 StandardContext[/servlets-examples]ContextListener: contextInitialized()
2007-05-03 17:54:41 StandardContext[/servlets-examples]SessionListener: contextInitialized()

I didn't get anything from this logo file. If you have any clues where I am going wrongthen please help.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!