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 232922 - Adding redundant Jersey dependencies to Java EE 7 application
Summary: Adding redundant Jersey dependencies to Java EE 7 application
Status: RESOLVED FIXED
Alias: None
Product: webservices
Classification: Unclassified
Component: REST (show other bugs)
Version: 7.4
Hardware: PC Mac OS X
: P2 normal (vote)
Assignee: Milan Kuchtiak
URL:
Keywords:
: 233551 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-07-17 16:24 UTC by arungupta
Modified: 2013-07-29 07:53 UTC (History)
3 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 arungupta 2013-07-17 16:24:10 UTC
7.4 beta adds the following dependencies:

<dependency>
            <groupId>org.glassfish.jersey.containers</groupId>
            <artifactId>jersey-container-servlet</artifactId>
            <version>2.0</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-client</artifactId>
            <version>2.0</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-multipart</artifactId>
            <version>2.0</version>
        </dependency>

to pom.xml to valid Java EE 7 application with:

<dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>

This is creepy and should be avoided. I don't know how NetBeans calculates these dependencies need to be added.
Comment 1 arungupta 2013-07-17 16:26:01 UTC
This breaks the application deployment with the following error:

org.glassfish.deployment.common.DeploymentException: CDI deployment failure:WELD-001408 Unsatisfied dependencies for type [Providers] with qualifiers [@Default] at injection point [[BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject public org.glassfish.jersey.media.multipart.internal.MultiPartReaderServerSide(@Context Providers, Provider<CloseableService>)]
	at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:225)
	at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
	at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:328)

I had to remove these dependencies to get the application working.
Comment 2 David Konecny 2013-07-22 21:07:18 UTC
Must be some recent regression as this used to work - no Jersey should be needed in EE7.
Comment 3 Milan Kuchtiak 2013-07-23 10:16:54 UTC
Fixed.

The intention of previous behavior was to add missing Jersey 2.0 dependencies in case, user is working either on project with non-selected server, or with server that contains no Jersey on classpath.

Now, Jersey 2.0 artifacts(dependencies) are not added any more, for Java EE6 and Java EE7 project types. 
It's expected, user is able to add Jersey dependencies manually when needed (e.g. for Tomcat server).

See: https://hg.netbeans.org/web-main/rev/b738ea5932a0
Comment 4 David Konecny 2013-07-24 00:11:47 UTC
Was this issue result of Maven project not having a server associated? If so then it is a good idea Arun to always select a server first - NetBeans will use that information in many wizards to give you better results.

The fix could have distinguish case when Maven has no server selected. If selected server does not have Jersey on classpath then Jersey should probably be still added.
Comment 5 Quality Engineering 2013-07-24 02:34:51 UTC
Integrated into 'main-silver', will be available in build *201307232300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/b738ea5932a0
User: Milan Kuchtiak <mkuchtiak@netbeans.org>
Log: #232922: don't add Jersey 2.0 dependencies in maven Java EE6, Java EE7 project types
Comment 6 Petr Jiricka 2013-07-24 07:58:18 UTC
I know that in some areas (JPA, JSF) we display an inline warning in the wizard if the server is not set, which recommends the user to set the target server before proceeding with the wizard. It may be a good idea to have this warning also in the JAX-RS/Jersey case.
Comment 7 Martin Janicek 2013-07-29 07:53:18 UTC
*** Bug 233551 has been marked as a duplicate of this bug. ***