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 208294 - Maven Web Project forgets the selected server when moving into the different directory
Summary: Maven Web Project forgets the selected server when moving into the different ...
Status: RESOLVED DUPLICATE of bug 214212
Alias: None
Product: javaee
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.2
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Assignee: Martin Janicek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-11 20:36 UTC by bht
Modified: 2012-10-31 15:53 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Project properties (42.02 KB, image/gif)
2012-02-11 20:37 UTC, bht
Details
.nbattrs (1.60 KB, text/plain)
2012-03-02 20:25 UTC, bht
Details
.nbattrs in the separate userdir where the broken broject is open (1.54 KB, application/octet-stream)
2012-04-19 09:30 UTC, bht
Details
.nbattrs in my regular userdir (1.60 KB, application/octet-stream)
2012-04-19 09:39 UTC, bht
Details
Every time I launch netbeans after moving project I can't build because it says it can't find Glassfish 3+ (15.82 KB, image/png)
2012-08-05 17:36 UTC, theshowmecanuck
Details
Complains 3+ not configured but project HAS sever configured called 3.1.1 but doesn't recognize it (28.84 KB, image/png)
2012-08-05 17:47 UTC, theshowmecanuck
Details
this bug may be related to but 192164 due to cannot rename file attributes when making new folder.... this bug may be related to see comment 15 192164 (47.73 KB, image/png)
2012-08-05 20:21 UTC, theshowmecanuck
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bht 2012-02-11 20:36:21 UTC
After some attempts to fix debugger source root issues I undeploy a Maven project and re-start the server that is in debug mode already.

This Maven project was run an GlassFish before successfully.

Then I run the project and NetBeans tries to deploy it.

The error in the console is:

cd C:\bt\java\WebServices\JSON\json-rpc\jsonrpc\TransportSecurity\WebAuthTest; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.6.0_30" "\"C:\\Program Files\\NetBeans 7.1\\java\\maven\\bin\\mvn.bat\"" -Dnetbeans.deploy=true -DskipTests package
Scanning for projects...
                                                                        
------------------------------------------------------------------------
Building WebAuthTest 1.0-SNAPSHOT
------------------------------------------------------------------------

[dependency:copy]

[resources:resources]
Using 'UTF-8' encoding to copy filtered resources.
Copying 1 resource

[compiler:compile]
Nothing to compile - all classes are up to date

[resources:testResources]
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory C:\bt\java\WebServices\JSON\json-rpc\jsonrpc\TransportSecurity\WebAuthTest\src\test\resources

[compiler:testCompile]
Nothing to compile - all classes are up to date

[surefire:test]
Tests are skipped.

[war:war]
Packaging webapp
Assembling webapp [WebAuthTest] in [C:\bt\java\WebServices\JSON\json-rpc\jsonrpc\TransportSecurity\WebAuthTest\target\WebAuthTest-1.0-SNAPSHOT]
Processing war project
Copying webapp resources [C:\bt\java\WebServices\JSON\json-rpc\jsonrpc\TransportSecurity\WebAuthTest\src\main\webapp]
Webapp assembled in [500 msecs]
Building war: C:\bt\java\WebServices\JSON\json-rpc\jsonrpc\TransportSecurity\WebAuthTest\target\WebAuthTest-1.0-SNAPSHOT.war
Warning: selected war files include a WEB-INF/web.xml which will be ignored 
(webxml attribute is missing from war task, or ignoreWebxml attribute is specified as 'true')
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 7.594s
Finished at: Sun Feb 12 09:10:24 NZDT 2012
Final Memory: 6M/15M
------------------------------------------------------------------------
NetBeans: Deploying on GlassFish Server 3.1
    profile mode: false
    debug mode: false
    force redeploy: true
In-place deployment at C:\bt\java\WebServices\JSON\json-rpc\jsonrpc\TransportSecurity\WebAuthTest\target\WebAuthTest-1.0-SNAPSHOT
deploy?DEFAULT=C:\bt\java\WebServices\JSON\json-rpc\jsonrpc\TransportSecurity\WebAuthTest\target\WebAuthTest-1.0-SNAPSHOT&name=com.bht_WebAuthTest_war_1.0-SNAPSHOT&contextroot=/WebAuthTest&force=true failed. Instance is not GlassFish Server 3.1.
The module has not been deployed.
See the server log for details.
	at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:210)
	at org.netbeans.modules.maven.j2ee.ExecutionChecker.performDeploy(ExecutionChecker.java:179)
	at org.netbeans.modules.maven.j2ee.ExecutionChecker.executionResult(ExecutionChecker.java:131)
	at org.netbeans.modules.maven.execute.MavenCommandLineExecutor.run(MavenCommandLineExecutor.java:211)
	at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)

---

There are no errors in the server log.

In the Maven project's Run properties, Server is "GlassFish Server 3.1" and the project icon does not show any errors such as missing server.

I have had this problem before - it happens quite frequently. I can't remember what the workaround is.

I am not sure whether I can make a testcase. I am dealing with too many bugs at the moment and I am not confident I can make a testcase for this yet so I start with the symptoms.
Comment 1 bht 2012-02-11 20:37:33 UTC
Created attachment 115624 [details]
Project properties
Comment 2 Vince Kraemer 2012-03-02 01:04:10 UTC
Tomas: please start to investigate this issue.
Comment 3 TomasKraus 2012-03-02 10:10:14 UTC
This looks like Netbeans are complaining about wrong GlassFish server. Check Services : Servers : GlassFish Server 3.1 settings in Netbeans to make sure it points to correct Glassfish (3.1).
Unfortunately I don't have enough information about this issue to find what's going wrong. I may need your application or some minimal testcase to reproduce this problem in my own environment.

Also send me content of your ~/.netbeans/7.1/config/GlassFishEE6/Instances/.nbattrs to see what you have configured as GlassFish server in your Netbeans.
Comment 4 TomasKraus 2012-03-02 10:20:00 UTC
Think on Windows Netbeans store user related configuration somewhere in C:\Documents and Settings\<username>\.netbeans\7.1 or C:\Users\<username>\.netbeans\7.1\
Comment 5 bht 2012-03-02 20:25:42 UTC
Created attachment 116309 [details]
.nbattrs

This file .nbattrs has a modification date of yesterday morning when I started up NetBeans. But I did not touch the IDE anywhere near that time. Same with the server - I did not touch it and it does not have any log entries for that time either. This needs more watching or creative ideas. See also bug 203381
Comment 6 TomasKraus 2012-03-07 12:30:07 UTC
I did simple test with NetBeans 7.1 and 7.2 development build using Glassfish 3.1.1 and 3.1.2:

1) In Netbeans I created Maven web project
   - File -> New Project :: Maven -> Web Application
   - Project Name: MvnProject
   - Server: ...here I tested GF 3.1.1 and 3.1.2
   - Java EE Ver: Java EE 6 Web
2) In Projects tab I selected MvnTest and 
   - Build
   - Run

Default Hello World Maven project was working fine with all NB/GF combinations I was trying.

Also checked your .nbattrs file and looks like there is no problem with your Glassfish registration in NetBeans. My .nbattrs file is the same.

Please can you try to deploy this simple application too and let me know if there is some problem with it? If not, please try to find out what's different in your project and maybe you'll be able to identify what causes those failures.
Comment 7 TomasKraus 2012-03-12 17:01:49 UTC
Closing now. Please reopen this issue when requested information will be available.
Comment 8 bht 2012-03-18 01:23:09 UTC
How to reproduce:

- In the services window, start up GlassFIsh in debug mode
- Create a test directory
- In the test directory, open a command prompt and create a wicket maven quickstart as at
  http://wicket.apache.org/start/quickstart.html with
  mvn archetype:generate -DarchetypeGroupId=org.apache.wicket -DarchetypeArtifactId=wicket-archetype-quickstart -DarchetypeVersion=1.5.5 -DgroupId=com.mycompany -DartifactId=myproject -DarchetypeRepository=https://repository.apache.org/ -DinteractiveMode=false
- Open the created project in the IDE
- In the project explorer, right click the quickstart project, debug
  prompts "Select Deployment Server"
- Select GlassFish Server 3+ (in my case that is the only installed and configurred server, GlassFish 3.1.2)
- check "Remember Permanently" and press ok
  The application is launched in the browser
- In the services window, refresh the applications node under the server and undeploy the application
- re-start the server
  re-starts in debug mode as expected
- in the projects window, close the project quickstart
- create a subfolder in the the test folder, move the project into it and re-open the project in the new subfolder

Problems:
Cannot find application server "GlassFish Server 3+"
"The app server defined for the project is not available in your IDE. Please go to Tools/Servers manager and add it."
Comment 9 Vince Kraemer 2012-04-17 16:11:19 UTC
Tomas.... have you been able to reproduce this based on bht's detailed 'steps to reproduce'
Comment 10 TomasKraus 2012-04-18 08:31:39 UTC
No, I went trough reproduction scenario using last trunk build and everything works fine for me.
I'll give it one more try with fresh 7.1.
Comment 11 bht 2012-04-18 09:56:07 UTC
I have reproduced this again first time, this time with NetBeans 7.1.1 running in a separate new userdir.

The interesting part is that when the project is first run, then the IDE names the server 3.1.2. 

After the move into the sub-folder and re-opening, the IDE complains about missing server 3+ as in the message Cannot find application server "GlassFish Server 3+" in the tooltip of the yellow mark on the project icon.

In my instance with my permanent userdir, GlassFish is registered as 3+ which is strange, but there is no connection between my private userdir and the fresh one, is it? But may be this name change provides a clue.

my .nbattrs:
        <attr name="displayName" stringvalue="GlassFish Server 3+"/>

separate userdir for this test .nbattrs:
        <attr name="displayName" stringvalue="GlassFish Server 3.1.2"/>
Comment 12 TomasKraus 2012-04-19 08:38:54 UTC
I did reproduction scenario again on Win2k/NB 7.1 and still don't see any issue. :(

Please attach those .nbattrs files and paste their path here. I can try to simulate them manually on my machine. This looks like source of your problems.
I don't believe it's because of displayName but it looks like one of those records points to non-existent glassfish.
Comment 13 bht 2012-04-19 09:22:13 UTC
Did you move the project into a subfolder of its parent folder before re-opening it? This is the key part.
Comment 14 bht 2012-04-19 09:30:29 UTC
Created attachment 118497 [details]
.nbattrs in the separate userdir where the broken broject is open
Comment 15 bht 2012-04-19 09:38:11 UTC
I will keep this userdir with the broken project. May be we can find the bug this way.
Comment 16 bht 2012-04-19 09:39:22 UTC
Created attachment 118498 [details]
.nbattrs in my regular userdir
Comment 17 bht 2012-04-19 09:48:10 UTC
If there is something wrong with my glassfish installation then why do all my projects work except maven projects and only those that I move into a different folder following this procedure?
Comment 18 TomasKraus 2012-04-19 12:40:09 UTC
I made mvn project in D:\tomas\test\myproject and moved it into D:\tomas\test\folder\myproject
But there is no .nbattrs in those directories. Everything works fine here even with 7.1/win3003.

Do you have an idea how did you get second .nbattrs in your working directory? Try to remove it and in Projects - quickstart - properties - run point server to remaining Gf instance.
Comment 19 bht 2012-04-19 17:44:20 UTC
Sorry, this might be a misunderstanding. When I say .nbattrs in my regular userdir then there must be only one there as well - it ist he netbeans profile that I use for my other work. I run this testcase WITH a separate userdir (not in it) where I start NetBeans with "C:\Program Files\NetBeans 7.1.1\bin\netbeans.exe" --userdir C:\bt\java\netbeans\bugs\_new\WebDeployFailed\userdir. In there I get the 2nd .nbattrs.

I have the following question in my mind:

How does the maven project know that it is associated with any installed server or not? Obviously it can forget this information. It looks like it is cached outside and the IDE fails to update this info.

I tried the following test:

- copied the project from the subfolder back into the parent folder and opened it. Result: ok
- created a 2nd subfolder and copied it again into this subfolder, opened it. Result: cannot find server

Now I have three copies of the same project open where the two in the subfolders have "cannot find server".
Comment 20 TomasKraus 2012-04-20 12:00:18 UTC
I gave it one more try using --userdir /users/tomas/WS/NBproject and having myproject under /users/tomas/WS/NBproject/test208294 first and /users/tomas/WS/NBproject/test208294/subfolder when moved.

After I tried deploy from new location it had no server selected and asked for new dpeloyment server. But I'm 100% sure that I checked "Remember Permanently" for the first time.

Product Version: NetBeans IDE 7.1 (Build 201112071828)
Java: 1.7.0_02; Java HotSpot(TM) 64-Bit Server VM 22.0-b10
System: Linux version 2.6.38-8-generic running on amd64; UTF-8; en_US (nb)
User directory: /users/tomas/WS/NBproject

This is really getting crazy. :(
Comment 21 piotrik 2012-04-20 12:51:49 UTC
I have tried to reproduce it also but no luck...

Product Version: NetBeans IDE 7.1.1 (Build 201203012225)
Java: 1.6.0_30; Java HotSpot(TM) 64-Bit Server VM 20.5-b03
System: Linux version 3.0.0-17-generic running on amd64; UTF-8; en_US (nb)
User directory: /home/piotro/.netbeans/7.1.1
Cache directory: /home/piotro/.netbeans/7.1.1/var/cache
Comment 22 Vince Kraemer 2012-04-25 18:54:39 UTC
Tomas: any update on this... it looks like you were able to reproduce the issue (based on http://netbeans.org/bugzilla/show_bug.cgi?id=208294#c20)
Comment 23 TomasKraus 2012-04-26 11:23:08 UTC
No, I was unable to reproduce it. On my machines (Laptop with Linux and Windows VM) it asks for a new GlassFish after project is moved to another directory.
I saw no exception and application was deployed after I selected GlassFish in pop-up window.
Comment 24 bht 2012-04-26 19:13:40 UTC
You reproduced the error I am seeing.

I have initially reported an exception that does no longer occur. However I am reporting that NetBeans forgets the server that it has asked me to provide so it can remember it across sessions:

"Select deployment server"
<No Server Selected>
* Remember in Durrent IDE Session
* Remember Permanently

I am thinking that NetBeans has no way to remember it because there is no NetBeans generated file in the project dir. In other Maven projects it writes nb-configuration.xml.

After the move into the sub-folder and re-opening, the IDE complains about
missing server 3+ as in the message Cannot find application server "GlassFish
Server 3+" in the tooltip of the yellow mark on the project icon.
Comment 25 Martin Janicek 2012-04-27 07:55:47 UTC
Bht, not sure what version of the NetBeans are you using (I didn't read the whole discussion), but this problem (missing target server across the IDE runs) were already fixed in issue 206231.

Is this the thing you are looking for or am I missing something? :]
Comment 26 bht 2012-04-27 09:30:11 UTC
mjanicek, I can't confirm what you are thinking. Tomas has reproduced the issue in comment 20. Although there might be confusion now about the scope of this :(

I don't want to change the title because this is re-opened.

The title should read "IDE forgets Server for Maven Project". People are looking for exceptions thrown but there aren't any because a dialog prevents the project from running. The IDE does not need to be re-started for this to reproduce.
Comment 27 Martin Janicek 2012-04-27 09:38:45 UTC
In that case this issue has been already solved (as this ticket seems to me that it's actually just a duplicate of issue 206231, right?). If I'm correct and there is nothing else wrong you shouldn't be able to reproduce with the daily builds.
Comment 28 bht 2012-04-27 10:37:23 UTC
It reproduces with the latest dev build I just downloaded a few minutes ago. Does not look like a duplicate of something that was fixed.
Comment 29 bht 2012-04-27 10:45:42 UTC
There is another problem on top of this:

If I cancel out of the dialog "Select deployment server" then the process of running the project is not ended. This becomes obvious when you try to shut down the IDE.
Comment 30 Martin Janicek 2012-04-27 11:42:54 UTC
Ok, thanks. I'll take a look at it closer.
Comment 31 Vince Kraemer 2012-04-27 17:41:37 UTC
I was able to reproduce this with a Maven web app project that was generated by NetBeans.

The gf plugin does not manipulate the project when the user is editing the project properties so I guess this is really a bug in the Maven web app project code.

It looks like the right person has already started to dig into it, but this issue should probably track and communicate the status correctly, too.
Comment 32 Martin Janicek 2012-05-02 06:22:36 UTC
Ok, I was able to reproduce this. It actually looks to me like a minor problem. It's happening only when moving the project into the another directory and it's not blocking anything (only thing you need to do is to check the server once again and everything is working fine).
Comment 33 theshowmecanuck 2012-07-29 23:14:54 UTC
I am experiencing an identical problem after rebuilding a dev box that was in the process of dying. Once the new box was up I opened the set of related maven projects and I keep getting this. It also has problems if I name the server anything other than the default 3+. I just saw this when looking for references to this problem. I am using 7.1 after backing off of 7.1.2 due to another maven bug related to nexus index and artifactory that has been identified and marked as fixed, but not due out till 7.2. Just wanted to show this isn't isolated.
Comment 34 theshowmecanuck 2012-08-02 00:28:37 UTC
@mjanicek Every time I start netbeans now, all previously saved project information for my maven enterprise project are forgotton. 

I have five modules, an ejb module, web, ear, project, and a commons project for shared utility code. The commons project references some JEE packages but is not deployable, yet it wants me, by showing a yellow triangle and exclamation mark over the proect, to set the server, which I can't do because there are no ejbs or web componenets, so I ignore it... but it is unnerving to have a hazard symbol showing in the project window...  and it never made this complaint before the move). 

Same issue for the project module. And of course the ejb, web, and ear modules need the server set, and I tell it to set the server, but next time I start netbeans I have to do this all over again. I have kind of lost confidence that netbeans is working correctly, but I am so far along this project that I can't switch IDEs in mid stream, and up until this, netbeans has worked decently. I am sticking with it, but am nervous if you know what I mean. 

The other thing I noticed was that when setting the server in the projects, it wouldn't recognize the server if it was named anything other than Glassfish 3+. When I had two servers registered, one 3.1.1 and 3.1.2 it would complain that it couldn't find 3+ and I couldn't run my projects. People do move projects and rebuild dev boxes like is my case. This is frustrating.
Comment 35 theshowmecanuck 2012-08-02 00:58:53 UTC
As an FYI before I can deploy anything I have to do the following. In the ear, ejb, and web modules, right click on the module node, click on properties and go to the run tab. And even if there is a server listed there, I have to click on the box, and select the server, even if it is the same and even only one that was there before. Then click OK and a short dialog pops up telling me it is saving project settings. Only then will the ear properly deploy. Otherwise, from the messages, it appears the ejb and web are not being included and I get java.lang.NoClassDefFoundError.
Comment 36 theshowmecanuck 2012-08-02 15:26:02 UTC
FYI: My platform is Kubuntu Linux running as a guest on VirtualBox Windows 7 host. I don't think the fact it is a VirtualBox guest matters, but full disclosure.
Comment 37 theshowmecanuck 2012-08-05 17:36:57 UTC
Created attachment 122754 [details]
Every time I launch netbeans after moving project I can't build because it says it can't find Glassfish 3+

Every time I launch netbeans after moving project I can't build because it says it can't find Glassfish 3+
Comment 38 theshowmecanuck 2012-08-05 17:47:03 UTC
Created attachment 122755 [details]
Complains 3+ not configured but project HAS sever configured called 3.1.1 but doesn't recognize it

Every time I launch netbeans after moving project I can't build because it says it can't find Glassfish 3+. However as the image shows, there is a server configured but it won't recognize it when I deploy the associated EAR.

If I go into the project properties, click on Run and click/select Glassfish 3.1.1 again, even though it is already displayed and is in fact the only server registered in Netbeans, I will see a popup telling me it is saving project properties. I have to do this with the web and EAR modules. 

***
I don't know if this is related (but I seriously suspect it is) but occasionally I will see error messages saying netbeans can't save /home/bill/.netbeans/7.1/var/attributes.xml because it already exists.

This file is empty on my system, but there is a backup file of it (~ suffix) that has info related to my projects including references to the Glassfish 3.1.1 server. 
***
Comment 39 theshowmecanuck 2012-08-05 20:21:20 UTC
Created attachment 122757 [details]
this bug may be related to  but 192164 due to cannot rename file attributes when making new folder.... this bug may be related to see comment 15 192164

This bug may be related to a bug marked as fixed numbered Bug 192164 - Cannot rename .nbattrs: 

http://netbeans.org/bugzilla/show_bug.cgi?id=192164

This comment on bug 192164 is interesting: 

http://netbeans.org/bugzilla/show_bug.cgi?id=192164#c15.
Comment 40 theshowmecanuck 2012-08-05 20:27:50 UTC
I would have edited my last comment but the system doesn't allow that.

Note that my last post related to a Netbeans on Windows 7 bug (192164) and I am on Linux, but they seem VERY similar. 

Also the 'Com.ment 15' for some reason autolinked to com.ment 15 of this thread when I was talking about com.ment 15 of the 192164 bug.
Comment 41 theshowmecanuck 2012-08-25 04:20:11 UTC
This bug is definitely related to Bug 213819  and Bug 214198. And at least in Bug 213819 it is happening in NB 7.2. All have the same error message reported:

The module has not been deployed.
See the server log for details.
	at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:210)
	at org.netbeans.modules.maven.j2ee.ExecutionChecker.performDeploy(ExecutionChecker.java:178)
	at org.netbeans.modules.maven.j2ee.ExecutionChecker.executionResult(ExecutionChecker.java:130)
	at org.netbeans.modules.maven.execute.MavenCommandLineExecutor.run(MavenCommandLineExecutor.java:212)
	at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
Comment 42 Martin Janicek 2012-10-31 15:53:48 UTC
Ok, this issue sounds like a duplicate of the issue 214212. As we have 40+ comments here and a lot of them are already obsolete, I would like to ask everyone whose still getting this to move a discussion to the 214212.

*** This bug has been marked as a duplicate of bug 214212 ***