Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

War file dependent on another war file

Posted on 2004-08-16
18
Medium Priority
?
478 Views
Last Modified: 2011-09-20
Is there a possibility to include a war file in another war file, ie the manifest file?

cheers
0
Comment
Question by:oysteinpettersen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 7
  • 3
18 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 150 total points
ID: 11809698
That's really not desirable - war files are designed to be distinct and isolated. What exactly are you trying to do?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 11809708
If you just need libraries, then the libraries from war A should be packaged into war B. You can't include a reference in war B to war A
0
 

Author Comment

by:oysteinpettersen
ID: 11810864
I have a set of JSP that are common to more than one war application. Was hoping there was a better way to package this, than duplicate these common jsp's in all of the war applications.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 35

Expert Comment

by:girionis
ID: 11810953
Why don't you have a common folder that is accessible from all the web apps and you do not have to duplicate all the files over all the web applications? You can do this by packaging everything in a zip file and then, after unzipping, deploy the war file. The common JSP pages will already be where they should eb and the deployment of the war file should not have any affect on them.
0
 

Author Comment

by:oysteinpettersen
ID: 11811049
How excatly would this be done with precompilation of the jsp. Please elaborate on the location of the common folder and why you would need to use a zip file. I am using JBoss 3.2.3.

Cheers
0
 
LVL 35

Expert Comment

by:girionis
ID: 11811136
You do not need to precompile the JSP files, the servlet engine will take care of it, you just need to put them in a folder that is accessible and visible by all other web applications.

Put everything in a zip file, in a structure like

myfolder--
       common---
            A.jsp
            B.jsp
            C.jsp
       warfile1.war
       warfile2.war

and then deploy the war files. Make sure they can see the myfolder/common directory.
       
0
 

Author Comment

by:oysteinpettersen
ID: 11817869
How do you make sure they can see the myfolder/common directory? Is this the virtual mapping in the web.xml file? Still unsure why we would need to pack everything in a zip file.....

Cheers
0
 
LVL 35

Expert Comment

by:girionis
ID: 11817919
You need to pack everything in a zip file because you have to force a specific directory structure.

The myfolder/common could as well be another web application. Then you just do an HTTP request to it by using relative paths (e.g. <a href="../myfolder/common/A.jsp">A.jsp</a>) and so on. It all depends on how you read/execute these JSP file.
0
 

Author Comment

by:oysteinpettersen
ID: 11818243
I take it this all needs to be packed in a ear file?
0
 
LVL 35

Expert Comment

by:girionis
ID: 11818301
No. A zip file would be enough. Then after you unzip the zip file you deploy each war file separately.
0
 

Author Comment

by:oysteinpettersen
ID: 11818849
The problem with this solution is that as we are using struts we want to specify the jsp forward pages in the struts-config.xml file. This can only refrence jsp inside that war. If we use the struts redirect option we lose all request data. Might have to revert to the old solution of copy in all common jsp at war build time.
0
 
LVL 35

Expert Comment

by:girionis
ID: 11818894
> The problem with this solution is that as we are using struts we want to specify the jsp forward
> pages in the struts-config.xml file. This can only refrence jsp inside that war.

I thought you could reference pages anywhere in the web application folders. Anyway, if you think it cannot be done then the only solution I guess is to copy everything in the war file.
0
 

Author Comment

by:oysteinpettersen
ID: 11819326
Have seen some attempts to stick this common files in a common folder in the ear and specifiy this is the war manifest files. There was no indication that this had worked. Will keep looking, but for now I have to copy all the common jsp files to all the war files. The static js, html and pictures can be in a common web application.

I still think there should be a more elegant way of doing this....... will keep looking.

Cheers
0
 
LVL 35

Expert Comment

by:girionis
ID: 11819401
If you find a way please let us know also as I am curious if/how this can be done.
0
 

Author Comment

by:oysteinpettersen
ID: 11820363
No problem, will do.
0
 

Author Comment

by:oysteinpettersen
ID: 11905691
Ok my findings are.....

In order to have a common place for jsp files shared among diffrent war, one solution is to Precompile the jsp using ant and the jspc tag. Pack the compiled jsp files in a jar, and place the generated web xml mappings in a file of some kind. The jar can then be placed in the ear file accessable for all war files. Now when you pack your wars you need to include the generated web xml mappings from the common section in each web.xml for each war.

This is the best idea that I could come up with, but becase you have to include all the mappings in the web xml for each war you would need to compile all the war if you introduced a new common jsp or changed the name of a current one.

I my case we sat down and looked at all the seprate wars and concluded that one of our wars are isolated and complete. The application that they together create needs all of them to function properly. Therefore we are going to merge them all into one "isolated and complete" war. This will for the time being eliminate our need to share common jsp files. Nevertheless we know that the next project in the pipe line will / can use many of the jsp from the current project so we will be faced with this issue again (if they run on the same box).

It looks to me that this is something that was not connsidered a good idea when I came to wars. Looks like the way to do it is to pack each of them with all
the files they need even if it creates duplication files in runtime stage.

So that is it really......... thanks for endulging in this discussion.  
0
 
LVL 35

Expert Comment

by:girionis
ID: 11907111
Nice :)

Please if you feel you have been helped accept an answer/split points, otherwise ask a question to community support for zero points to PAQ thsi quesiton and refund the points back to you:

http://www.experts-exchange.com/Community_Support/
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 11911509
:-)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question