Bug 538327 - Included project jars are corrupted and rebuild as a war.
Summary: Included project jars are corrupted and rebuild as a war.
Status: NEW
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: jst.j2ee (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: jst.j2ee CLA
QA Contact: Carl Anderson CLA
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2018-08-28 04:00 EDT by Michael Nielsen CLA
Modified: 2022-08-30 10:15 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Nielsen CLA 2018-08-28 04:00:06 EDT
I have 3 projects, each of which can generate wars (tests of their libraries), but also generate pure jar files as libraries for other projects.

I have configured them so that they via maven generate a jar file - which are correctly formatted as a jar file, i.e. their contents have this format.

     0 Wed Aug 22 15:53:02 CEST 2018 META-INF/
   130 Wed Aug 22 15:53:00 CEST 2018 META-INF/MANIFEST.MF
     0 Wed Aug 22 15:47:22 CEST 2018 dk/
     0 Wed Aug 22 15:47:22 CEST 2018 dk/ttsh/
     0 Wed Aug 22 15:47:22 CEST 2018 dk/ttsh/servlet/
     0 Wed Aug 22 15:47:22 CEST 2018 dk/ttsh/servlet/ROOT/
     0 Wed Aug 22 15:47:22 CEST 2018 dk/ttsh/servlet/filters/
     0 Wed Aug 22 15:47:22 CEST 2018 dk/ttsh/servlet/mappers/

When including this jar file into the primary war project in eclipse, via maven, or directly via build path (external jar), or via user libraries.   The jar is apparently rebuilt internally as a war file, this means that as a jar it's structure is wrong and contains.

     0 Tue May 08 12:34:54 CEST 2018 META-INF/
    39 Tue May 08 12:34:54 CEST 2018 META-INF/MANIFEST.MF
     0 Tue May 08 12:34:54 CEST 2018 WEB-INF/
     0 Tue May 08 12:36:38 CEST 2018 WEB-INF/classes/
     0 Tue May 08 12:36:00 CEST 2018 WEB-INF/classes/dk/
     0 Tue May 08 12:36:00 CEST 2018 WEB-INF/classes/dk/ttsh/
     0 Tue May 08 12:41:38 CEST 2018 WEB-INF/classes/dk/ttsh/servlet/
     0 Tue May 08 12:36:00 CEST 2018 WEB-INF/classes/dk/ttsh/servlet/ROOT/
  1507 Fri Aug 24 09:04:26 CEST 2018 WEB-INF/classes/dk/ttsh/servlet/ROOT/RootStatus.class
     0 Tue May 08 12:42:44 CEST 2018 WEB-INF/classes/dk/ttsh/servlet/filters/

This of course means that the classes contained in the jar file cannot be found runtime, and the service fails.

Manually replacing the jar file with the correctly generated jar file in the tomcat directly, makes the service run as it should.

Searching the file system, the only versions of the library that can be found are correctly formatted jar files (which eclipse is told to include in the project), however what eclipse places in the "WEB-INF/lib/" in the tomcat installation, is the corrupted jar.

Building my war via maven (outside of eclipse) results in a working service, testing via eclipse results in a broken service.
Comment 1 Michael Nielsen CLA 2018-08-28 04:40:07 EDT
Same problem seems to exist in Eclipse 4.8.
Comment 2 Jay Arthanareeswaran CLA 2018-08-28 05:01:41 EDT
Moving to web tools
Comment 3 Simon Arame CLA 2022-06-23 20:32:56 EDT
Is the projects pom's "packaging" attribute correctly set to "jar" and not "war" ?