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 228520 - j2ee.server.home lost after adding server library and OKing project properties
Summary: j2ee.server.home lost after adding server library and OKing project properties
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Web Project (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: David Konecny
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-12 15:12 UTC by t_gergely
Modified: 2013-05-01 01:52 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description t_gergely 2013-04-12 15:12:46 UTC
I have Glassfish Server 3+ (glassfish-3.1.2.2-ml) as the only installed server in NetBeans 7.3.

Here's the testcase.
0. Make sure you have a "Server Library" in Tools/Ant Libraries.
1. Create a new project (WebApplication1) of type "Web Application".
2. Add a "Server Library" to the project in the Project panel.
3. Add a new servlet (NewServlet) with the "New" local menu to the <default package>.
So far so good. The project can be build.

4. Open project properties and press OK.
This will delete j2ee.server.home from private properties and all its references from project.properties. The project is now broken and can't be build (eg. "error: package javax.servlet does not exist"). :(
Comment 1 David Konecny 2013-04-15 01:47:03 UTC
I cannot reproduce this because I do not have "Server Library". I tried it on fresh installation of NB 7.3 and the library is not there. I think it must be some remnant from older versions of NB. What do you need the library for?
Comment 2 t_gergely 2013-04-15 12:04:13 UTC
(In reply to comment #1)

Then you could add a Server Library:
in Ant Library manager, press "New Library..." button, then select "Library Type" "Server Libraries".

FYI, I mainly use server libraries to use shared libs on the server (eg. SLF4J, FOP). I've found a workaround: if I don't use type Server Libraries, but uncheck the Package checkbox in the project libraries instead, the result is the same without losing the Glassfish libs. The caveat is that you have to remember to do that in every project.

If "Library Type" "Server Libraries" is not meant to be used like this, it should be documented. Or maybe the whole library type should be dropped if it can't be used in a meaningful way.
Comment 3 David Konecny 2013-04-15 22:33:14 UTC
I can reproduce it now and yes this looks like an unintended use combined with some remnants of how servers used to be handled in the past. I will fix that. Thanks for the report.

PetrH, should Server Library libraries be user editable? Does it still make sense to allow them to be added to project's classpath by user?

t_gergely, using regular libraries and unticking "Package" is the way to go if you need to compile your sources against some jars which are already available in the server runtime.
Comment 4 David Konecny 2013-05-01 01:52:54 UTC
In 7.3.1 release the "Server Library" option in Libraries Manager is retired and removed from the NB UI. The regular "Class Library" type should be used instead as a replacement.


changeset:   251794:dc04c82aa7f4
branch:      javaee7
user:        David Konecny <dkonecny@netbeans.org>
date:        Wed May 01 12:55:54 2013 +1200
summary:     disabling server library from the NetBeans UI

changeset:   251795:1b028876f973
branch:      javaee7
user:        David Konecny <dkonecny@netbeans.org>
date:        Wed May 01 13:12:15 2013 +1200
summary:     removing obsolete ServerLibrary concept - most of this code has been inactive since 7.1 release

changeset:   251796:dee1e096f898
branch:      javaee7
tag:         tip
user:        David Konecny <dkonecny@netbeans.org>
date:        Wed May 01 13:43:03 2013 +1200
summary:     ServerLibrary type has been retired - use regular J2SE library type