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 199365 - remote debugger does not attach to ROOT web app project
Summary: remote debugger does not attach to ROOT web app project
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 7.0
Hardware: PC Linux
: P3 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-12 09:37 UTC by benderamp
Modified: 2016-07-07 08:56 UTC (History)
1 user (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 benderamp 2011-06-12 09:37:12 UTC
Hello,

I am working on a webapp maven project in netbeans. The web application is deployed to tomcat application server and which accepts remote debugger connections (run it with "catalina.sh jpda start").

I have 2 projects - the one is web application with jsp files and the other one is normal java library maven project which contains application model.

Initially this looked like this:
- "myappmodel" - this is name of the project with model.
- "mywebapp" - this is project name for web application -> generates mywebapp.war output archive which is put on server to tomcat/webapps dir and can be accessed thought "http://server.com:8080/mywebapp/index.jsp" url.

At this point all was OK - I was able to attach remote debugger to my server and to put breakpoints to java files in myappmodel project and to jsp files in mywebapp projects - debugger did stop on correct lines, I could see variable values etc.


But then I had to fine-tune application deployment requirements - I need to deploy the application as ROOT web application on my server, so it would be accessed not like "http://server.com:8080/mywebapp/index.jsp", but like "http://server.com:8080/index.jsp" url ("mywebapp" url part should not be there).

At the same time, I did not want to rename "mywebapp" project to ROOT project, cause I think at least it is not the right way to go - "ROOT" project name is not self-explaining and also I will not be able to have 2 different ROOT webapp projects in same workspace. Luckily maven builder plugin allows to create output war archives with user-defined name, which can also be different from project name:

   <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.1-beta-1</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
        </plugins>
        <finalName>ROOT</finalName>
    </build>

I have just added or modified "<finalName>ROOT</finalName>" section, so now my web application project has its old name "mywebapp", but its output dir has ROOT.war file as build output which is easily deployed to tomcat/webapps/ROOT dir.

And here the problem comes - I can still attach debugger to web application server, I can still put breakpoints in "myappmodel" and the bugger would stop there, but now debugger will not stop in the breakpoints I have put inside my webapp "mywebapp" project - by some reason debugger does not make association with ROOT webapp running on server and my local "mywebapp" project source code.

This might be because my output file name (ROOT.war) and and project name (mywebapp) are different, so there seems to be no good way to automatically understand that those resources are associated, but I have reasons to make things like that described above, so I think there should be some way to fine-tune remote debugger source-target association mechanism for such cases. 

Even it still could try to do such things automatically - just check pom.xml file if it contains "fileName" section with ROOT value inside - if so, treat current webapp project as ROOT project whatever workspace name (artifactId) it actually has.
Comment 1 Martin Balin 2016-07-07 08:56:24 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss