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 218819 - editor always adds <servlet-mapping> to web.xml for @webservice SOAP
Summary: editor always adds <servlet-mapping> to web.xml for @webservice SOAP
Status: RESOLVED WORKSFORME
Alias: None
Product: webservices
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.3
Hardware: PC Linux
: P3 normal (vote)
Assignee: Denis Anisimov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-22 09:51 UTC by hanasaki
Modified: 2012-10-01 12:05 UTC (History)
0 users

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 hanasaki 2012-09-22 09:51:03 UTC
There is a webwservice interface annotated with @webservice (ParkingLotWebserviceSOAP is the interface).  netbeans keeps adding the below to the web.xml : there is no prompt requesting permission to add the mapping.  there is no servlet by the below name in the web.xml

The desired behaviour is to not add this mapping.  This is a pure CXF WAR built with maven.

    <servlet-mapping>
        <servlet-name>ParkingLotWebserviceSOAP</servlet-name>
        <url-pattern>/ParkingLotWebserviceSOAP</url-pattern>
    </servlet-mapping>
Comment 1 hanasaki 2012-09-22 09:52:17 UTC
Minor correction : the ide is also adding the servlet by the below name.

    <servlet>
        <servlet-name>ParkingLotWebserviceSOAP</servlet-name>
        <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
Comment 2 Denis Anisimov 2012-09-24 06:43:24 UTC
I'm not able to reproduce issue based on description.

web.xml is changed in case :
- Target J2EE server is not JSR-109 compliant ( f.e. Tomcat ).
- Dialog with message ( about non JSR109 target server ) is shown and confirmed.

In non JSR109 case web.xml is have to be modified because otherwise WS doesn't work.

Please provide exact steps to reproduce if you don't see a confirmation dialog :
- How have you got the java class with WS annotation ? Have you created it via
some IDE wizard ?
- What is your target JEE server ?
- What is JEE project's profile.
Comment 3 hanasaki 2012-09-25 17:58:52 UTC
There is a branch created at github with an example.  Take a look at the commit to the web.xml in the WAR project module of the maven bui

ref:
https://github.com/hanasaki/demo
branch name: netbeans-bug-218819
: checkout both projects
: mvn clean install - from netbeans of the "Depend project"
: mvn clean install - from netbeans of the springjpa project
: remove the below modifications that where created by netbeans and checked in
: add a tomcat 7.0.30 server to netbeans
: add the tomcat server to the springjpa project
: mvn clean install the springjpa project again
: make a a minor src edit to the soap and restful webservices classes and interfaces to make them recomplile
: run the WAR - forcing the recomplile and deployment
: repeat a few times - eventually the web.xml will be updated and then deployment will fail.

===
- How have you got the java class with WS annotation ? Have you created it via
some IDE wizard ?
: no wizards were used - netbeans did pickup the RESTful cxf webservice (Restful web services in the ide tree) and shows it in the IDE - netbeans did not find the soap webservice and shows no wsdl based webservices in the IDE (web services - in the ide tree)
- What is your target JEE server ?
: using apache-tomcat-7.0.30 out of the box and configured as a server in netbeans.
- What is JEE project's profile.

== Tomcat 7 : apache-tomcat-7.0.30

netbeans generated web.xml changes
...
    <listener>
        <listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
    </listener>
...
    <servlet>
        <servlet-name>ParkingLotWebserviceSOAP</servlet-name>
        <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
...
Comment 4 Denis Anisimov 2012-09-26 07:31:05 UTC
Right, there is a listener for WS file changes.
Thank you for the exact steps to reproduce.
Comment 5 Denis Anisimov 2012-09-26 12:36:16 UTC
I'm still not able to reproduce the issue based on your steps.
I've found only one code snippet where such behavior may be discovered 
(as I mentioned earlier this is file listener ).
Here is the fix for it :
web-main#3647b45f5078
But I don't believe it is a fix for the original issue.
The listener is attached in the CTOR of Jax-WS UI node which doesn't appear 
for you ( as you mentioned in the comment ).
So it is not applicable in your case.

By the way here is the issue with absent JAX-WS node : issue #209555.
I've discovered the same absence of JAX-WS node and I'm going to reopen 
the latter issue.

If you still see this original issue then please provide a localized steps to 
reproduce. Please don't reference to external project.
Only one/two steps are important for the issue identification. I don't see them 
in your description. It looks like : try to play somehow with projects and 
you will see the issue.
The important steps have to be identified on simple empty project 
created via IDE. 
F.e. :
- Create Maven Web project with Tomcat 7 as target JEE server.
- Create Web Service ( or java file ) .
- Modify it,......
Comment 6 hanasaki 2012-09-28 00:19:47 UTC
Exact steps to reproduce the issue.

* checkout the github projects
* build the depend project parent (clean install)
* build the springjpa project (clean install)
* open only the web.xml file
* delete the references lines in the bug report
* save the file - keep the web.xml file open in a tab
* exit the IDE with the web.xml saved file in a tab still
* start the IDE netbeans - the web.xml will be updated again with problems

OS - kUbuntu current as of 9/27/2012
openjdk 7 from Kubuntu distribution
the local source is under Git control

==
sorry I have not had time to create a small self contained project that reproduces the issue.
Comment 7 Denis Anisimov 2012-09-28 07:19:35 UTC
(In reply to comment #6)
> Exact steps to reproduce the issue.
> 
> * checkout the github projects
> * build the depend project parent (clean install)
> * build the springjpa project (clean install)
> * open only the web.xml file
> * delete the references lines in the bug report
> * save the file - keep the web.xml file open in a tab
> * exit the IDE with the web.xml saved file in a tab still
> * start the IDE netbeans - the web.xml will be updated again with problems
> 
> OS - kUbuntu current as of 9/27/2012
> openjdk 7 from Kubuntu distribution
> the local source is under Git control
> 
> ==
> sorry I have not had time to create a small self contained project that
> reproduces the issue.

I'm sorry but I'm not able to reproduce it with your steps.
Comment 8 Denis Anisimov 2012-09-28 10:32:44 UTC
OK, I've been playing with Maven Web projects some time to check different 
behaviors and found exact steps to reproduce:
- Create Maven Web project with Tomcat 7.0 as a target JEE server.
- Create Web Service.
- There will be a dialog about JSR109 .
- Confirm it ( web.xml and sun-jaxws.xml files will be created 
  with mentioned content ). Do not select checkbox "Don't ask again".
- Open web.xml if the editor and delete all added by NB content
 ( any xml element except "session-config" ). Save it.
- Close IDE.
- Open IDE.
As a result web.xml is changed back with content removed previously.

Why does it happen:
- sun-jaxws.xml file presence is a mark for non-JSR109 way WS configuration. 
  This file is used ONLY for non-JSR109 JEE servers to get WS working. 
  It is not needed and hasn't to be present for JSR109 way WS configuration.
- confirming JSR109 notification dialog one accepts creation sun-jaxws.xml file
  along with web.xml and inserting special content.
- web.xml is modified without notification dialog after IDE has been restarted 
  because of the presence the mentioned sun-jaxws.xml file.

This is exactly your case: there is an empty sun-jaxws.xml file in your 
maven WAR project. It is not required in your case and it hasn't to be there.
It's presence means you are using non JSR109 complaint JEE server and web.xml
has to have special hooks to WS Servlet.

Just drop it to fix the undesired behavior.
Comment 9 hanasaki 2012-09-28 17:19:40 UTC
confirmed that removing sun-javaws.xml fixes the issue as described.
note: apache tomcat appears to say it is jsr-109 compliant however netbeans shows the dialog that tomcat 7.0.30 is not jsr109 compliant and prompts for the sun-javaws.xml file to be created and will update the web.xml if you answer YES to the question dialog.
http://tomcat.apache.org/tomcat-7.0-doc/extras.html#Web_Services_support_%28JSR_109%29

After removing the empty sun-javaws.xml file - both the RESTful and SAOPbased webservices do show up in the ide gui tree.
NOTE: it looks like the webservice name for the SAOP based webservices is taken from the annotated interface name and that for the RESTful webservice is taken from the annotated class Impl name.
Comment 10 Quality Engineering 2012-10-01 12:05:58 UTC
Integrated into 'main-golden', will be available in build *201210010929* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/3647b45f5078
User: Denis Anisimov <ads@netbeans.org>
Log: Fix for BZ#218819 - editor always adds <servlet-mapping> to web.xml for @webservice SOAP