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 188751 - Server classpath is not found when opening projects in previous NB releases
Summary: Server classpath is not found when opening projects in previous NB releases
Status: RESOLVED WORKSFORME
Alias: None
Product: javaee
Classification: Unclassified
Component: Web Project (show other bugs)
Version: 6.x
Hardware: PC Mac OS X
: P3 normal (vote)
Assignee: David Konecny
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-18 15:48 UTC by Troy Giunipero
Modified: 2010-10-04 02:19 UTC (History)
2 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 Troy Giunipero 2010-07-18 15:48:03 UTC
Ran into this problem based on feedback from a tutorial that supports both NB versions 6.8 and 6.9.  The project is used with the tutorial and was created in 6.9.

Project URL: http://netbeans.org/projects/samples/downloads/download/Samples%252FJavaEE%252Fecommerce%252FAffableBean_snapshot5.zip

To reproduce, open the project in NetBeans 6.8 release. GlassFish libraries are not found, and an attempt to run the project results in the following message:

  /AffableBean_snapshot5/nbproject/build-impl.xml:209: The Java EE server
  classpath is not correctly set up - server home directory is missing.
  Either open the project in the IDE and assign the server or setup the server
  classpath manually.

  For example like this:
     ant -Dj2ee.server.home=<app_server_installation_directory>
  BUILD FAILED (total time: 0 seconds)


WORKAROUND:
-----------
  1. In the Projects window, right-click the project node and choose Properties.
  2. Click OK. Scanning occurs and the classpath is then set for the project.


The question is whether there's something that can be done for future builds that will ensure the server classpath is recognized in previous releases.
Comment 1 Troy Giunipero 2010-07-19 09:39:25 UTC
My understanding of the mechanics of the nbprojects folder is very limited, but it seems that what prevents the server classpath from being detected is the following properties (contained in the project.properties file), which are set by default in a 6.9 project and absent in a project created in 6.8:

  j2ee.platform.classpath=
  j2ee.platform.wscompile.classpath=
  j2ee.platform.wsgen.classpath=
  j2ee.platform.wsimport.classpath=
  j2ee.platform.wsit.classpath=

In other words, I've found that if these properties are removed, then NetBeans 6.8 will detect the server classpath when the project is opened.
Comment 2 Petr Hejl 2010-07-19 10:38:36 UTC
I guess it is related to David's recent work.
Comment 3 Vince Kraemer 2010-07-19 17:17:33 UTC
It looks like the message was introduced with this revision.

http://hg.netbeans.org/web-main/rev/feda9fb50065

I am going to assign this to David.
Comment 4 David Konecny 2010-07-19 22:31:32 UTC
(In reply to comment #1)
> In other words, I've found that if these properties are removed, then NetBeans
> 6.8 will detect the server classpath when the project is opened.

Correct. If these properties are missing 68 will try to correct it during project opening. 68 style of storing properties was:

private.properties:
j2ee.platform.classpath=/path/to/server/foo.jar;/path/to/server/bar.jar;...
j2ee.platform.wsgen.classpath=/path/to/server/foo.jar;/path/to/server/bar.jar;...
j2ee.platform.wsimport.classpath=...
j2ee.platform.embeddableejb.classpath=...

Fresh checkout of such project and build from command line would require user to set all j2ee.platform.* properties. In 69 I changed it to:

private.properties:
j2ee.server.home=/path/to/server

project.properties:
j2ee.platform.classpath=${j2ee.server.home}/foo.jar;${j2ee.server.home}/bar.jar;...
j2ee.platform.wsgen.classpath=${j2ee.server.home}/foo.jar;${j2ee.server.home}/bar.jar;...
j2ee.platform.wsimport.classpath=...
j2ee.platform.embeddableejb.classpath=...

which means that user has to set only single property after fresh checkout - j2ee.server.home and everything else stays the same.

But side effect is the problem you are describing. There are ways how to make changes like this so that previous versions of IDE runs OK - by introducing new set of property names for example. That could be done if this is serious problem.
Comment 5 David Konecny 2010-10-04 02:19:42 UTC
The solution was to create projects in 6.8 - that way they will open in both 6.8 and 6.9 without problems.