users@jersey.java.net

[Jersey] Re: Jersey 2 Spring and ExceptionMapper workaround

From: Doyle, Brendan <brendan.doyle_at_ie.verizon.com>
Date: Tue, 10 Jun 2014 11:21:17 +0100

Hi

Just for other users reference I did have success afterwards. As Miles suggested what I had to do was replace all my Spring annotations on the Jersey managed classes ( Resources and Exception mappers ) with JSR-330 annotations . All the other classes could be left using the Spring annotations.

Thanks

Brendan Doyle

From: Doyle, Brendan
Sent: 20 February 2014 11:55
To: users_at_jersey.java.net
Subject: RE: [Jersey] Re: Jersey 2 Spring and ExceptionMapper workaround

Hi Miles

Thanks for the reply. I eventually got a chance to try that out, I tried replacing my spring annotations on all the jersey managed classes ( resources and exception mappers etc) with jsr-330 ones . However that was not enough it looks like I need to replace all the dependency annotations down the hierarchy of dependencies . That is too much for a workaround, it might be less work to migrate to reasteasy. Seems like https://java.net/jira/browse/JERSEY-2063 is not scheduled for any forthcoming releases .

Thanks again for your reply

Brendan Doyle

From: Miles, Eric (CONT) [mailto:Eric.Miles_at_capitalone.com]
Sent: 12 February 2014 14:01
To: users_at_jersey.java.net<mailto:users_at_jersey.java.net>
Subject: [Jersey] Re: Jersey 2 Spring and ExceptionMapper workaround

I don't think this is completely true. We are on Jersey 2.5.1 and have successfully integrated Spring Beans as exception mappers for both Spring 3.2.4.RELEASE and 4.0.1.RELEASE. However, we use no Spring annotations and only the JSR-330 and JARX-RS annotations:


@Provider

@Named

public class BusinessExceptionMapper extends AbstractExceptionMapper<BusinessException> {



    @Inject

    private LoggerManager logManager;



    @Context

    private HttpHeaders headers;




Eric Miles

From: <Doyle>, Brendan <brendan.doyle_at_ie.verizon.com<mailto:brendan.doyle_at_ie.verizon.com>>
Reply-To: Jersey Users <users_at_jersey.java.net<mailto:users_at_jersey.java.net>>
Date: Wednesday, February 12, 2014 7:25 AM
To: Jersey Users <users_at_jersey.java.net<mailto:users_at_jersey.java.net>>
Subject: [Jersey] Jersey 2 Spring and ExceptionMapper workaround

Hi

There is a known issue ( https://java.net/jira/browse/JERSEY-2063 ) with Jersey 2 that when you deploy with spring support your ExceptionMappers stop working. I ran into this when trying to migrate from Jersey 1 to 2.5.1. What I found is that you can have exception mappers or spring support but not both.

I tried earlier 2.x versions but they also have the same problem.

Has anyone figured out a way to workaround this?


Verizon Ireland Limited - registered in Ireland - registered number 224334 - registered office at Erne Street, Dublin 2, Ireland - VAT number 8224334A

________________________________

The information contained in this e-mail is confidential and/or proprietary to Capital One and/or its affiliates. The information transmitted herewith is intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.