This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 174708 - App client project not setting/preserving Class-Path element of MANIFEST.MF
Summary: App client project not setting/preserving Class-Path element of MANIFEST.MF
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: App Client (show other bugs)
Version: 6.x
Hardware: All Windows XP
: P3 blocker (vote)
Assignee: David Konecny
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-16 02:44 UTC by ievans
Modified: 2009-11-12 20:40 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Zip file of cart project. (51.77 KB, application/octet-stream)
2009-10-16 02:45 UTC, ievans
Details
Log file (140.64 KB, text/plain)
2009-10-16 02:46 UTC, ievans
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ievans 2009-10-16 02:44:15 UTC
For the following EAR project:
cart
 cart-app-client
 cart-ejb

running the project fails with a NoClassFoundException because the EJB JAR included in the EAR project wasn't retrieved
after deployment. In Java EE 6, the Class-Path element of the app client's MANIFEST.MF must specify the other modules.
In this case, cart-app-client's MANIFEST.MF is:
Manifest-Version: 1.0
Main-Class: cart.client.CartClient
Class-Path: cart-ejb.jar

This MANIFEST.MF file is overwritten when building, deploying, and running the EAR. Using directory deployment, this is
the dist/gfdeploy/cart/cart-app-client_jar/META-INF/MANIFEST.MF:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 14.2-b01 (Sun Microsystems Inc.)
Main-Class: cart.client.CartClient

Note that the Class-Path element has been removed. Therefore, cart-ejb.jar is not retrieved when running the project.
Here's the contents of dist/cartClient:
ilford:cart $ ls dist/cartClient
cart-app-client.jar  cart-app-clientClient.jar  cartClient.jar
Comment 1 ievans 2009-10-16 02:45:09 UTC
Created attachment 89582 [details]
Zip file of cart project.
Comment 2 ievans 2009-10-16 02:46:38 UTC
Created attachment 89583 [details]
Log file
Comment 3 Vince Kraemer 2009-10-16 04:37:26 UTC
It looks like this change might be contributing to this problem...

http://hg.netbeans.org/main-golden/diff/5261ee988aba/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/resources/build-impl.xsl

The change at 1.27/1.28 in this diff seems to be the culprit...

I think that the changes that fixed 163971 and 173195 might have been too much...
Comment 4 David Konecny 2009-10-16 05:01:08 UTC
1bac66b7e368
OK, I reverted my previous change in build-impl.xsl as it does not make any sense for AppClient (change was relevant
only for WAR and EJB). This is more of a hotfix rather then proper resolution.

One thing which still does not work for me is this: create AppClient and add some Java Class Library project and use
this Java project from AppClient and then try to deploy AppClient - I always get java.lang.NoClassDefFoundError for any
class from Java Class Library project despite that JAR being available in EAR's root and despite it being correctly
referenced via ClassPath entry in AppClient's manifest. Any hint what's wrong in this case Vince?
Comment 5 Vince Kraemer 2009-10-16 05:42:30 UTC
start by looking at the content of the domains/domain1/generated/xml/<appname>/<appclientname>... after you use nb to
deploy the app.

compare the content of that directory (actually.. you may want to look at the content of
domains/domain1/generated/xml/<appname>) with the content of that directory after doing a directory deployment of the
project with asadmin...

I can dig into it in more detail on Tuesday.
Comment 6 Quality Engineering 2009-10-17 11:24:12 UTC
Integrated into 'main-golden', will be available in build *200910170201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/1bac66b7e368
User: David Konecny <dkonecny@netbeans.org>
Log: #174708 - partial fix to improve current state; proper fix TBD
Comment 7 David Konecny 2009-10-19 04:24:30 UTC
This is content of my EAR archive I created in NB (after some build script changes):

* /lib/entities.jar - Java Class Project defining Address JPA entity

* /ejbs.jar - EJB project providing AddressFacade stateless session bean for accessing Address JPA entity (let's say it
has single method "List<Address> findAll()")

* /appclient.jar - AppClient project which is using AddressFacade EJB

Now, in this case what do you expect to be in manifest file for appclient.jar? "EE.8.3.3 chapter of EE6 spec" says that
"Components in the application client container must have access to the following classes and resources: The transitive
closure of any libraries specified by or referenced by the containing ear file" - I interpret it that appclient.jar will
have automatically access to /lib/entities.jar (jar is in EAR's lib folder). So I changed ClassPath manifest entry in
appclient.jar to conctain only ejbs.jar but I'm still getting NoClassDefFoundError exception. Adding entities.jar to
ClassPath manifest entry does not help either. So how should I package my appclient?
Comment 8 ievans 2009-10-19 22:14:16 UTC
What happens if you change appclient.jar's MANIFEST.MF to the following?
Class-Path: ejbs.jar lib/entities.jar
Comment 9 David Konecny 2009-10-19 22:24:16 UTC
I tried "Class-Path: ejbs.jar lib/entities.jar" and also "Class-Path: ejbs.jar entities.jar" but none seems to work -
result is always NoClassDefFoundError exception.
Comment 10 David Konecny 2009-10-21 04:31:34 UTC
I need an advice from GF team on this one, so I filed https://glassfish.dev.java.net/nonav/issues/show_bug.cgi?id=10458
Comment 11 David Konecny 2009-10-22 21:48:14 UTC
It was acknowledged as GF issue and there should be no problem on NB side. I'm waiting for GF issue to get resolved
before closing this one.
Comment 12 David Konecny 2009-11-04 22:27:21 UTC
This has been resolved but I'm waiting for https://glassfish.dev.java.net/nonav/issues/show_bug.cgi?id=10458 to get
resolved before I can verify it. Till then AppClient start does not work.
Comment 13 David Konecny 2009-11-12 20:40:15 UTC
I pushed back my original changes (90a104a53e7d) which should be OK and filed bug 176742 for Vince as sometimes deployment fails from IDE.