Gaurav M.
Gaurav M.

Reputation: 21

why .ear and .war folder are created for installed application on WebSphere?

I am installing a application(.war file) using wsadmin tool and I am using option

-installed.ear.destination, [target folder]

to installed application in target folder.

But after application is installed, final folder structure for my web contents is like

[target folder]/testapp.ear/testapp.war/[my contents]

why this .ear and .war folders are created and how can I install application so that [my contents] are present in [target folder] ??

Upvotes: 0

Views: 1462

Answers (3)

Thomas Bitonti
Thomas Bitonti

Reputation: 1234

That is the a part of the architecture of application deployment for IBM WebSphere Application Server.

As a part of application deployment, the application server places application files in a structure which is convenient for running the application. That means having easy access to all modules, and means having easy access to files in web modules.

In the case of EJB JAR files, there is no additional layering in the file structure: All elements of an EJB JAR file are accessible through the JAR/ZIP API which is provided by Java. There is a need to unpackage each EJB JAR file of an application, but there is no need to unpackage elements within the EJB JAR files.

In the case of WAR files, there is an additional layering of JAR files within the WEB-INF/lib folder. Access to those web module library JARs requires placement of the JAR files as exposed files.

Also, certain resources of WAR files are exposed in the file set for easy access from code areas which are not setup to handle JAR files. Most prominently, JSP files are exposed on disk so that the JSP compiler has easy access to them.

The net result is that the files of a deployed application expand two layers of the application structure: The EAR file itself is expanded, and WAR files within the EAR are expanded. JAR type files (EJB JARs, application library JARs, application client JARs, and simple utility JARs packaged within the EAR but not in the application library folder) are not expanded.

There is a possibility of building a more sophisticated API for accessing nested archive files (JAR files within JAR files, or, more or less the same, ZIP files within ZIP files), which treats the nested contents of an application as an extension of the file system. There are two problems with this sort of strategy. Either, nested archives must be expanded to temporary locations on demand, or, nested archives must be stored in non-compressed format in the nesting archives. These two steps are necessary because the ZIP file format does not support seeks on archives which are stored within other archives, where the archives are allowed to use compression on the nested archive. Because two levels of compression are performed, a seek is possible on the nested archive without removing the level compression on the nested archive.

Tooling can be set to prevent compression when storing a nested archive, but this is not typically done. And, archives usually have enough regularity that the default ZIP storage algorithm automatically uses compression when storing nested archives. The most common case is for nested archives to be provided for deployment having two levels compression.

Upvotes: 0

Thomas Bitonti
Thomas Bitonti

Reputation: 1234

The following does suggest itself:

Rename the target application to the target folder name.
Set the target folder name to the parent of the target folder.

For example:

Original target folder: /appsDir/appContent
Original application name: testapp.ear

Modified target folder: /appsDir
Modified application name: appContent.ear

That will get you closer, although, there is still the issue of the file extension on the application archive.

Thomas Bitonti

Upvotes: 0

Alasdair
Alasdair

Reputation: 3176

WebSphere Application Server traditional only runs ear files. So when you install a .war file via the admin console or wsadmin it wraps it in an ear file so it can process it at runtime.

Upvotes: 5

Related Questions