aspose file tools*
The moose likes Servlets and the fly likes One War file with multiple webapps Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "One War file with multiple webapps" Watch "One War file with multiple webapps" New topic
Author

One War file with multiple webapps

Rahul Shivsharan
Ranch Hand

Joined: Jun 17, 2009
Posts: 83
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
Marshal

Joined: Mar 22, 2005
Posts: 41524
    
  53
Can a war file can have multiple web applications as per the above tree.

No.


Ping & DNS - my free Android networking tools app
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

GoodBad S/N ratio.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: One War file with multiple webapps