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 171565 - provide option to exclude libraries from generated WAR files
Summary: provide option to exclude libraries from generated WAR files
Status: RESOLVED INVALID
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Infrastructure (show other bugs)
Version: 6.x
Hardware: Macintosh All
: P3 blocker (vote)
Assignee: Petr Hejl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-06 08:07 UTC by rasputnik
Modified: 2009-09-07 11:31 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rasputnik 2009-09-06 08:07:16 UTC
I built a webapp that uses JNDI to lookup JavaMail.

I was getting ClassCastExceptions trying to retreive a mail Session from JNDI, which turned out to be because NetBeans bundled mail.war
in the WAR lib/ (which causes classloader issues when getting a Session that was configured up in Tomcat itself).

Context initCtx = new InitialContext();
        Context envCtx = (Context) initCtx.lookup("java:comp/env");
        Object o = envCtx.lookup("mail/Session"); 
        // the debugger verifies that 'o' holds a javamail Session, but
        // but the next line raises a ClassCastException
        sendMailSession = (Session) o;

My workaround currently is to edit nbproject/build.xml and remove the <copyfiles> element from the 'library-inclusion-in-archive' target.

I couldn't find a knob in the GUI to enable this behaviour, so each time I change project properties I have to re-edit the file.

I may well be doing something wrong, but it'd be good to be able to have this enabled in the UI as an option.
Comment 1 rasputnik 2009-09-07 11:31:00 UTC
My bad, just found the 'Package' checkbox next to the JAR in project properties.