Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

One War file with multiple webapps

 
Rahul Shivsharan
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First let me tell you what i am trying to achive.

I was reading Head First Servlet and JSP, there is an diagram which has a folder strtucture it is as follows,

Apache_Home
|_beerAdvice
| |_index.html
| |_WEB-INF
| |_web.xml
| |_classes
|_datingApp

In above folder struture we can see that there are two applications deployed on tomcat

This is what i'm trying to achive ,
what it did is i created two web application and bundled up in a single WAR file and deployed on JBOSS server
but it give an error on command promplt ie.

Let me tell you what i'v done

My WAR which is named "WebApp.war" contains Folders Struture like this (ie. once you click on *.war file and it opens in WinRar it looks like the following)

WebApp
|_AppOne
| |_WEB-INF
| |_lib
| |_classes
| | |_com
| | |_packageOne
| | |_FirstServlet.java
| |_web.xml
| |_jboss-web.xml
|_AppTwo
META-INF


or take it as

If you unzipe the war file you will see two web-apps
those are

WebApp/AppOne
WebApp/AppOne/WEB-INF
WebApp/AppOne/WEB-INF/lib
WebApp/AppOne/WEB-INF/web-xml
WebApp/AppOne/WEB-INF/jboss-web.xml
WebApp/AppOne/WEB-INF/classes
WebApp/AppOne/WEB-INF/classes/com/packageOne/FirstServlet


WebApp/AppTwo
WebApp/AppTwo/WEB-INF
WebApp/AppTwo/WEB-INF/lib
WebApp/AppTwo/WEB-INF/web.xml
WebApp/AppTwo/WEB-INF/jboss-web.xml
WebApp/AppTwo/WEB-INF/classes
WebApp/AppTwo/WEB-INF/classes/com/packageTwo/SecondServlet

META-INF



From above diagram you can see the the second we application "AppTwo" also has the same folder struture.

now let me give what it have written in jboss-web.xml and web.xml of AppOne






In second app its






now on my web browser in address i type



But it doesn't loads

So my doubts are
1> Can a war file can have multiple web applications as per the above tree.

2> If yes what should be the context-path , it should start from the folder name which on the top of the web applications which is in my case "WebApp"

can any body please help me out
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can a war file can have multiple web applications as per the above tree.

No.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
GoodBad S/N ratio.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic