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 262293 - Wrong Configuration Generated for Maven WAR Plugin
Summary: Wrong Configuration Generated for Maven WAR Plugin
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Web Project (show other bugs)
Version: 8.1
Hardware: Macintosh Mac OS X
: P2 normal (vote)
Assignee: Petr Hejl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-01 10:33 UTC by oluwasayo
Modified: 2016-06-09 13:58 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 oluwasayo 2016-06-01 10:33:43 UTC
Product Version = NetBeans IDE 8.1 (Build 201510222201)
Operating System = Mac OS X version 10.11.3 running on x86_64
Java; VM; Vendor = 1.8.0_45
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.45-b02

Reproducibility: Happens every time

STEPS:
  * Create a Maven WAR project
  * Generate a JAX-WS client to a web service
  * Inject a reference to the JAX-WS client in a managed bean (EJB, WS Endpoint, etc)
  * Run the application and try an action that constructs an instance of the managed bean
  * JAX-WS tries to connect to the URL of the client to retrieve the WSDL instead of retrieving it from the jax-ws catalog. Disable your network connection to see what happens if the URL of the WSDL is not reachable (the application freezes)
  * This is because in the POM, the Maven WAR pluging is configured to copy the jax-ws catalog to "WEB-INF" instead of "WEB-INF/classes/META-INF" as specified in the JavaEE/JAX-WS spec

ACTUAL:
  JAX-WS client instantiation/injection does not succeed and app freezes because the JAX-WS implementation tries to connect to the WSDL URL to retrieve it

EXPECTED:
  JAX-WS client injection should succeed even when working offlin
Comment 1 Petr Hejl 2016-06-03 16:07:16 UTC
Can you be more precise on steps to reproduce? The code you have generated etc. Though I have prepared a fix, I'm not able to reproduce the original behavior.
Comment 2 oluwasayo 2016-06-03 16:13:44 UTC
When you add a web service client to a Maven web project, NetBeans generates this (take note of plugin.configuration.webResources.resource.targetPath):

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.3</version>
        <configuration>
          <failOnMissingWebXml>false</failOnMissingWebXml>
          <warName>myapp.war</warName>
          <webResources>
            <resource>
              <directory>src</directory>
              <targetPath>WEB-INF</targetPath>
              <includes>
                <include>jax-ws-catalog.xml</include>
              </includes>
            </resource>
          </webResources>
        </configuration>
      </plugin>


Instead of this:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.3</version>
        <configuration>
          <failOnMissingWebXml>false</failOnMissingWebXml>
          <warName>myapp.war</warName>
          <webResources>
            <resource>
              <directory>src</directory>
              <targetPath>WEB-INF/classes/META-INF</targetPath>
              <includes>
                <include>jax-ws-catalog.xml</include>
              </includes>
            </resource>
          </webResources>
        </configuration>
      </plugin>
Comment 3 Petr Hejl 2016-06-03 16:37:50 UTC
AFAIK when using the web service as client you are right and I have made a quick fix exactly for this. However I'd like to test it really fixes the thing.

Alternatively I could push the fix so you can try it.
Comment 4 oluwasayo 2016-06-03 16:40:32 UTC
Hi, thanks a lot.

I'm not sure how I could be more precise about reproduction steps. Please push the change and I'll test. What do I need to update from my end to get the new code?
Comment 5 Petr Hejl 2016-06-03 19:54:45 UTC
Attempt to fix in web-main c7ab29ab922d. Please verify once the message about integration to dev build appears here. Thanks in advance.
Comment 6 Petr Hejl 2016-06-06 11:25:53 UTC
Please can you test your usecase with the latest daily build?
Comment 7 Petr Hejl 2016-06-08 13:33:59 UTC
Awaiting user response.
Comment 8 oluwasayo 2016-06-09 13:47:08 UTC
I've tested the nightly build.
The generates two resources. One in WEB-INF (wrong) and another in WEB-INF/classes/META-INF (correct).
This fixes the problem.
Comment 9 oluwasayo 2016-06-09 13:58:05 UTC
Thank you for your effort!