[JERSEY-3253] Jersey2 upgrade changed Response redirect behavior Created: 23/Mar/17  Updated: 24/Mar/17

Status: Open
Project: jersey
Component/s: None
Affects Version/s: 2.25
Fix Version/s: None

Type: Bug Priority: Major
Reporter: luisjotapepe Assignee: Pavel Bucek
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Prod



 Description   

I found this interesting change in behavior after upgrading from Jersey 1.17 to 2.25. I looked up everywhere and couldn't find the reason for the change or anyone else talking about it.

The code in question:

{
@Component
@Path("/app")
public class AppRouteController {

    @GET
    @Path("/test")
    public Response test() {
        ResponseBuilder builder = Response.status(Status.TEMPORARY_REDIRECT);
        return builder.header("Location", "followme").build();
    }

    @GET
    @Path("/followme")
    public Response followme() {
        return Response.ok();
    }

Before the upgrade calling /api/app/test would redirect me to /api/app/followme

After the upgrade calling /api/app/test redirects me to /api/followme

The imports are:

import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;

web.xml

<servlet>
    <servlet-name>jersey-servlet</servlet-name>
    <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>jersey-servlet</servlet-name>
    <url-pattern>/api/*</url-pattern>
</servlet-mapping>

Anyone knows why the redirect is not going to the same resource as before?



 Comments   
Comment by Pavel Bucek [ 23/Mar/17 ]

I don't see anything related in your code which would suggest that Jersey influences the observer behaviour.

The code is setting location header, but it is not using anything for the "base", so it's up to the client to resolve the URL. The report doesn't mention which client accesses the resource, so from my point of view, the issue is invalid.

Please provide further info, ideally with dumped traffic between client and the server.

Comment by luisjotapepe [ 23/Mar/17 ]

Thanks for the prompt response. The observer is Chrome.

I ran a test to provide you with information. The browser is still Chrome (latest version)

  • loaded the code just before I introduced the upgrade. Tested using Chrome and hitting the route using the url /api/app/test. It redirected me to the /api/app/followme
      • Jersey1.17 —

Mar 23, 2017 1:50:54 PM org.glassfish.jersey.filter.LoggingFilter log
INFO: 3 * Server has received a request on thread http-bio-8080-exec-9
3 > GET http://localhost:8080/test/PWAssessment/api/app/test
3 > accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
3 > accept-encoding: gzip, deflate, sdch, br
3 > accept-language: en-US,en;q=0.8
3 > connection: keep-alive
3 > cookie: JSESSIONID=BF4D95373B09490E3A3D2D2B3D19A0ED; LastLoggedInCookieUserName=i0HMn+Mq9r/1hS9LOclsJ2bUNBEOvtQQ; Yui3ConfigFilter=""
3 > host: localhost:8080
3 > upgrade-insecure-requests: 1
3 > user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

Mar 23, 2017 1:50:54 PM org.glassfish.jersey.filter.LoggingFilter log
INFO: 3 * Server responded with a response on thread http-bio-8080-exec-9
3 < 307
3 < Location: followme

Mar 23, 2017 1:50:54 PM org.glassfish.jersey.filter.LoggingFilter log
INFO: 4 * Server has received a request on thread http-bio-8080-exec-10
4 > GET http://localhost:8080/test/PWAssessment/api/followme
4 > accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
4 > accept-encoding: gzip, deflate, sdch, br
4 > accept-language: en-US,en;q=0.8
4 > connection: keep-alive
4 > cookie: JSESSIONID=BF4D95373B09490E3A3D2D2B3D19A0ED; LastLoggedInCookieUserName=i0HMn+Mq9r/1hS9LOclsJ2bUNBEOvtQQ; Yui3ConfigFilter=""
4 > host: localhost:8080
4 > upgrade-insecure-requests: 1
4 > user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

2017-03-23 13:50:54,876 [http-bio-8080-exec-10] ERROR AbstractExceptionMapper.java:45 com.stratahealth.shared.common.rest.exceptions.mappers.WebApplicationExceptionMapper null - WebApplicationException occurred in a route
Reason: 404 - Not Found
Exception Message: HTTP 404 Not Found
Failure Code: 'daa59fb0-7bcc-4f33-bb63-c9dd26360729'
Mar 23, 2017 1:50:54 PM org.glassfish.jersey.filter.LoggingFilter log
INFO: 4 * Server responded with a response on thread http-bio-8080-exec-10
4 < 404
4 < Content-Type: application/json

  • loaded the code right when I upgraded to Jersey 2.25. Tested using Chrome and hitting the route using the url /api/app/test. It redirected me to the /api/followme
      • Jersey2.25 —

Mar 23, 2017 2:06:01 PM com.sun.jersey.api.container.filter.LoggingFilter filter
INFO: 5 * Server in-bound request
5 > GET http://localhost:8080/test/PWAssessment/api/app/test
5 > host: localhost:8080
5 > connection: keep-alive
5 > pragma: no-cache
5 > cache-control: no-cache
5 > upgrade-insecure-requests: 1
5 > user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
5 > accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
5 > accept-encoding: gzip, deflate, sdch, br
5 > accept-language: en-US,en;q=0.8
5 > cookie: JSESSIONID=BF4D95373B09490E3A3D2D2B3D19A0ED; LastLoggedInCookieUserName=i0HMn+Mq9r/1hS9LOclsJ2bUNBEOvtQQ; Yui3ConfigFilter=""
5 >

Mar 23, 2017 2:06:01 PM com.sun.jersey.api.container.filter.LoggingFilter$Adapter finish
INFO: 5 * Server out-bound response
5 < 307
5 < Location: followme
5 <

Mar 23, 2017 2:06:01 PM com.sun.jersey.api.container.filter.LoggingFilter filter
INFO: 6 * Server in-bound request
6 > GET http://localhost:8080/test/PWAssessment/api/app/followme
6 > host: localhost:8080
6 > connection: keep-alive
6 > pragma: no-cache
6 > cache-control: no-cache
6 > upgrade-insecure-requests: 1
6 > user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
6 > accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
6 > accept-encoding: gzip, deflate, sdch, br
6 > accept-language: en-US,en;q=0.8
6 > cookie: JSESSIONID=BF4D95373B09490E3A3D2D2B3D19A0ED; LastLoggedInCookieUserName=i0HMn+Mq9r/1hS9LOclsJ2bUNBEOvtQQ; Yui3ConfigFilter=""
6 >

Mar 23, 2017 2:06:01 PM com.sun.jersey.api.container.filter.LoggingFilter$Adapter finish
INFO: 6 * Server out-bound response
6 < 200
6 <

Let me know if you need more information. Regards.

Comment by luisjotapepe [ 23/Mar/17 ]

The first test was actually with Jersey 2.25 and second with 1.17. I pasted it backwards.

Comment by Pavel Bucek [ 23/Mar/17 ]

this part:

2017-03-23 13:50:54,876  [http-bio-8080-exec-10] ERROR AbstractExceptionMapper.java:45 com.stratahealth.shared.common.rest.exceptions.mappers.WebApplicationExceptionMapper null - WebApplicationException occurred in a route 
	 Reason: 404 - Not Found 
	 Exception Message: HTTP 404 Not Found
	 Failure Code: 'daa59fb0-7bcc-4f33-bb63-c9dd26360729'
Mar 23, 2017 1:50:54 PM org.glassfish.jersey.filter.LoggingFilter log
INFO: 4 * Server responded with a response on thread http-bio-8080-exec-10
4 < 404
4 < Content-Type: application/json

is suspicious. Can you investigate the mentioned exception mapper? (WebApplicationExceptionMapper). I'd think that there is some exception, which was for some reason mapped to 404.

Comment by evgheni.s [ 23/Mar/17 ]

Hi Pavel, thank you for the prompt response. ERROR AbstractExceptionMapper.java:45 exception is caused due to the invalid URL. E.g. resource @ http://localhost:8080/test/PWAssessment/api/followme does not exist in our sample controller.

The proper URL for that route should be: http://localhost:8080/test/PWAssessment/api/app/followme

Please see additional details below...

With Jersey 1.7 the following response was causing a proper redirect to the above URL:

Chrome request:
3 > GET http://localhost:8080/test/PWAssessment/api/app/test
3 > accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
...

Jersey 1.7 Response:
5 < 307
5 < Location: followme
5 <

Client's followup request:
6 > GET http://localhost:8080/test/PWAssessment/api/app/followme
6 > host: localhost:8080
6 > connection: keep-alive
...

Now with an upgrade to Jersey 2.25 exactly the same sequence is interpreted by the same client in a different way:

Chrome request:
5 > GET http://localhost:8080/test/PWAssessment/api/app/test
5 > host: localhost:8080
...

Jersey 2.25 Response:
3 < 307
3 < Location: followme

Client's followup request (note the word 'app' got removed some how):
6 > GET http://localhost:8080/test/PWAssessment/api/followme
6 > host: localhost:8080
6 > connection: keep-alive

We have tried this with Chrome, Firefox Dev Edition and 'Poster' plugin for Firefox in normal and incognito modes against the same route with both versions of Jersey, but the outcome is always the same.
Somehow 'app' portion from the final GET request is getting lost in the end of that sequence with Jersey 2.25. Causing the 404 error which you had mentioned in your comment above.

We did de-compiled both ResponseBuilder and Response classes from both versions of the Jersey in order to run a diff on the source code, but it turned out to be identical with each pair.

Comment by Pavel Bucek [ 24/Mar/17 ]

you need to share WebApplicationExceptionMapper.java with us there.

The code you've presented doesn't have anything to do with the exception or the URI building process - as you can see, the initial responses from both Jersey versions are exactly the same (notice the same value of Location header). So the issue is somewhere else in the code which is not part of your report.

Comment by luisjotapepe [ 24/Mar/17 ]

Hi Pavel,

Here is the class:

@Provider
public class WebApplicationExceptionMapper extends AbstractExceptionMapper<WebApplicationException>{
	
	@Override
	public Response toResponse(WebApplicationException ex) {
		int status = ex.getResponse().getStatus();
		// using Apache HttpStatus because more status codes seem to be supported than javax Response.Status.fromStatusCode
		String reasonPhrase = HttpStatus.valueOf(status).getReasonPhrase();
		String externalMessage = "Unable to process your request - HTTP Status Message: " + reasonPhrase;
		String internalMessage = String.format("WebApplicationException occurred in a route \n\t Reason: %s - %s", status, reasonPhrase, ex.getMessage());
		if (ex.getMessage() != null)
			internalMessage += " \n\t Exception Message: " + ex.getMessage();
		return restExceptionResponse(internalMessage, externalMessage, status);
	}
	
}

It is really no more than a place for us to catch generic error responses. I set a breakpoint here and I can validate that when I get here (after being redirected ), the exception is a javax.ws.rs.NotFoundException (404). This makes sense I am being redirected to api/followme which doesn't exist.

I understand that the Response header Location: followme is the same for both responses, but I can't figure out why this is happening. We use multiple clients (Chrome, RestClient, Postman) and the behavior is still the same.

Comment by luisjotapepe [ 24/Mar/17 ]

Ok so now I tried running it with curl now.

curl -v http://localhost:8080/test/PWAssessment/api/app/test

I'm not following redirects so we can see what it returns from the first request.

Here are the results:
*Jersey 2.25*

* Hostname was NOT found in DNS cache
*   Trying ::1...
* Connected to localhost (::1) port 8080 (#0)
> GET /test/PWAssessment/api/app/test HTTP/1.1
> User-Agent: curl/7.38.0
> Host: localhost:8080
> Accept: */*
> 
< HTTP/1.1 307 Temporary Redirect
* Server Apache-Coyote/1.1 is not blacklisted
< Server: Apache-Coyote/1.1
< Location: http://localhost:8080/test/PWAssessment/api/followme
< Content-Length: 0
< Date: Fri, 24 Mar 2017 14:14:47 GMT
< 

Here header looks like this Location: http://localhost:8080/test/PWAssessment/api/followme

*Jersey 1.17*

* Hostname was NOT found in DNS cache
*   Trying ::1...
* Connected to localhost (::1) port 8080 (#0)
> GET /test/PWAssessment/api/app/test HTTP/1.1
> User-Agent: curl/7.38.0
> Host: localhost:8080
> Accept: */*
> 
< HTTP/1.1 307 Temporary Redirect
* Server Apache-Coyote/1.1 is not blacklisted
< Server: Apache-Coyote/1.1
< Location: followme
< Content-Length: 0
< Date: Fri, 24 Mar 2017 14:20:46 GMT
< 
* Connection #0 to host localhost left intact

Here header looks like this Location: followme

This makes more sense now and we can see that the Location header is actually different. We do not have anything that should've changed this; unless Jersey has some configuration that I am not aware of.

Comment by Pavel Bucek [ 24/Mar/17 ]

ah, finally, that helps.

Seems like you are hitting consequence of JERSEY-2714

Setting https://jersey.java.net/apidocs/2.22.1/jersey/org/glassfish/jersey/server/ServerProperties.html#LOCATION_HEADER_RELATIVE_URI_RESOLUTION_RFC7231 to true should fix the issue.

Comment by luisjotapepe [ 24/Mar/17 ]

Thanks a lot. Seems like the one. I'll give it a shot and let you know.

Comment by evgheni.s [ 24/Mar/17 ]

Thank you, Pavel. This seems to solve the mystery for us





[JERSEY-3254] Response.InputStream not consumed in HttpAuthenticationFeature (Challenge-Response on authentication) Created: 24/Mar/17  Updated: 24/Mar/17

Status: Open
Project: jersey
Component/s: core
Affects Version/s: 2.5, 2.23.1, 2.25.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: miiep Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: client, jersey
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

jersey-client, java7, HttpAuthenticator

{filter}


 Description   

This is a really tricky issue.

Steps to Reproduce:

Sample Webservice:

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;

import com.prostep.openpdm.bibo.jaxb.JaxbListWrapper;
import com.prostep.openpdm.opws.activity.ActivityId;
import com.prostep.openpdm.opws.service.vo.PropertyVO;

@Path("/")
public class TestRest  {

    @Path("test")
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String testValue(@QueryParam("one") JaxbListWrapper<PropertyVO> value1, @QueryParam("other") String value2,
            @QueryParam("test") String test) {
        return "true";
    }

    @Path("test")
    @GET
    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
    public ActivityId testValueJSON(@QueryParam("one") JaxbListWrapper<PropertyVO> value1,
            @QueryParam("other") String value2, @QueryParam("test") String test) {
        return new ActivityId("true");
    }

}

sample client:

import java.net.URISyntaxException;
import java.util.stream.LongStream;

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.client.Invocation.Builder;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;

import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
import org.glassfish.jersey.jackson.JacksonFeature;
import org.glassfish.jersey.media.multipart.MultiPartFeature;
import org.glassfish.jersey.message.MessageProperties;
import org.junit.Test;

import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;

public class Test401 {

    private TestClient c;

    public void setUp() throws Exception {
        c = TestClient.newInstance("some.url");
    }

    private static class TestClient {

        private Client client = null;

        private String url;

        public TestClient(String url) {
            this.url = url;
        }

        public String callTestPlain(String one, String other, String query) throws Exception {
            WebTarget resource = getResource().path("test").path("test");
            resource = resource.queryParam("one", one);
            resource = resource.queryParam("other", other);
            resource = resource.queryParam("test", query);

            Builder accept = resource.request(MediaType.TEXT_PLAIN_TYPE);
            Response response = accept.get();

            evaluateResponse(response);

            return response.readEntity(String.class);
        }

        private WebTarget getResource() throws URISyntaxException {
            return getClient().target(url);

        }

        public String callTestJSON(String one, String other, String query) throws Exception {
            WebTarget resource = getResource().path("test").path("test");
            resource = resource.queryParam("one", one);
            resource = resource.queryParam("other", other);
            resource = resource.queryParam("test", query);

            Builder accept = resource.request(MediaType.APPLICATION_JSON_TYPE);
            Response response = accept.get();

            evaluateResponse(response);

            return response.readEntity(String.class);
        }

        public String callTest(String one, String other, String query) throws Exception {
            WebTarget resource = getResource().path("test").path("test");
            resource = resource.queryParam("one", one);
            resource = resource.queryParam("other", other);
            resource = resource.queryParam("test", query);

            Builder accept = resource.request(MediaType.TEXT_PLAIN_TYPE);
            Response response = accept.get();

            return response.readEntity(String.class);
        }

        public static TestClient newInstance(final String url) throws Exception {
            return new TestClient(url);
        }

        private void evaluateResponse(final Response response) throws Exception {
            handleExceptions(response);
        }

        private void handleExceptions(final Response response) throws Exception {
            final int status = response.getStatus();
            if (Status.Family.SUCCESSFUL != response.getStatusInfo().getFamily()) {
                final String message = response.readEntity(String.class);
                if (Status.NOT_IMPLEMENTED.getStatusCode() == status) {
                    throw new Exception(message);
                } else if (Status.UNAUTHORIZED.getStatusCode() == status) {
                    throw new Exception(message);
                } else if (Status.BAD_REQUEST.getStatusCode() == status) {
                    throw new Exception(message);
                } else if (Status.NOT_FOUND.getStatusCode() == status) {
                    throw new Exception(message);
                } else if (Status.FORBIDDEN.getStatusCode() == status) {
                    throw new Exception(message);
                } else {
                    throw new Exception(message);
                }
            }
        }

        public void setHttpAuthCredentials(String user, String password) {
            HttpAuthenticationFeature feature = HttpAuthenticationFeature.universal(user, password);
            getClient().register(feature);

        }

        protected ClientConfig configureClient() {

            ClientConfig config = new ClientConfig();
            config.register(JacksonFeature.class);
            config.register(MultiPartFeature.class);
            config.register(new JacksonJaxbJsonProvider());

            // allows put with null values
            config.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true);
            config.property(ClientProperties.MOXY_JSON_FEATURE_DISABLE, true);
            config.property(MessageProperties.XML_FORMAT_OUTPUT, true);

            return config;
        }

        private Client getClient() {
            if (client == null) {
                ClientConfig config = configureClient();
                client = ClientBuilder.newClient(config);
            }
            return client;
        }

    }

    boolean toggle = true;
    private int amountParams = 1;

    @Test
    public void test401Error() throws Exception {

        c.setHttpAuthCredentials("openpdmadmin", "openpdmadmin");
        final String callee = "some.classpath.to.object.PropertyWrapper%23runTime%3D1%2Cparam0%3Dvalue0";
        LongStream.iterate(0, i -> i + 1).forEach(val -> call(callee, val));
    }

    private void call(String callee, long val) {
        try {
            if ((toggle = !toggle)) {
                c.callTestPlain(callee, String.valueOf(val), callee);
            } else {
                c.callTestJSON(callee, String.valueOf(val), callee);
            }
            if (val % 100l == 0) {
                System.out.println("Called " + val + " times test.");
            }
        } catch (Exception e) {
            System.err.println("finally we called " + val + " times webservice before failed.");
            e.printStackTrace();
            System.exit(1);
        }
    }
}

If you run this client, with digest authentication, this authentication method takes most advantage of that bug, but it can appear even if a lot of clients (about 600 - 25000 - is most likely to appear) are instantiated in a short time period (about 3 seconds) and authenticate via a Http Digest/Basic (nonpreeemptive) authentication.

For each unauthenticated response (WWW-Authenticate Header is set) the inputstream isn't validated/emptied by the HttpAuthenticationFeature.

With a network sniffing tool you can see a lot of open connections between client and server. In error case, an old TCP stream (SOCKET) is reused by java.net.HttpURLConnection (which shouldn't) and for some reason the request is sent twice by the HttpURLConnection.

In javadoc of HttpURLConnection and oracle documentation What can you do to help with Keep-Alive? it is highly recommended to consume input and error streams of HttpURLConnection to release this connection obejct for reuse in connection pooling.

so, a fix for this is:

From cc90e1131d730b32fc4982058080b90f6df29880 Mon Sep 17 00:00:00 2001
Date: Fri, 24 Mar 2017 14:06:09 +0100
Subject: [PATCH] test commit 401

---
 .../authentication/HttpAuthenticationFilter.java    | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/core-client/src/main/java/org/glassfish/jersey/client/authentication/HttpAuthenticationFilter.java b/core-client/src/main/java/org/glassfish/jersey/client/authentication/HttpAuthenticationFilter.java
index fc3e106..575d69e 100644
--- a/core-client/src/main/java/org/glassfish/jersey/client/authentication/HttpAuthenticationFilter.java
+++ b/core-client/src/main/java/org/glassfish/jersey/client/authentication/HttpAuthenticationFilter.java
@@ -50,6 +50,7 @@ import java.util.List;
 import java.util.Map;
 
 import javax.ws.rs.Priorities;
+import javax.ws.rs.ProcessingException;
 import javax.ws.rs.client.Client;
 import javax.ws.rs.client.ClientBuilder;
 import javax.ws.rs.client.ClientRequestContext;
@@ -316,7 +317,23 @@ class HttpAuthenticationFilter implements ClientRequestFilter, ClientResponseFil
         builder.headers(newHeaders);
 
         builder.property(REQUEST_PROPERTY_FILTER_REUSED, "true");
-
+        
+		/**
+         * Bugfix for some tricky issues, as they are:
+         * - Wrong 401, caused by a staled HttpConnection in ConnectionPool
+         * - Unexpected StreamClosedException, due to the same cause
+         * - Message Contend even if there is a call with no content issue: JERSEY-3145
+         */
+        {
+            InputStream suck = response.getEntityStream();
+            try {
+                /** Empty Stream, as described in {@link HttpURLConnection#getInputStream()} **/
+                while(suck.read() != -1); 
+            } catch (IOException e) {
+                throw new ProcessingException(e);
+            }
+        }
+		
         Invocation invocation;
         if (request.getEntity() == null) {
             invocation = builder.build(method);
@@ -328,7 +345,7 @@ class HttpAuthenticationFilter implements ClientRequestFilter, ClientResponseFil
 
         if (nextResponse.hasEntity()) {
             response.setEntityStream(nextResponse.readEntity(InputStream.class));
-        }
+	}
         MultivaluedMap<String, String> headers = response.getHeaders();
         headers.clear();
         headers.putAll(nextResponse.getStringHeaders());
-- 
2.10.2.windows.1



 Comments   
Comment by miiep [ 24/Mar/17 ]

While debugging this, i've also fixed: JERSEY-3145





[JERSEY-3145] Client return wrong content, if content is EMPTY on 200 OK Created: 27/Jul/16  Updated: 24/Mar/17

Status: Open
Project: jersey
Component/s: connectors
Affects Version/s: 2.22, 2.23.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: miiep Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Jersey, Jackson



 Description   

We have a Webserivce:

    @GET
    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
    public String getSomeValue( .... ) {

    }

Sometimes this Webservice returns an empty String. In this case, the Client side does strange things. The packet will be parsed two times (at least it will be printed 2 times by the LoggingFilter.

At first correctly:

Jul 27, 2016 12:02:40 PM org.glassfish.jersey.filter.LoggingFilter log
INFORMATION: 8 * Client response received on thread main
8 < 200
8 < Cache-Control: private
8 < Content-Length: 0
8 < Content-Type: application/xml
8 < Date: Wed, 27 Jul 2016 10:02:39 GMT
8 < Expires: Thu, 01 Jan 1970 01:00:00 CET
8 < Server: Apache-Coyote/1.1
8 < Set-Cookie: JSESSIONID=A1DAA8CB4B949BC6219B58CDD19EB949; Path=/; HttpOnly

Second wrong:

Jul 27, 2016 12:02:40 PM org.glassfish.jersey.filter.LoggingFilter log
INFORMATION: 7 * Client response received on thread main
7 < 200
7 < Cache-Control: private
7 < Content-Length: 0
7 < Content-Type: application/xml
7 < Date: Wed, 27 Jul 2016 10:02:39 GMT
7 < Expires: Thu, 01 Jan 1970 01:00:00 CET
7 < Server: Apache-Coyote/1.1
7 < Set-Cookie: JSESSIONID=A1DAA8CB4B949BC6219B58CDD19EB949; Path=/; HttpOnly
<html><head><title>OpenPDM Server - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 401 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>This request requires HTTP authentication.</u></p><HR size="1" noshade="noshade"><h3>OpenPDM Server</h3></body></html>

The error seems to be either the first or last (cannot be verified) occured error for this client instance.
We use digest authentication, but this is not or at least should not be the root cause.



 Comments   
Comment by miiep [ 24/Mar/17 ]

found an solution for this:

From 93d408ada518b9c9c450172dc6371b04b635c45a Mon Sep 17 00:00:00 2001
Date: Fri, 24 Mar 2017 14:06:29 +0100
Subject: [PATCH] test fix empty content

---
 .../authentication/HttpAuthenticationFilter.java   | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/core-client/src/main/java/org/glassfish/jersey/client/authentication/HttpAuthenticationFilter.java b/core-client/src/main/java/org/glassfish/jersey/client/authentication/HttpAuthenticationFilter.java
index 575d69e..c4cc0ca 100644
--- a/core-client/src/main/java/org/glassfish/jersey/client/authentication/HttpAuthenticationFilter.java
+++ b/core-client/src/main/java/org/glassfish/jersey/client/authentication/HttpAuthenticationFilter.java
@@ -345,7 +345,11 @@ class HttpAuthenticationFilter implements ClientRequestFilter, ClientResponseFil
 
         if (nextResponse.hasEntity()) {
             response.setEntityStream(nextResponse.readEntity(InputStream.class));
+        } else {
+            response.setEntityStream(EmptyInputStream.INSTANCE);
 	}
+		
+		
         MultivaluedMap<String, String> headers = response.getHeaders();
         headers.clear();
         headers.putAll(nextResponse.getStringHeaders());
@@ -459,4 +463,27 @@ class HttpAuthenticationFilter implements ClientRequestFilter, ClientResponseFil
             return specificCredentials != null ? specificCredentials : defaultCredentials;
         }
     }
+	
+	
+	
+    private static final class EmptyInputStream extends InputStream {
+
+        static final EmptyInputStream INSTANCE = new EmptyInputStream();
+
+        private EmptyInputStream() {}
+
+        @Override
+        public int available() throws IOException {
+            return 0;
+        }
+
+
+        @Override
+        public int read() throws IOException {
+            return -1;
+        }
+
+    }
+
+
 }
-- 
2.10.2.windows.1

Code change depends on changes in issue: JERSEY-3254





[JERSEY-3225] @Immediate binding fail after Container#reload Created: 24/Jan/17  Updated: 18/Mar/17

Status: Open
Project: jersey
Component/s: core
Affects Version/s: 2.25.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: fabrizio.cucci Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I managed to reproduce this with a simple gist.

The code is really self-explanatory but basically I'm binding a service with Immediate scope and then trying to reload the application using the org.glassfish.jersey.server.spi.Container#reload method.

The result is the following exception:

Jan 24, 2017 11:15:23 PM org.glassfish.grizzly.http.server.NetworkListener start
INFO: Started listener bound to [localhost:8080]
Jan 24, 2017 11:15:23 PM org.glassfish.grizzly.http.server.HttpServer start
INFO: [HttpServer] Started.
Exception in thread "main" javax.ws.rs.InternalServerErrorException: HTTP 500 Request failed.
	at org.glassfish.jersey.client.JerseyInvocation.convertToException(JerseyInvocation.java:1032)
	at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:819)
	at org.glassfish.jersey.client.JerseyInvocation.access$700(JerseyInvocation.java:92)
	at org.glassfish.jersey.client.JerseyInvocation$2.call(JerseyInvocation.java:701)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:444)
	at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:697)
	at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:420)
	at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:316)
	at com.github.fabriziocucci.App.main(App.java:102)
Jan 24, 2017 11:15:23 PM org.glassfish.jersey.internal.Errors logErrors
WARNING: The following warnings have been detected: WARNING: Unknown HK2 failure detected:
MultiException stack 1 of 4
java.lang.IllegalStateException: Could not find an active context for org.glassfish.hk2.api.Immediate
	at org.jvnet.hk2.internal.ServiceLocatorImpl._resolveContext(ServiceLocatorImpl.java:2200)
	at org.jvnet.hk2.internal.ServiceLocatorImpl.access$000(ServiceLocatorImpl.java:125)
	at org.jvnet.hk2.internal.ServiceLocatorImpl$3.compute(ServiceLocatorImpl.java:185)
	at org.jvnet.hk2.internal.ServiceLocatorImpl$3.compute(ServiceLocatorImpl.java:181)
	at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154)
	at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199)
	at org.jvnet.hk2.internal.ServiceLocatorImpl.resolveContext(ServiceLocatorImpl.java:2208)
	at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2000)
	at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:682)
	at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:78)
	at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:212)
	at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:229)
	at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:358)
	at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:487)
	at org.glassfish.jersey.process.internal.RequestScope.findOrCreate(RequestScope.java:162)
	at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2022)
	at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:774)
	at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:737)
	at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:707)
	at org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:172)
	at org.glassfish.jersey.server.model.MethodHandler$ClassBasedMethodHandler.getInstance(MethodHandler.java:284)
	at org.glassfish.jersey.server.internal.routing.PushMethodHandlerRouter.apply(PushMethodHandlerRouter.java:74)
	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:109)
	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
	at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:92)
	at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:61)
	at org.glassfish.jersey.process.internal.Stages.process(Stages.java:197)
	at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:318)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
	at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:384)
	at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:224)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
	at java.lang.Thread.run(Thread.java:745)
MultiException stack 2 of 4
java.lang.IllegalStateException: While attempting to create a service for SystemDescriptor(
	implementation=com.github.fabriziocucci.App$ImmediateGreetingService
	contracts={com.github.fabriziocucci.App$ImmediateGreetingService}
	scope=org.glassfish.hk2.api.Immediate
	qualifiers={}
	descriptorType=CLASS
	descriptorVisibility=NORMAL
	metadata=
	rank=0
	loader=org.glassfish.hk2.utilities.binding.AbstractBinder$2@7462aabb
	proxiable=null
	proxyForSameScope=null
	analysisName=null
	id=122
	locatorId=3
	identityHashCode=231711221
	reified=true) in scope org.glassfish.hk2.api.Immediate an error occured while locating the context
	at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2005)
	at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:682)
	at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:78)
	at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:212)
	at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:229)
	at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:358)
	at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:487)
	at org.glassfish.jersey.process.internal.RequestScope.findOrCreate(RequestScope.java:162)
	at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2022)
	at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:774)
	at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:737)
	at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:707)
	at org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:172)
	at org.glassfish.jersey.server.model.MethodHandler$ClassBasedMethodHandler.getInstance(MethodHandler.java:284)
	at org.glassfish.jersey.server.internal.routing.PushMethodHandlerRouter.apply(PushMethodHandlerRouter.java:74)
	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:109)
	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
	at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:92)
	at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:61)
	at org.glassfish.jersey.process.internal.Stages.process(Stages.java:197)
	at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:318)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
	at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:384)
	at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:224)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
	at java.lang.Thread.run(Thread.java:745)
MultiException stack 3 of 4
java.lang.IllegalArgumentException: While attempting to resolve the dependencies of com.github.fabriziocucci.App$HelloWorldResource errors were found
	at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:247)
	at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:358)
	at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:487)
	at org.glassfish.jersey.process.internal.RequestScope.findOrCreate(RequestScope.java:162)
	at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2022)
	at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:774)
	at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:737)
	at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:707)
	at org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:172)
	at org.glassfish.jersey.server.model.MethodHandler$ClassBasedMethodHandler.getInstance(MethodHandler.java:284)
	at org.glassfish.jersey.server.internal.routing.PushMethodHandlerRouter.apply(PushMethodHandlerRouter.java:74)
	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:109)
	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
	at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:92)
	at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:61)
	at org.glassfish.jersey.process.internal.Stages.process(Stages.java:197)
	at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:318)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
	at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:384)
	at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:224)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
	at java.lang.Thread.run(Thread.java:745)
MultiException stack 4 of 4
java.lang.IllegalStateException: Unable to perform operation: resolve on com.github.fabriziocucci.App$HelloWorldResource
	at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:387)
	at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:487)
	at org.glassfish.jersey.process.internal.RequestScope.findOrCreate(RequestScope.java:162)
	at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2022)
	at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:774)
	at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:737)
	at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:707)
	at org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:172)
	at org.glassfish.jersey.server.model.MethodHandler$ClassBasedMethodHandler.getInstance(MethodHandler.java:284)
	at org.glassfish.jersey.server.internal.routing.PushMethodHandlerRouter.apply(PushMethodHandlerRouter.java:74)
	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:109)
	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
	at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:92)
	at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:61)
	at org.glassfish.jersey.process.internal.Stages.process(Stages.java:197)
	at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:318)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
	at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:384)
	at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:224)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
	at java.lang.Thread.run(Thread.java:745)



 Comments   
Comment by fabrizio.cucci [ 25/Jan/17 ]

I was looking into the code and I may have found the issue.

When the application starts for the first time, the ApplicationHandler#initialize method is invoked, which in turn does:

// Configure binders and features.
runtimeConfig.configureMetaProviders(locator);

That results in a call to the CommonConfig#configureMetaProviders which does:

// Next, configure all features
configureFeatures(
    locator,
    new HashSet<FeatureRegistration>(),
    resetRegistrations());

The CommonConfig#resetRegistrations method copies the list of FeatureRegistration and then clears the list:

private List<FeatureRegistration> resetRegistrations() {
    final List<FeatureRegistration> result = new ArrayList<FeatureRegistration>(newFeatureRegistrations);
    newFeatureRegistrations.clear();
    return result;
}

When the Container#reload method is invoked, because the same ApplicationHandler#runtimeConfig is used, my ImmediateScopeFeature won't be in the CommonConfig#newFeatureRegistrations anymore and therefore won't be configured.

I don't have a big picture of the codebase but the two options that I can think of are:

  • not clearing the list of FeatureRegistrations in CommonConfig#resetRegistrations (but if it's done I bet there is a good reason!);
  • changing the Container#reload() to use a brand new RuntimeConfig created from the original Application or ResourceConfig (maybe exposing some utility from the ApplicationHandler?).

Of course, calling the overloaded version of Container#reload(ResourceConfig) works fine because the RuntimeConfig is not reused.

By the way, I would be glad to contribute the fix with some hint.

Comment by fabrizio.cucci [ 18/Mar/17 ]

Also, after re-reading my own report, I realized something else. In my case, the ImmediateScopeFeature is removed from the CommonConfig#newFeatureRegistrations and this is the reason why it's not re-configured on Container#reload(). But this means that, potentially, any other custom feature won't be re-configured upon Container#reload().





[JERSEY-3252] NPE after ClientAbortException Created: 17/Mar/17  Updated: 17/Mar/17

Status: Open
Project: jersey
Component/s: containers, release
Affects Version/s: 2.25.1
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: agerasch Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Debian, Oracle Java 8u121, Tomcat 8.5.11 or 8.5.12



 Description   

After querying jersey and aborting the request I get the expected BrokenPipe and ClientAbort exceptions. But after that, I get a NPE while the server is trying to close the connection.

Setup: Jersey 2.25.1 in Apache Tomcat 8.5.12, but older versions are also affected.

Stacktrace:

monospaced
Mar 17, 2017 3:41:49 PM org.apache.coyote.AbstractProcessor setErrorState
INFO: An error occurred in processing while on a non-container thread. The connection will be closed immediately
java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
at sun.nio.ch.IOUtil.write(IOUtil.java:65)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471)
at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:134)
at org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:101)
at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:157)
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1245)
at org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:670)
at org.apache.tomcat.util.net.SocketWrapperBase.writeBlocking(SocketWrapperBase.java:450)
at org.apache.tomcat.util.net.SocketWrapperBase.write(SocketWrapperBase.java:388)
at org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.doWrite(Http11OutputBuffer.java:583)
at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:123)
at org.apache.coyote.http11.Http11OutputBuffer.doWrite(Http11OutputBuffer.java:224)
at org.apache.coyote.Response.doWrite(Response.java:518)
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:351)
at org.apache.catalina.connector.OutputBuffer.flushByteBuffer(OutputBuffer.java:808)
at org.apache.catalina.connector.OutputBuffer.append(OutputBuffer.java:713)
at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:391)
at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:369)
at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:96)
at org.glassfish.jersey.servlet.internal.ResponseWriter$NonCloseableOutputStreamWrapper.write(ResponseWriter.java:325)
at org.glassfish.jersey.message.internal.CommittingOutputStream.write(CommittingOutputStream.java:229)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$UnCloseableOutputStream.write(WriterInterceptorExecutor.java:299)
at com.fasterxml.jackson.core.json.UTF8JsonGenerator._flushBuffer(UTF8JsonGenerator.java:2033)
at com.fasterxml.jackson.core.json.UTF8JsonGenerator.writeFieldName(UTF8JsonGenerator.java:213)
at com.fasterxml.jackson.databind.ser.std.StdKeySerializers$StringKeySerializer.serialize(StdKeySerializers.java:220)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFieldsUsing(MapSerializer.java:728)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:534)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:30)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:704)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:690)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:119)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:79)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:18)
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:292)
at com.fasterxml.jackson.databind.ObjectWriter$Prefetch.serialize(ObjectWriter.java:1419)
at com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:940)
at com.fasterxml.jackson.jaxrs.base.ProviderBase.writeTo(ProviderBase.java:618)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
at org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:106)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:86)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1130)
at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:711)
at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:444)
at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:434)
at org.glassfish.jersey.server.ServerRuntime$AsyncResponder$3.run(ServerRuntime.java:934)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime$AsyncResponder.resume(ServerRuntime.java:966)
at org.glassfish.jersey.server.ServerRuntime$AsyncResponder.resume(ServerRuntime.java:922)
at de.cegat.diag.server.jersey.resources.ManagementResource.getAllVariants(ManagementResource.java:394)
at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$VoidOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:143)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.access$100(ResourceMethodInvoker.java:102)
at org.glassfish.jersey.server.model.ResourceMethodInvoker$2.call(ResourceMethodInvoker.java:336)
at org.glassfish.jersey.server.model.ResourceMethodInvoker$2.call(ResourceMethodInvoker.java:333)
at org.glassfish.jersey.server.ServerRuntime$AsyncResponder$2$1.run(ServerRuntime.java:893)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime$AsyncResponder$2.run(ServerRuntime.java:888)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Mar 17, 2017 3:42:00 PM org.glassfish.jersey.server.ServerRuntime$Responder writeResponse
SEVERE: An I/O error has occurred while writing a response message entity to the container output stream.
org.glassfish.jersey.server.internal.process.MappableException: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe
at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:92)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1130)
at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:711)
at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:444)
at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:434)
at org.glassfish.jersey.server.ServerRuntime$AsyncResponder$3.run(ServerRuntime.java:934)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime$AsyncResponder.resume(ServerRuntime.java:966)
at org.glassfish.jersey.server.ServerRuntime$AsyncResponder.resume(ServerRuntime.java:922)
at de.cegat.diag.server.jersey.resources.ManagementResource.getAllVariants(ManagementResource.java:394)
at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$VoidOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:143)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.access$100(ResourceMethodInvoker.java:102)
at org.glassfish.jersey.server.model.ResourceMethodInvoker$2.call(ResourceMethodInvoker.java:336)
at org.glassfish.jersey.server.model.ResourceMethodInvoker$2.call(ResourceMethodInvoker.java:333)
at org.glassfish.jersey.server.ServerRuntime$AsyncResponder$2$1.run(ServerRuntime.java:893)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime$AsyncResponder$2.run(ServerRuntime.java:888)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:356)
at org.apache.catalina.connector.OutputBuffer.flushByteBuffer(OutputBuffer.java:808)
at org.apache.catalina.connector.OutputBuffer.append(OutputBuffer.java:713)
at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:391)
at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:369)
at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:96)
at org.glassfish.jersey.servlet.internal.ResponseWriter$NonCloseableOutputStreamWrapper.write(ResponseWriter.java:325)
at org.glassfish.jersey.message.internal.CommittingOutputStream.write(CommittingOutputStream.java:229)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$UnCloseableOutputStream.write(WriterInterceptorExecutor.java:299)
at com.fasterxml.jackson.core.json.UTF8JsonGenerator._flushBuffer(UTF8JsonGenerator.java:2033)
at com.fasterxml.jackson.core.json.UTF8JsonGenerator.writeFieldName(UTF8JsonGenerator.java:213)
at com.fasterxml.jackson.databind.ser.std.StdKeySerializers$StringKeySerializer.serialize(StdKeySerializers.java:220)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFieldsUsing(MapSerializer.java:728)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:534)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:30)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:704)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:690)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:119)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:79)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:18)
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:292)
at com.fasterxml.jackson.databind.ObjectWriter$Prefetch.serialize(ObjectWriter.java:1419)
at com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:940)
at com.fasterxml.jackson.jaxrs.base.ProviderBase.writeTo(ProviderBase.java:618)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
at org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:106)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:86)
... 40 more
Caused by: java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
at sun.nio.ch.IOUtil.write(IOUtil.java:65)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471)
at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:134)
at org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:101)
at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:157)
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1245)
at org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:670)
at org.apache.tomcat.util.net.SocketWrapperBase.writeBlocking(SocketWrapperBase.java:450)
at org.apache.tomcat.util.net.SocketWrapperBase.write(SocketWrapperBase.java:388)
at org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.doWrite(Http11OutputBuffer.java:583)
at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:123)
at org.apache.coyote.http11.Http11OutputBuffer.doWrite(Http11OutputBuffer.java:224)
at org.apache.coyote.Response.doWrite(Response.java:518)
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:351)
... 70 more

Mar 17, 2017 3:42:01 PM org.glassfish.jersey.server.ServerRuntime$Responder writeResponse
SEVERE: Error while closing the output stream in order to commit response.
java.lang.NullPointerException
at org.apache.coyote.http11.Http11OutputBuffer.commit(Http11OutputBuffer.java:352)
at org.apache.coyote.http11.Http11Processor.prepareResponse(Http11Processor.java:1288)
at org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:254)
at org.apache.coyote.Response.action(Response.java:170)
at org.apache.coyote.Response.sendHeaders(Response.java:352)
at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:303)
at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:284)
at org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:118)
at org.glassfish.jersey.servlet.internal.ResponseWriter$NonCloseableOutputStreamWrapper.flush(ResponseWriter.java:330)
at org.glassfish.jersey.message.internal.CommittingOutputStream.flush(CommittingOutputStream.java:292)
at org.glassfish.jersey.message.internal.OutboundMessageContext.close(OutboundMessageContext.java:876)
at org.glassfish.jersey.server.ContainerResponse.close(ContainerResponse.java:412)
at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:784)
at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:444)
at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:434)
at org.glassfish.jersey.server.ServerRuntime$AsyncResponder$3.run(ServerRuntime.java:934)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime$AsyncResponder.resume(ServerRuntime.java:966)
at org.glassfish.jersey.server.ServerRuntime$AsyncResponder.resume(ServerRuntime.java:922)
at de.cegat.diag.server.jersey.resources.ManagementResource.getAllVariants(ManagementResource.java:394)
at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$VoidOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:143)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.access$100(ResourceMethodInvoker.java:102)
at org.glassfish.jersey.server.model.ResourceMethodInvoker$2.call(ResourceMethodInvoker.java:336)
at org.glassfish.jersey.server.model.ResourceMethodInvoker$2.call(ResourceMethodInvoker.java:333)
at org.glassfish.jersey.server.ServerRuntime$AsyncResponder$2$1.run(ServerRuntime.java:893)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime$AsyncResponder$2.run(ServerRuntime.java:888)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
monospaced

The problem occurs because the recyle() in Http11OutputBuffer is called (which sets socketWrapper to null) before the commit() is called.

The cause may also be a bug in Tomcat, but I'm not able not decide this.



 Comments   
Comment by Pavel Bucek [ 17/Mar/17 ]

as you mention, this seems to be more likely bug in the code, which Jersey cannot really influence, in this case packages org.apache.catalina and org.apache.coyote. If you can reproduce this on glassfish, we can take closer look..





[JERSEY-3251] Register Entity Filter and Selectable Entity Filter Features Together Created: 16/Mar/17  Updated: 17/Mar/17

Status: Open
Project: jersey
Component/s: core, extensions
Affects Version/s: 2.25.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: pml984 Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I would like to use both the EntityFilteringFeature and SelectableEntityFilteringFeature together. Right now, the SelectableEntityFilteringFeature trumps the ordinary entity filtering as soon as I register it in my ResourceConfig. Is there any way to currently do this or could this be added to allow both these features to work together?



 Comments   
Comment by Pavel Bucek [ 16/Mar/17 ]

Can you demonstrate what you'd like to do with a code snippet?

SelectableEntityFilteringFeature registers EntityFilteringFeature if not already registered, so it seems you can use them together already.

Comment by pml984 [ 17/Mar/17 ]

I saw that it was registering it, but I think the SelectableEntityFilteringFeature may be just using piggy backing off of the functionality from the EntityFilteringFeature and overriding what it needed to in the SelectableEntityProcessor and SelectableScopProcessor. Right now when I try to use the functionality from both, the selectable functionality is enabled, but the actual entity filtering that uses annotations no longer works. A good example of this is to register the SelectableEntityFilteringFeature in the default Entity Filtering example Jersey provides. You should see the same thing that I am noticing where all of the annotated fields and REST methods no longer are being filtered properly.

https://github.com/jersey/jersey/tree/2.25.x/examples/entity-filtering

Below is what it would look like changed:

EntityFilteringApplication.java
@ApplicationPath("/")
public class EntityFilteringApplication extends ResourceConfig {

    public EntityFilteringApplication() {
        // Register all resources present under the package.
        packages("org.glassfish.jersey.examples.entityfiltering");

        // Entity Data Filtering feature.
        register(EntityFilteringFeature.class);

        // Register entity-filtering selectable feature.
        register(SelectableEntityFilteringFeature.class);
        property(SelectableEntityFilteringFeature.QUERY_PARAM_NAME, "select");

        // Configure MOXy Json provider. Comment this line to use Jackson. Uncomment to use MOXy.
        register(new MoxyJsonConfig().setFormattedOutput(true).resolver());

        // Configure Jackson Json provider. Comment this line to use MOXy. Uncomment to use Jackson.
        // register(JacksonFeature.class);
    }
}

After debugging the source, I couldn't' quite figure out how things were working with the filtering. I was able to guess what is going on though. It appears that the @Priority on the SelectableEntityProcessor is higher than the one used by the DefaultEntityProcessor. It picks up that processor and uses it instead of the default. I extended the SelectableEntityProcessor and changed the priority. Once changed, I registered the extended copy and it caused the functionality to change, but still not as how it should.





[JERSEY-3250] ComponentProvider ... Contract type not supported Created: 16/Mar/17  Updated: 16/Mar/17

Status: Open
Project: jersey
Component/s: containers, osgi
Affects Version/s: 2.22.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: frosenberger Assignee: Pavel Bucek
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

OSGi R5 (Apache Felix)



 Description   

I am currently trying to integrate Jersey (version 2.22.2) into a OSGi runtime based on Apache Felix. To be able to use Declarative Service references (@Reference) in my resources I need to control the resource lifecycle with OSGi instead of Jersey.

Chapter 23.3. Custom Life Cycle Management of the Jersey User Guide illustrates how the resource lifecycle can be taken control over by implementing the org.glassfish.jersey.server.spi.ComponentProvider SPI.

I did just that, but when I try to register my ComponentProvider implementation I get the following error:

Contract interface org.glassfish.jersey.server.spi.ComponentProvider can not be registered for component class de.jena.servicehub.rs.OsgiResourceProvider: Contract type not supported.

I am registering all providers and and resources programmatically on a ResourceConfig instance which I use to initialize a ServletContainer instance. I have turned off classpath scanning and service discovery on my ResourceConfig.

.property(CommonProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true)					.property(CommonProperties.METAINF_SERVICES_LOOKUP_DISABLE, true)

I scoured the (2.22.2 and current) Jersey source code for the source of this error and ended up at the org.glassfish.jersey.internal.inject.Providers class's isSupportedContract(Class<?>) method. The method checks whether the contract class of the class to be registered (i.e. the implemented interface) is annotated with @Contract or if it is on one of two white lists. Neither is true for the ComponentProvider interface. Thus Jersey refuses to register my implementation.

I consider this a bug. ComponentProvider should be on the JAX_RS_PROVIDER_INTERFACE_WHITELIST.



 Comments   
Comment by Pavel Bucek [ 16/Mar/17 ]

not saying it is not a bug, but there is a workaround - you can register your component provider using META-INF/services, that way it will work for sure.

Comment by frosenberger [ 16/Mar/17 ]

The META-INF/services approach is not feasible for my situation. Some of my dependencies provide components that way, which I do not want Jersey to pick up. Therefore I rely on programmatic construction of my ResourceConfig. I would rather have full control on what gets registered anyway.

Comment by Pavel Bucek [ 16/Mar/17 ]

The actual issue here is that registering ComponentProvider as a @Provider programmatically is not as trivial as it might seem to be.

Instantiating @Providers might be needed to be done using ComponentProviders already, so this brings an interesting recursion - shouldn't we create instance of ComponentProvider by using some other ComponentProvider?

Jersey currently bootstraps ComponentProviders sooner than it touches ResourceConfig / Application class, because it might need to use it to create an instance of the Application (and resourced and providers it contains) using the ComponentProvider.

What might be able to solve your issue is to have some kind of plugin point in ApplicationHandler, where you could pass List<ComponentProvider>, right? (take a look at a method ApplicationHandler#getLazyInitializedComponentProviders(InjectionManager) ).





[JERSEY-3248] WebResourceFactory does not apply ParamConverterProvider Created: 14/Mar/17  Updated: 14/Mar/17

Status: Open
Project: jersey
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: matthies Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

WebResourceFactory#invoke() does not apply any ParamConverterProviders that are configured on the Client. The expected behavior would be to invoke the relevant ParamConverter#toString(T) implementation for @PathParam and @QueryParam parameters.

The fact that ParamConverterProviders are not applied prevents using the same shared interface and configuration on the server and client side when the interface relies on ParamConverterProviders.



 Comments   
Comment by Pavel Bucek [ 14/Mar/17 ]

Can you please provide a testcase?

Thanks,
Pavel

Comment by matthies [ 14/Mar/17 ]

Below is a complete example. The request URI generated by WebResourceFactory#invoke() is
http://localhost:8080/example/lookup/CN=John?issuer=CN%3DMike, but should be
http://localhost:8080/example/lookup/MA8xDTALBgNVBAMTBEpvaG4=?issuer=MA8xDTALBgNVBAMTBE1pa2U%3D.

import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import javax.security.auth.x500.X500Principal;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.ext.ParamConverter;
import javax.ws.rs.ext.ParamConverterProvider;
import javax.xml.bind.DatatypeConverter;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.proxy.WebResourceFactory;


public class Example
{
    public static void main(String[] args) throws Exception
    {
        WebTarget webTarget = ClientBuilder
            .newClient(new ClientConfig().register(new X500PrincipalParamConverter()))
            .target("http://localhost:8080/");

        WebResourceFactory
            .newResource(ExampleEndpoint.class, webTarget)
            .lookup(new X500Principal("CN=John"), new X500Principal("CN=Mike"));
    }

    
    @Path("example")
    interface ExampleEndpoint
    {
        @GET
        @Path("lookup/{subject}")
        public void lookup(
            @PathParam("subject") X500Principal subjectName,
            @QueryParam("issuer") X500Principal issuerName);
    }


    static final class X500PrincipalParamConverter
    implements ParamConverter<X500Principal>, ParamConverterProvider
    {
        @Override
        @SuppressWarnings("unchecked")
        public <T> ParamConverter<T> getConverter(
            Class<T> rawType, Type genericType, Annotation[] annotations)
        {
            return rawType == X500Principal.class ? (ParamConverter) this : null;
        }
        
        @Override
        public X500Principal fromString(String value)
        {
            return new X500Principal(DatatypeConverter.parseBase64Binary(value));
        }

        @Override
        public String toString(X500Principal value)
        {
            return DatatypeConverter.printBase64Binary(value.getEncoded());
        }
    }
}




[JERSEY-3247] Race condition in ChunkedOutput leads to unbounded queue growth. Created: 14/Mar/17  Updated: 14/Mar/17

Status: Open
Project: jersey
Component/s: core
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: tony-astolfi-tamr Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When a ChunkedOutput<T> is created inside a request handler and returned, ChunkedOutput.setContext has not yet been called, so requestScopeInstance, requestContext, and responseContext are all null. In this state, when ChunkedOutput.write is invoked, it does not (and can not!) wait for the written output to be flushed inside ChunkedOutput.flushQueue.

In our application, we saw this lead to a bad situation where the client/network were reading data slower than the server was writing it to the ChunkedOutput, and ChunkedOutput.setContext would get stuck inside flushQueue looping and reading from the queue while a background thread filled the queue on the other end. As a result, proper back-pressure was not applied to the writing thread and the heap ended up filling, leading to dropped connections and other badness.

It would be good to at least have the option of bounding the capacity of the queue in all cases so that no matter what in order setContext, write, etc. happen, we don't see this condition.






[JERSEY-3245] NullPointerException when declaring Application in web.xml without servlet-class Created: 13/Mar/17  Updated: 13/Mar/17

Status: Open
Project: jersey
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: fransflippo Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Payara Micro 4.1.1.164



 Description   

On https://jersey.java.net/nonav/documentation/2.0/deployment.html one of the deployment options described is the following:

{blockquote}
Another deployment option is to declare JAX-RS application details in theweb.xml. This is usually suitable in case of more complex deployments, e.g. when security model needs to be properly defined or when additional initialization parameters have to be passed to Jersey runtime. JAX-RS 1.1 specifies that a fully qualified name of the class that implements Application may be declared in the <servlet-name> element of the JAX-RS application's web.xml. This is supported in a Web container implementing Servlet 3.0 as follows:

Example 4.5. Deployment of a JAX-RS application using web.xml with Servlet 3.0

<web-app>
<servlet>
<servlet-name>org.foo.rest.MyApplication</servlet-name>
</servlet>
...
<servlet-mapping>
<servlet-name>org.foo.rest.MyApplication</servlet-name>
<url-pattern>/resources</url-pattern>
</servlet-mapping>
...
</web-app>

Note that the <servlet-class> element is omitted from the servlet declaration. This is a correct declaration utilizing the Servlet 3.0 extension mechanism. Also note that <servlet-mapping> is used to define the base resource URI.{blockquote}

However, when I try this on Payara Micro 4.1.1.164, I get a NullPointerException:

 java.lang.NullPointerException
        at org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer.addServletWithExistingRegistration(JerseyServletContainerInitializer.java:316)
        at org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer.onStartupImpl(JerseyServletContainerInitializer.java:161)
        at org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer.onStartup(JerseyServletContainerInitializer.java:144)
        at org.apache.catalina.core.StandardContext.callServletContainerInitializers(StandardContext.java:6062)
        ... 34 more

It seems that Payara/Glassfish interprets a missing servlet class as the <servlet> entry in web.xml as indicating that the servlet is a JSP and then the dynamic registration in JerseyServletContainerInitializer fails because a servlet of the same name already exists.

I can't quite tell whether this is a Glassfish or Jersey issue, so please advise.

At the very least, I think the documentation at https://jersey.java.net/nonav/documentation/2.0/deployment.html should warn that the "servlet 3.0 extension mechanism" doesn't work on Glassfish/Payara 4.1.1.



 Comments   
Comment by Pavel Bucek [ 13/Mar/17 ]

can you please test against glassfish as well? This could be payara issue.

Comment by fransflippo [ 13/Mar/17 ]

Just tested on a clean Glassfish 4.1.1 download. Same exception:

[2017-03-13T11:04:25.383+0200] [glassfish 4.1] [SEVERE] [AS-WEB-CORE-00108] [javax.enterprise.web.core] [tid: _ThreadID=52 _ThreadName=admin-listener(4)] [timeMillis: 1489395865383] [levelValue: 1000] [[
  ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.NullPointerException
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:5985)
	at com.sun.enterprise.web.WebModule.start(WebModule.java:691)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1041)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:1024)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:747)
	at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2286)
	at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1932)
	at com.sun.enterprise.web.WebApplication.start(WebApplication.java:139)
	at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
	at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
	at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:500)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
	at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:360)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:360)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
	at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:253)
	at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:231)
	at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:275)
	at org.glassfish.admin.rest.resources.TemplateListOfResource.createResource(TemplateListOfResource.java:133)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
	at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
	at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:309)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:292)
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1139)
	at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:375)
	at org.glassfish.admin.rest.adapter.RestAdapter$2.service(RestAdapter.java:316)
	at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:179)
	at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: java.lang.NullPointerException
	at org.apache.catalina.core.StandardContext.callServletContainerInitializers(StandardContext.java:6068)
	at com.sun.enterprise.web.WebModule.callServletContainerInitializers(WebModule.java:774)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:5960)
	... 74 more
Caused by: java.lang.NullPointerException
	at org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer.addServletWithExistingRegistration(JerseyServletContainerInitializer.java:316)
	at org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer.onStartupImpl(JerseyServletContainerInitializer.java:161)
	at org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer.onStartup(JerseyServletContainerInitializer.java:144)
	at org.apache.catalina.core.StandardContext.callServletContainerInitializers(StandardContext.java:6062)
	... 76 more
]]




[JERSEY-3076] Jersey2 + GuiceHK2Bridge and validations will not work Created: 09/Mar/16  Updated: 10/Mar/17

Status: Open
Project: jersey
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: pvanassen Assignee: Unassigned
Resolution: Unresolved Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Java 8
Tomcat 7
Jersey 2.22.2
HK2 guide bridge 2.4.0



 Description   

I have a setup where I run Jersey2 together with Guice through the HK2 bridge. This works fine for the most part until I add jersey-bean-validation however.

On instantiating the InjectingConstraintValidatorFactory.java, the Guice injector is used instead of the internal Jersey injector, therefor the ResourceContext property is not set, leading to an NPE later on.

Just removing the Guice bridge makes the injection go as expected.

java.lang.NullPointerException: null
	at org.glassfish.jersey.server.validation.internal.InjectingConstraintValidatorFactory.getInstance(InjectingConstraintValidatorFactory.java:61)
	at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintValidatorManager.createAndInitializeValidator(ConstraintValidatorManager.java:141)
	at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintValidatorManager.getInitializedValidator(ConstraintValidatorManager.java:101)
	at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:125)
	at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:91)
	at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:83)
	at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:547)
	at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:487)
	at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:451)
	at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:403)
	at org.hibernate.validator.internal.engine.ValidatorImpl.validateCascadedConstraint(ValidatorImpl.java:723)
	at org.hibernate.validator.internal.engine.ValidatorImpl.validateCascadedConstraints(ValidatorImpl.java:601)
	at org.hibernate.validator.internal.engine.ValidatorImpl.validateParametersInContext(ValidatorImpl.java:992)
	at org.hibernate.validator.internal.engine.ValidatorImpl.validateParameters(ValidatorImpl.java:300)
	at org.hibernate.validator.internal.engine.ValidatorImpl.validateParameters(ValidatorImpl.java:254)
	at org.glassfish.jersey.server.validation.internal.DefaultConfiguredValidator.onValidate(DefaultConfiguredValidator.java:175)
	at org.glassfish.jersey.server.validation.internal.ValidationInterceptorExecutor.proceed(ValidationInterceptorExecutor.java:113)
	at org.glassfish.jersey.server.validation.internal.DefaultConfiguredValidator.validateResourceAndInputParams(DefaultConfiguredValidator.java:146)
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:134)


 Comments   
Comment by pvanassen [ 09/Mar/16 ]

As a workaround, I now initialise the offending class InjectingConstraintValidatorFactory through the service locator

serviceLocator.createAndInitialize(InjectingConstraintValidatorFactory.class)

This initialised class I provide to Guice which later on is queried for this class.

Comment by pvanassen [ 09/Mar/16 ]

Example of the bug can be found at: https://github.com/synedge/jersey-guice-validation-bug

This is the Jersey validation example, with Guice added.

Comment by jschalanda [ 10/Aug/16 ]

The problem still exists with Jersey 2.23.2 and HK2 2.5.0-b05.

Comment by lukas.schmidt [ 10/Mar/17 ]

It also still exists in 2.25.1 (using HK2 2.4.0).





[JERSEY-3244] Failing to read all "Set-Cookie"-Headers Created: 09/Mar/17  Updated: 09/Mar/17

Status: Open
Project: jersey
Component/s: core
Affects Version/s: 2.22.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: tobias.niehues Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: client
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Using HttpUrlConnection without setting CookieHandler.setDefault()



 Description   

Given the following Response Headers, not all Headers can be accessed using getHeaders()

Response Headers:

HTTP/1.1 200 OK
Cache-Control: private, max-age=0
Content-Type: application/xml; charset=utf-8
Content-Encoding: gzip
Expires: Thu, 09 Mar 2017 09:43:54 GMT
Last-Modified: Thu, 09 Mar 2017 09:43:54 GMT
Vary: *
Server: Microsoft-IIS/7.5
Set-Cookie: .DWPLATFORMAUTH=; expires=Wed, 08-Mar-2017 09:43:54 GMT; path=/XXX/XXX; HttpOnly
Set-Cookie: .DWPLATFORMAUTH=XXXXX; path=/; HttpOnly
Set-Cookie: DWPLATFORMBROWSERID=; expires=Wed, 08-Mar-2017 09:43:54 GMT; path=/XXX/XXX; HttpOnly
Set-Cookie: DWPLATFORMBROWSERID=YYYY; expires=Fri, 09-Mar-2018 09:43:54 GMT; path=/; HttpOnly
Date: Thu, 09 Mar 2017 09:43:54 GMT
Content-Length: 1739

In an implementation of ClientResponseFilter I am trying to access the Set-Cookie-Headers.

public void filter(ClientRequestContext request, ClientResponseContext response) throws IOException {
   List<String> cookieHeaders = response.getHeaders().get("Set-Cookie"));
}

I expect cookieHeaders to contain a list with all four "Set-Cookie"-Headers. However, cookieHeaders contains a list with four empty Strings:

response.getHeaders().get("Set-Cookie") => (java.util.LinkedList<E>) [, , , ]

I am using HttpUrlConnection and did not set CookieHandler.setDefault(), because I am do not want to share Cookies between different connections to the same hosts.



 Comments   
Comment by Pavel Bucek [ 09/Mar/17 ]

Have you tried to reprudoce the case with simple HttpUrlConnection?

Or different client connector (grizzly, apache, ..)?

Comment by tobias.niehues [ 09/Mar/17 ]

I did not try a different connector.

Using a plain HttpURLConnection lists all "Set-Cookie"-Headers as expected. Sample Code:

public void test() {
        HttpURLConnection connection = (HttpURLConnection) new URL("http://url").openConnection();
        connection.setRequestMethod("POST");
        connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
        connection.setDoOutput(true);
        java.io.OutputStreamWriter wr = new java.io.OutputStreamWriter(connection.getOutputStream());
        wr.write("thecredentials");
        wr.flush();
        System.out.println(connection.getHeaderFields());
        connection.disconnect();
}

This correctly outputs all Headerfields, including "Set-Cookie":

...
Set-Cookie=[cookieA=XXX; expires=Fri, 09-Mar-2018 11:55:07 GMT; path=/; HttpOnly, cookieA=; expires=Wed, 08-Mar-2017 11:55:07 GMT; path=/XXX/XXX; HttpOnly, .cookieB=YYYY; path=/; HttpOnly, .cookieB=; expires=Wed, 08-Mar-2017 11:55:07 GMT; path=/XXX/XXXX; HttpOnly],
Vary=[*],
Last-Modified=[Thu, 09 Mar 2017 11:55:07 GMT],
Expires=[Thu, 09 Mar 2017 11:55:07 GMT],
Content-Length=[8345],
Date=[Thu, 09 Mar 2017 11:55:07 GMT],
X-Powered-By=[ASP.NET],
Content-Type=[application/xml; charset=utf-8]
...
Comment by tobias.niehues [ 09/Mar/17 ]

Tested in isolation, the error was only reproducible, when CookieHandler.setDefault() was indeed set.

When CookieHandler.setDefault(new CookieManager()) is set at the beginning of the example method I provided, all cookies given by the "Set-Cookies"-Header get replaced by empty strings:

Set-Cookie=[, , , ]

Therefore, this issue is irrelevant to jersey itself.

I am still wondering, whether this is intended behaviour by HttpURLConnection. If anyone can explain the behaviour of HttpURLConnection when a global CookieHandler is set or point me to relevant documentation, I am all ears!





[JERSEY-3243] classload set problem Created: 09/Mar/17  Updated: 09/Mar/17

Status: Open
Project: jersey
Component/s: containers
Affects Version/s: 2.25.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: liyang_Janney Assignee: Pavel Bucek
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

final ResourceConfig rc = new ResourceConfig().packages("com.xxx");

the ResourceConfig site set the state classloader.
this.state.setClassLoader(classLoader);
but it actually use ContextClassLoader.



 Comments   
Comment by Pavel Bucek [ 09/Mar/17 ]

workaround would be registering PackageNamesScanner explicitly:

ClassLoader loader = null; // ...

ResourceConfig resourceConfig = new ResourceConfig();
resourceConfig.registerFinder(new PackageNamesScanner(loader, new String[]{"package"}, true));




[JERSEY-3153] Jersey doesn't allow to override a built-in ValidationExceptionMapper Created: 11/Aug/16  Updated: 06/Mar/17

Status: Open
Project: jersey
Component/s: extensions
Affects Version/s: 2.23.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: gdemecki Assignee: Unassigned
Resolution: Unresolved Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 7/ Ubuntu 16.04
Oracle JDK 1.7.0_75
Jetty 9.2.13.v20150730
Any Jersey version above 2.14


Tags: exceptions-handling, jersey-bean-validation, weld-integration

 Description   

In attachments you can see a project which uses: Jersey, Weld, Jetty and jersey bean validation module.

The problem is, when I've upgraded Jersey from 2.14 to 2.23.1 my custom exception mapper:

@Provider
public class ValidationExceptionMapper implements
        ExceptionMapper<ValidationException> {

    @Override
    public Response toResponse(ValidationException exception) {
        final ResponseEntity resp = ResponseEntity.builder()
                .message("Hurray, my custom ValidationExceptionMapper was called!")
                .build();

        return Response.status(Status.BAD_REQUEST).entity(resp).build();
    }
}

is no longer called - Jersey uses the built-in exception mapper for this exception: org.glassfish.jersey.server.validation.internal.ValidationExceptionMapper and unfortunately I cannot override it.

The problem is strictly related to the Weld integration. Because without dependency to Weld, my custom exception mapper has a higher priority than the one provided by jersey-bean-validation module.



 Comments   
Comment by gdemecki [ 11/Aug/16 ]

Known workarounds:

  • Downgrade to Jersey 2.14
  • Remove Weld
  • Remove jersey-bean-validation module
  • Use HK2 to override the problematic mapper:
    register(new AbstractBinder() {
      @Override
      protected void configure() {
        bind(my.custom.ValidationExceptionMapper.class).to(ExceptionMapper.class)
               .in(Singleton.class);
      }
    });
    

BTW: How can I attach a sample reproducer app? Funny, I don't have permissions ^^

Comment by Pavel Bucek [ 11/Aug/16 ]

link to a public github repo is best way how to do that, java.net disabled attachments long time ago..

Comment by gdemecki [ 11/Aug/16 ]

Thanks Pavel,
example app is available on the GitHub.

Comment by Marek Potociar [ 15/Aug/16 ]

I have tried to run your example, but I can see some WELD scanning-related exceptions when I invoke mvn clean package jetty:run from my command line.
Please fix this problem in your reproducer.

Comment by Marek Potociar [ 15/Aug/16 ]

This is the error that I see:
WELD-ENV-000033: Invalid bean archive scanning result - found multiple results with the same reference

Comment by gdemecki [ 17/Aug/16 ]

Thanks Marek, indeed reproducer isn't perfect - I must admit that I've launched it only via the com.xyz.AppRunner.main() from my IDE. Please use it instead of jetty-maven-plugin, if it isn't a problem.

Comment by HeinBloed [ 10/Feb/17 ]

We're trying to migrate from GlassFish 4.1 (Jersey 2.10.4) to Payara 4.1.1.164 (Jersey 2.22.2) and are affected by the same problem.

For some reason I don't know, we hadn't implemented the interface but extended the Jersey implementation: @Provider public class ValidationExceptionHandler extends ValidationExceptionMapper. This is why I also noticed that that class is final now. Changing this to @Provider public class ValidationExceptionHandler implements ExceptionMapper<ValidationException> still works in GF 4.1 but no longer in Payara 4.1.1.164, i.e. toResponse(...) is never called.

Since Payara bundles all of the modules named by gdemecki in his workaround suggestions (and we also use all of them), none of them would be possible for us.

Comment by HeinBloed [ 24/Feb/17 ]

For anyone else needing a quick fix for this, I managed to have my class implementing ExceptionMapper<ValidationException> get called again by modifying org.glassfish.jersey.server.validation.internal.ValidationBinder.configure() and commenting out the two lines

bind(ValidationExceptionMapper.class).to(ExceptionMapper.class).in(Singleton.class);

and

bind(ValidationErrorMessageBodyWriter.class).to(MessageBodyWriter.class).in(Singleton.class);

I didn't really analyze the source code for that modification, I just noticed that those two lines were added in one of the versions > 2.14. Maybe this helps someone knowledgable in the code to find a real fix.





[JERSEY-3232] We have received the similar kind of exception like below Request to check org.glassfish.jersey.server.ServerRuntime$Responder writeResponse SEVERE: Error while closing the output stream in order to commit response. Created: 15/Feb/17  Updated: 02/Mar/17

Status: Open
Project: jersey
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Krupahk Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

We have received the similar kind of exception like below
Request to check
org.glassfish.jersey.server.ServerRuntime$Responder writeResponse
SEVERE: Error while closing the output stream in order to commit response.
org.glassfish.jersey.message.internal.HeaderValueException: Too many "Location" header values:
at org.glassfish.jersey.message.internal.OutboundMessageContext.singleHeader(OutboundMessageContext.java:209)
at org.glassfish.jersey.message.internal.OutboundMessageContext.getLocation(OutboundMessageContext.java:507)
at org.glassfish.jersey.server.ContainerResponse.getLocation(ContainerResponse.java:230)
at org.glassfish.jersey.server.ServerRuntime$Responder$1.getOutputStream(ServerRuntime.java:665)
at org.glassfish.jersey.message.internal.CommittingOutputStream.commitStream(CommittingOutputStream.java:200)
at org.glassfish.jersey.message.internal.CommittingOutputStream.flushBuffer(CommittingOutputStream.java:305)
at org.glassfish.jersey.message.internal.CommittingOutputStream.commit(CommittingOutputStream.java:261)
at org.glassfish.jersey.message.internal.CommittingOutputStream.close(CommittingOutputStream.java:276)
at org.glassfish.jersey.message.internal.OutboundMessageContext.close(OutboundMessageContext.java:839)
at org.glassfish.jersey.server.ContainerResponse.close(ContainerResponse.java:412)
at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:750)
at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:424)
at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:414)
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:311)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:291)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1140)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:403)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:386)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:334)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:242)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:216)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:132)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:338)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:338)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:221)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3284)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3254)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2163)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2089)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2074)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1513)
at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)



 Comments   
Comment by Krupahk [ 02/Mar/17 ]

Request to close





[JERSEY-3238] We have received the similar kind of exception like below Request to check org.glassfish.jersey.server.ServerRuntime$Responder writeResponse SEVERE: Error while closing the output stream in order to commit response. Created: 02/Mar/17  Updated: 02/Mar/17

Status: Open
Project: jersey
Component/s: website
Affects Version/s: 2.19
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: Krupahk Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Production



 Description   

Exception
org.glassfish.jersey.server.ServerRuntime$Responder writeResponse
SEVERE: Error while closing the output stream in order to commit response.
java.lang.NullPointerException
at java.util.LinkedList$ListItr.next(LinkedList.java:891)
at java.util.AbstractCollection.toString(AbstractCollection.java:449)
at org.glassfish.jersey.message.internal.OutboundMessageContext.singleHeader(OutboundMessageContext.java:209)
at org.glassfish.jersey.message.internal.OutboundMessageContext.getLocation(OutboundMessageContext.java:507)
at org.glassfish.jersey.server.ContainerResponse.getLocation(ContainerResponse.java:230)
at org.glassfish.jersey.server.ServerRuntime$Responder$1.getOutputStream(ServerRuntime.java:665)
at org.glassfish.jersey.message.internal.CommittingOutputStream.commitStream(CommittingOutputStream.java:200)
at org.glassfish.jersey.message.internal.CommittingOutputStream.flushBuffer(CommittingOutputStream.java:305)
at org.glassfish.jersey.message.internal.CommittingOutputStream.commit(CommittingOutputStream.java:261)
at org.glassfish.jersey.message.internal.CommittingOutputStream.close(CommittingOutputStream.java:276)
at org.glassfish.jersey.message.internal.OutboundMessageContext.close(OutboundMessageContext.java:839)
at org.glassfish.jersey.server.ContainerResponse.close(ContainerResponse.java:412)
at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:750)
at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:424)
at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:414)
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:311)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:291)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1140)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:403)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:386)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:334)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:242)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:216)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:132)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:338)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:221)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3292)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3262)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2171)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2097)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2075)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1514)
at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

This exception is being observed during the server high load time






[JERSEY-3177] StackOverflowError in WadlBuilder.generateResource Created: 18/Oct/16  Updated: 01/Mar/17

Status: Open
Project: jersey
Component/s: core
Affects Version/s: 2.23.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: claprun Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

OS X 10.12, java 1.8.0_102


Issue Links:
Duplicate
is duplicated by JERSEY-3176 StackOverflowError in WadlBuilder.gen... Resolved

 Description   

I have a resource at path A that defines a sub-resource locator at path B. When calling HTTP method OPTIONS on my sub-resource, WadlBuilder.generateResource enters an infinite loop because when it attempts to build the B child resource for resource A, it uses the locator that points to path A, including a child that uses A's path. When that child is processed while attempting to build B, A is processed again, resulting in B being processed again, etc.
Since there is no proper equals method on Resource, visited resources are never matched.



 Comments   
Comment by Pavel Bucek [ 18/Oct/16 ]

Thanks for your report.

Can you please include reproducible testcase?

Best reagards,
Pavel

Comment by claprun [ 20/Oct/16 ]

Hi Pavel,

I will try to do so without having to replicate my full environment. On the plus side, I just deactivated the WADL generation to work around the issue so I don't consider this as a blocker anymore (but I cannot change the priority anymore).

Best regards,
Chris

Comment by claprun [ 20/Oct/16 ]

I cannot seem to come up with a simple reproducer (my attempt using the project archetype doesn't exhibit the issue so maybe there is something specific to my resource model).
Also, not sure why, but JERSEY-3176 duplicates this issue so it can be closed.

Comment by claprun [ 20/Oct/16 ]

Actually, I can reproduce the issue using our test suite. I have created a branch of our project that exhibits the issue: https://github.com/metacosm/jcrestapi/tree/JERSEY-3177. If you run the tests (`mvn test -DskipTests=false`), you'll see that the `APITest.testOptions` test fails, exhibiting the infinite loop. Let me know if you need more info.

Comment by Pavel Bucek [ 20/Oct/16 ]
  • priority changed from blocker to major
  • added "incomplete", since there is no reproducer available (yet)

feel free to update the issue with any findings you might do in the future.

Comment by claprun [ 20/Oct/16 ]

I have a reproducer now, see above. I guess I was just a couple of seconds too late!

Comment by Pavel Bucek [ 20/Oct/16 ]

ok, "incomplete" tag removed thanks!

Comment by nicolas_ma [ 01/Mar/17 ]

I have a simpler test that fit into this comment box:

//RecursiveRessource.java 
package jeser3177;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

/**
@Path("r")
public class RecursiveRessource {
    
    @GET
    @Produces(value = MediaType.TEXT_PLAIN)
    public String get() {
        return "ok";

    }

    @Path("recurse")
  
    public RecursiveRessource getParentFacade() {
      return new RecursiveRessource();
    }
    
}
//JERSEY3177.java
package jeser3177;

import javax.ws.rs.ApplicationPath;
import org.glassfish.jersey.server.ResourceConfig;

@ApplicationPath("/r")
public class JERSEY3177 extends ResourceConfig{
    public JERSEY3177() {    
        setApplicationName("JERSEY3177");
        packages(true, "jeser3177");
    }
}

deploy and do a get on $contextRoot/r/application.wadl you will get the following stack trace:

01-Mar-2017 10:19:19.433 SEVERE [http-nio-8080-exec-7] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [ca.usherbrooke.sti.si.bugwadl.JERSEY3177] in context with path [/bugwadl] threw exception [org.glassfish.jersey.server.ContainerException: java.lang.StackOverflowError] with root cause
 java.lang.StackOverflowError
	at java.lang.Class.getMethod(Class.java:1783)
	at org.glassfish.jersey.internal.util.ReflectionHelper$18.run(ReflectionHelper.java:1342)
	at org.glassfish.jersey.internal.util.ReflectionHelper$18.run(ReflectionHelper.java:1338)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.glassfish.jersey.server.model.AnnotatedMethod.findAnnotatedMethod(AnnotatedMethod.java:300)
	at org.glassfish.jersey.server.model.AnnotatedMethod.findAnnotatedMethod(AnnotatedMethod.java:291)
	at org.glassfish.jersey.server.model.AnnotatedMethod.<init>(AnnotatedMethod.java:116)
	at org.glassfish.jersey.server.model.MethodList.<init>(MethodList.java:124)
	at org.glassfish.jersey.server.model.IntrospectionModeller.checkForNonPublicMethodIssues(IntrospectionModeller.java:172)
	at org.glassfish.jersey.server.model.IntrospectionModeller.doCreateResourceBuilder(IntrospectionModeller.java:119)
	at org.glassfish.jersey.server.model.IntrospectionModeller.access$000(IntrospectionModeller.java:80)
	at org.glassfish.jersey.server.model.IntrospectionModeller$1.call(IntrospectionModeller.java:112)
	at org.glassfish.jersey.server.model.IntrospectionModeller$1.call(IntrospectionModeller.java:109)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
	at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:255)
	at org.glassfish.jersey.server.model.IntrospectionModeller.createResourceBuilder(IntrospectionModeller.java:109)
	at org.glassfish.jersey.server.model.Resource.builder(Resource.java:771)
	at org.glassfish.jersey.server.model.Resource.builder(Resource.java:758)
	at org.glassfish.jersey.server.wadl.internal.WadlBuilder.generateResource(WadlBuilder.java:413)
	at org.glassfish.jersey.server.wadl.internal.WadlBuilder.generateResource(WadlBuilder.java:462)
	at org.glassfish.jersey.server.wadl.internal.WadlBuilder.generateResource(WadlBuilder.java:420)
	at org.glassfish.jersey.server.wadl.internal.WadlBuilder.generateResource(WadlBuilder.java:462)
...

this bug is still present in 2.25.1





[JERSEY-3237] @JSONP's Accept header requirement is impractical Created: 01/Mar/17  Updated: 01/Mar/17

Status: Open
Project: jersey
Component/s: None
Affects Version/s: 2.25.1
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: arienkock Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The examples in the docs suggest that executing curl without passing a header like `curl -H 'Accept: application/javascript' ` should result in a JSON with padding. However, reimplementing that example with `jersey-media-json-processing` module requires me to pass that header. If there is some way around the accept header requirement, I couldn't figure it out from the documentation.

If there isn't, then my real problem follows from this restriction: The accept header sent by chrome when inserting creating a script element (even with the attribute type="text/javascript") ends up sending a header `Accept: /`. Since it doesn't satisfy Jersey's requirement, it sends plain JSON and my @JSONP annotated endpoint becomes unusable.






[JERSEY-3236] Parallel tests with JerseyTest framework fails with Netty Provider Created: 27/Feb/17  Updated: 27/Feb/17

Status: Open
Project: jersey
Component/s: containers, test-framework
Affects Version/s: 2.25.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: skrishnappa Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: test
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Verified on Ubuntu


Tags: netty, test-framework

 Description   

Enabling parallel test by setting TestProperties.CONTAINER_PORT to 0 as documented here: https://jersey.java.net/documentation/latest/test-framework.html#parallel does not work with Netty Provider.
The NettyTestContrainerFactory https://github.com/jersey/jersey/blob/master/test-framework/providers/netty/src/main/java/org/glassfish/jersey/test/netty/NettyTestContainerFactory.java does not implement this functionality, the baseUri should be updated with the allocated port when 0 is supplied as the port value here. The other providers have implemented this correctly.






[JERSEY-3235] @PathParam not satisfied in a @RequestScoped Resource constructor pollutes the logs Created: 22/Feb/17  Updated: 22/Feb/17

Status: Open
Project: jersey
Component/s: containers
Affects Version/s: 2.25
Fix Version/s: None

Type: Bug Priority: Major
Reporter: victornoel Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Dropwizard 1.0.6 with Java 8



 Description   

I have the following kind of resource:

@RequestScoped
@Path("/workspaces/{wsId}")
public class WorkspaceResource {

    private final long wsId;

    @Inject
    public WorkspaceResource(@PathParam("wsId") @Min(1) long wsId) {
        this.wsId = wsId;
    }
    ...
}

And if I try to call GET on /workspaces/blabla (so, not a number), I get a huge quantity of stacktraces in the logs about the fact that blabla is not a number.

I would expect not to have such a stacktrace for this situation: it is expected that external clients could try to access incorrect URLs and get a 404.

Here is the stacktrace:

WARN  [2017-01-30 16:28:32,105] org.glassfish.jersey.internal.Errors: The following warnings have been detected: WARNING: Unknown HK2 failure detected:
MultiException stack 1 of 3
org.glassfish.jersey.server.ParamException$PathParamException: HTTP 404 Not Found
    at org.glassfish.jersey.server.internal.inject.PathParamValueFactoryProvider$PathParamValueFactory.provide(PathParamValueFactoryProvider.java:95)
    at org.glassfish.jersey.server.internal.inject.ParamInjectionResolver.resolve(ParamInjectionResolver.java:134)
    at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:212)
    at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:229)
    at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:358)
    at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:487)
    at org.glassfish.jersey.process.internal.RequestScope.findOrCreate(RequestScope.java:162)
    at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2022)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:774)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:737)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:707)
    at org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:172)
    at org.glassfish.jersey.server.model.MethodHandler$ClassBasedMethodHandler.getInstance(MethodHandler.java:284)
    at org.glassfish.jersey.server.internal.routing.PushMethodHandlerRouter.apply(PushMethodHandlerRouter.java:74)
    at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:109)
    at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
    at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
    at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
    at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:92)
    at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:61)
    at org.glassfish.jersey.process.internal.Stages.process(Stages.java:197)
    at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:318)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
    at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
    at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
    at io.dropwizard.jetty.NonblockingServletHolder.handle(NonblockingServletHolder.java:49)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1772)
    at io.dropwizard.servlets.ThreadNameFilter.doFilter(ThreadNameFilter.java:34)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
    at io.dropwizard.jersey.filter.AllowedMethodsFilter.handle(AllowedMethodsFilter.java:50)
    at io.dropwizard.jersey.filter.AllowedMethodsFilter.doFilter(AllowedMethodsFilter.java:44)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:224)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
    at com.codahale.metrics.jetty9.InstrumentedHandler.handle(InstrumentedHandler.java:240)
    at io.dropwizard.jetty.RoutingHandler.handle(RoutingHandler.java:51)
    at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:462)
    at io.dropwizard.jetty.BiDiGzipHandler.handle(BiDiGzipHandler.java:68)
    at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:56)
    at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:169)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
    at org.eclipse.jetty.server.Server.handle(Server.java:534)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
    at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NumberFormatException: For input string: "lol"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Long.parseLong(Long.java:589)
    at java.lang.Long.valueOf(Long.java:803)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.glassfish.jersey.server.internal.inject.PrimitiveValueOfExtractor.getValue(PrimitiveValueOfExtractor.java:97)
    at org.glassfish.jersey.server.internal.inject.PrimitiveValueOfExtractor.extract(PrimitiveValueOfExtractor.java:114)
    at org.glassfish.jersey.server.internal.inject.PathParamValueFactoryProvider$PathParamValueFactory.provide(PathParamValueFactoryProvider.java:93)
    ... 68 more
MultiException stack 2 of 3
java.lang.IllegalArgumentException: While attempting to resolve the dependencies of org.ow2.petals.cockpit.server.resources.WorkspaceResource errors were found
    at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:247)
    at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:358)
    at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:487)
    at org.glassfish.jersey.process.internal.RequestScope.findOrCreate(RequestScope.java:162)
    at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2022)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:774)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:737)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:707)
    at org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:172)
    at org.glassfish.jersey.server.model.MethodHandler$ClassBasedMethodHandler.getInstance(MethodHandler.java:284)
    at org.glassfish.jersey.server.internal.routing.PushMethodHandlerRouter.apply(PushMethodHandlerRouter.java:74)
    at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:109)
    at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
    at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
    at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
    at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:92)
    at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:61)
    at org.glassfish.jersey.process.internal.Stages.process(Stages.java:197)
    at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:318)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
    at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
    at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
    at io.dropwizard.jetty.NonblockingServletHolder.handle(NonblockingServletHolder.java:49)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1772)
    at io.dropwizard.servlets.ThreadNameFilter.doFilter(ThreadNameFilter.java:34)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
    at io.dropwizard.jersey.filter.AllowedMethodsFilter.handle(AllowedMethodsFilter.java:50)
    at io.dropwizard.jersey.filter.AllowedMethodsFilter.doFilter(AllowedMethodsFilter.java:44)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:224)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
    at com.codahale.metrics.jetty9.InstrumentedHandler.handle(InstrumentedHandler.java:240)
    at io.dropwizard.jetty.RoutingHandler.handle(RoutingHandler.java:51)
    at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:462)
    at io.dropwizard.jetty.BiDiGzipHandler.handle(BiDiGzipHandler.java:68)
    at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:56)
    at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:169)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
    at org.eclipse.jetty.server.Server.handle(Server.java:534)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
    at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
    at java.lang.Thread.run(Thread.java:745)
MultiException stack 3 of 3
java.lang.IllegalStateException: Unable to perform operation: resolve on org.ow2.petals.cockpit.server.resources.WorkspaceResource
    at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:387)
    at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:487)
    at org.glassfish.jersey.process.internal.RequestScope.findOrCreate(RequestScope.java:162)
    at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2022)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:774)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:737)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:707)
    at org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:172)
    at org.glassfish.jersey.server.model.MethodHandler$ClassBasedMethodHandler.getInstance(MethodHandler.java:284)
    at org.glassfish.jersey.server.internal.routing.PushMethodHandlerRouter.apply(PushMethodHandlerRouter.java:74)
    at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:109)
    at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
    at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
    at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
    at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:92)
    at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:61)
    at org.glassfish.jersey.process.internal.Stages.process(Stages.java:197)
    at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:318)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
    at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
    at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
    at io.dropwizard.jetty.NonblockingServletHolder.handle(NonblockingServletHolder.java:49)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1772)
    at io.dropwizard.servlets.ThreadNameFilter.doFilter(ThreadNameFilter.java:34)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
    at io.dropwizard.jersey.filter.AllowedMethodsFilter.handle(AllowedMethodsFilter.java:50)
    at io.dropwizard.jersey.filter.AllowedMethodsFilter.doFilter(AllowedMethodsFilter.java:44)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:224)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
    at com.codahale.metrics.jetty9.InstrumentedHandler.handle(InstrumentedHandler.java:240)
    at io.dropwizard.jetty.RoutingHandler.handle(RoutingHandler.java:51)
    at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:462)
    at io.dropwizard.jetty.BiDiGzipHandler.handle(BiDiGzipHandler.java:68)
    at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:56)
    at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:169)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
    at org.eclipse.jetty.server.Server.handle(Server.java:534)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
    at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
    at java.lang.Thread.run(Thread.java:745)





[JERSEY-3234] InetAddresses.isUriInetAddress(String) from the emdeded guava lib could be optimized Created: 20/Feb/17  Updated: 20/Feb/17

Status: Open
Project: jersey
Component/s: None
Affects Version/s: 2.22.2, 2.25.1
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: medo9200 Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: 1 hour
Time Spent: Not Specified
Original Estimate: 1 hour


 Description   

JerseyUriBuilder.host(String) employs InetAddresses.isUriInetAddress(String) that is embedded in jersey (repackaged or moved to uri.internal). The problem with InetAddresses.isUriInetAddress is that:
1- The flow is controlled by throwing an IllegalArgumentException which may cause a performance hit if the stack is deep (fillinstacktrace).
2- The message is passed to the exception using String.format which is also an uncalled for performance hit.
The remedy is quite simple, either change the guava dependency from 18 to 20 (it was fixed in that version) or just change the isUriInetAddress and forUriString to control the flow in a better way rather than using exceptions






[JERSEY-3233] Response.close() and Response.bufferEntity() throws exception when used with ApacheConnectorProvider and PlainConnectionSocketFactory Created: 15/Feb/17  Updated: 15/Feb/17

Status: Open
Project: jersey
Component/s: connectors
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: predatorvi Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Cloners
clones JERSEY-3214 ApacheConnector: closing ClientRespon... Open

 Description   

JERSEY-2852 seems to have introduced a bug, with response.close() throwing an unexpected ProcessingException if the response has not been consumed. That is quite unfortunate because this ProcessingException overrides any original exception if close is called inside a finally-block. (And try-with-resources is not yet supported by JAX-RS 2.0).

javax.ws.rs.ProcessingException: Error closing message content input stream.
	at org.glassfish.jersey.message.internal.EntityInputStream.close(EntityInputStream.java:161)
	at org.glassfish.jersey.message.internal.InboundMessageContext$EntityContent.close(InboundMessageContext.java:156)
	at org.glassfish.jersey.message.internal.InboundMessageContext.close(InboundMessageContext.java:939)
	at org.glassfish.jersey.client.InboundJaxrsResponse.close(InboundJaxrsResponse.java:167)
Caused by: org.apache.http.ConnectionClosedException: Premature end of Content-Length delimited message body (expected: 4; received: 0
	at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:178)
	at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:198)
	at org.apache.http.impl.io.ContentLengthInputStream.close(ContentLengthInputStream.java:101)
	at org.apache.http.impl.execchain.ResponseEntityProxy.streamClosed(ResponseEntityProxy.java:140)
	at org.apache.http.conn.EofSensorInputStream.checkClose(EofSensorInputStream.java:228)
	at org.apache.http.conn.EofSensorInputStream.close(EofSensorInputStream.java:174)
	at java.io.BufferedInputStream.close(BufferedInputStream.java:483)
	at java.io.FilterInputStream.close(FilterInputStream.java:181)
	at org.glassfish.jersey.apache.connector.ApacheConnector$3.close(ApacheConnector.java:644)
	at java.io.FilterInputStream.close(FilterInputStream.java:181)
	at org.glassfish.jersey.apache.connector.ApacheConnector$HttpClientResponseInputStream.close(ApacheConnector.java:621)
	at org.glassfish.jersey.message.internal.EntityInputStream.close(EntityInputStream.java:158)
	... 29 more

Seems to affect Jersey 2.22.2 upwards; experienced it in jersey 2.23.1

[INFO] +- org.glassfish.jersey.connectors:jersey-apache-connector:jar:2.23.1:test
[INFO] |  +- org.apache.httpcomponents:httpclient:jar:4.5.2:test (version managed from 4.5)
[INFO] |  |  +- org.apache.httpcomponents:httpcore:jar:4.4.5:test (version managed from 4.4.4)
[INFO] |  |  \- commons-codec:commons-codec:jar:1.10:test (version managed from 1.9)
[INFO] |  +- (org.glassfish.jersey.core:jersey-client:jar:2.23.1:test - omitted for duplicate)
[INFO] |  \- (javax.ws.rs:javax.ws.rs-api:jar:2.0.1:test - omitted for duplicate)

Reproducable by this UnitTest:

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.ProcessingException;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import org.glassfish.jersey.apache.connector.ApacheConnectorProvider;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.glassfish.jersey.test.jdkhttp.JdkHttpServerTestContainerFactory;
import org.glassfish.jersey.test.spi.TestContainerException;
import org.glassfish.jersey.test.spi.TestContainerFactory;
import org.junit.Test;

public class FunctionalCloseableItTest extends JerseyTest {

    @Override
    protected Application configure() {
        ResourceConfig config = new ResourceConfig();
        config.register(TestResource.class);
        return config;
    }

    @Override
    protected void configureClient(ClientConfig config) {
        config.connectorProvider(new ApacheConnectorProvider());
    }

    @Override
    protected TestContainerFactory getTestContainerFactory() throws TestContainerException {
        return new JdkHttpServerTestContainerFactory();
    }

    @Test
    public void testProcessingExceptionThrownInCloseOverridesMyException() throws Exception {
        try {
            Response response = target().path("productInfo")
                .request(MediaType.TEXT_PLAIN_TYPE)
                .get();
            try {
                assertEquals(200, response.getStatus());
                // this exception is unfortunately overridden in finally-block
                throw new MyException();
            } finally {
                // BUG: will throw because not consumed
                response.close();
            }
        } catch (ProcessingException e) {
            e.printStackTrace();
            assertEquals("Error closing message content input stream.", e.getMessage());
            assertEquals(0, e.getSuppressed().length);
        }
    }

    @SuppressWarnings("serial")
    private static class MyException extends Exception {

    }

    @Path("/")
    public static class TestResource {
        @GET
        @Path("/productInfo")
        @Produces(MediaType.TEXT_PLAIN)
        public String getProductInfo() {
            return "foo\n";
        }
    }
}

The thrown exception seems like a bug to me because JERSEY-2852 fully intended to prematurely close the connection instead of consuming it. An Exception would not make sense. There is also the javadoc of Response#close():

The close() method should be invoked on all instances that
contain an un-consumed entity input stream to ensure the resources associated
with the instance are properly cleaned-up and prevent potential memory leaks.
This is typical for client-side scenarios where application layer code
processes only the response headers and ignores the response entity.

The bug seems to be caused by Jersey closing both HttpResponse and response-Stream. First closing the HttpResponse closes the socket-connection. The second close of the response-stream tries to consume the remaining body, but the socket is already closed, which is considered a protocol error by apache httpclient. Not closing the stream probably circumvents the exception.

I may prepare a PullRequest if i get the OK from my higher-ups to sign OCA (real PITA).



 Comments   
Comment by predatorvi [ 15/Feb/17 ]

This can be closed. Apparently, I need a Jira training, sorry. I assumed the clone process would let me edit and add additional detail before submitting as it seems related to JERSEY-3214, but could potentially be different based on my usage. I'll submit a different issue.





[JERSEY-3214] ApacheConnector: closing ClientResponse throws if not consumed Created: 02/Jan/17  Updated: 15/Feb/17

Status: Open
Project: jersey
Component/s: connectors
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: mkull Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Cloners
is cloned by JERSEY-3233 Response.close() and Response.bufferE... Open

 Description   

JERSEY-2852 seems to have introduced a bug, with response.close() throwing an unexpected ProcessingException if the response has not been consumed. That is quite unfortunate because this ProcessingException overrides any original exception if close is called inside a finally-block. (And try-with-resources is not yet supported by JAX-RS 2.0).

javax.ws.rs.ProcessingException: Error closing message content input stream.
	at org.glassfish.jersey.message.internal.EntityInputStream.close(EntityInputStream.java:161)
	at org.glassfish.jersey.message.internal.InboundMessageContext$EntityContent.close(InboundMessageContext.java:156)
	at org.glassfish.jersey.message.internal.InboundMessageContext.close(InboundMessageContext.java:939)
	at org.glassfish.jersey.client.InboundJaxrsResponse.close(InboundJaxrsResponse.java:167)
Caused by: org.apache.http.ConnectionClosedException: Premature end of Content-Length delimited message body (expected: 4; received: 0
	at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:178)
	at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:198)
	at org.apache.http.impl.io.ContentLengthInputStream.close(ContentLengthInputStream.java:101)
	at org.apache.http.impl.execchain.ResponseEntityProxy.streamClosed(ResponseEntityProxy.java:140)
	at org.apache.http.conn.EofSensorInputStream.checkClose(EofSensorInputStream.java:228)
	at org.apache.http.conn.EofSensorInputStream.close(EofSensorInputStream.java:174)
	at java.io.BufferedInputStream.close(BufferedInputStream.java:483)
	at java.io.FilterInputStream.close(FilterInputStream.java:181)
	at org.glassfish.jersey.apache.connector.ApacheConnector$3.close(ApacheConnector.java:644)
	at java.io.FilterInputStream.close(FilterInputStream.java:181)
	at org.glassfish.jersey.apache.connector.ApacheConnector$HttpClientResponseInputStream.close(ApacheConnector.java:621)
	at org.glassfish.jersey.message.internal.EntityInputStream.close(EntityInputStream.java:158)
	... 29 more

Seems to affect Jersey 2.22.2 upwards; experienced it in jersey 2.23.1

[INFO] +- org.glassfish.jersey.connectors:jersey-apache-connector:jar:2.23.1:test
[INFO] |  +- org.apache.httpcomponents:httpclient:jar:4.5.2:test (version managed from 4.5)
[INFO] |  |  +- org.apache.httpcomponents:httpcore:jar:4.4.5:test (version managed from 4.4.4)
[INFO] |  |  \- commons-codec:commons-codec:jar:1.10:test (version managed from 1.9)
[INFO] |  +- (org.glassfish.jersey.core:jersey-client:jar:2.23.1:test - omitted for duplicate)
[INFO] |  \- (javax.ws.rs:javax.ws.rs-api:jar:2.0.1:test - omitted for duplicate)

Reproducable by this UnitTest:

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.ProcessingException;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import org.glassfish.jersey.apache.connector.ApacheConnectorProvider;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.glassfish.jersey.test.jdkhttp.JdkHttpServerTestContainerFactory;
import org.glassfish.jersey.test.spi.TestContainerException;
import org.glassfish.jersey.test.spi.TestContainerFactory;
import org.junit.Test;

public class FunctionalCloseableItTest extends JerseyTest {

    @Override
    protected Application configure() {
        ResourceConfig config = new ResourceConfig();
        config.register(TestResource.class);
        return config;
    }

    @Override
    protected void configureClient(ClientConfig config) {
        config.connectorProvider(new ApacheConnectorProvider());
    }

    @Override
    protected TestContainerFactory getTestContainerFactory() throws TestContainerException {
        return new JdkHttpServerTestContainerFactory();
    }

    @Test
    public void testProcessingExceptionThrownInCloseOverridesMyException() throws Exception {
        try {
            Response response = target().path("productInfo")
                .request(MediaType.TEXT_PLAIN_TYPE)
                .get();
            try {
                assertEquals(200, response.getStatus());
                // this exception is unfortunately overridden in finally-block
                throw new MyException();
            } finally {
                // BUG: will throw because not consumed
                response.close();
            }
        } catch (ProcessingException e) {
            e.printStackTrace();
            assertEquals("Error closing message content input stream.", e.getMessage());
            assertEquals(0, e.getSuppressed().length);
        }
    }

    @SuppressWarnings("serial")
    private static class MyException extends Exception {

    }

    @Path("/")
    public static class TestResource {
        @GET
        @Path("/productInfo")
        @Produces(MediaType.TEXT_PLAIN)
        public String getProductInfo() {
            return "foo\n";
        }
    }
}

The thrown exception seems like a bug to me because JERSEY-2852 fully intended to prematurely close the connection instead of consuming it. An Exception would not make sense. There is also the javadoc of Response#close():

The close() method should be invoked on all instances that
contain an un-consumed entity input stream to ensure the resources associated
with the instance are properly cleaned-up and prevent potential memory leaks.
This is typical for client-side scenarios where application layer code
processes only the response headers and ignores the response entity.

The bug seems to be caused by Jersey closing both HttpResponse and response-Stream. First closing the HttpResponse closes the socket-connection. The second close of the response-stream tries to consume the remaining body, but the socket is already closed, which is considered a protocol error by apache httpclient. Not closing the stream probably circumvents the exception.

I may prepare a PullRequest if i get the OK from my higher-ups to sign OCA (real PITA).



 Comments   
Comment by predatorvi [ 11/Feb/17 ]

[Edit] Using Jersey 2.25.1 (client, core, apache-connector, entity-filtering, guava, media-json-jackson, media-multipart)

Summary of my experience with the same exception as noted above:

  • Idempotecy is broken when using PlainConnectionSocketFactory
  • Response.bufferEntity() also seems to be affected

Detail:
I recently made updates in my code to use PoolingHttpClientConnectionManager along with the ApacheConnectorProvider to improve scalability for test automation. My initialization code:

RestClientJersey.RestClientJersey()
 public RestClientJersey(int timeout, int chunkSize) {
        SSLContext ctx = initSSLTrustFactory();

        Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
                .register("http", PlainConnectionSocketFactory.getSocketFactory())
                .register("https", new SSLConnectionSocketFactory(ctx, NoopHostnameVerifier.INSTANCE))
                .build();

        ClientConfig cfg = new ClientConfig();

        PoolingHttpClientConnectionManager connMan = new PoolingHttpClientConnectionManager(registry);
        connMan.setMaxTotal(200);
        connMan.setDefaultMaxPerRoute(50);

        if (timeout != -1) {
            SocketConfig sc = SocketConfig.custom()
                    .setSoTimeout(timeout)
                    .setTcpNoDelay(true)
                    .setSoReuseAddress(true)
                    .build();
            connMan.setDefaultSocketConfig(sc);
            cfg.property(ApacheClientProperties.REQUEST_CONFIG, RequestConfig
                    .custom()
                    .setConnectTimeout(timeout)
                    .setSocketTimeout(timeout)
                    .build()
            );
        }
        cfg.property(ApacheClientProperties.CONNECTION_MANAGER, connMan);

        ApacheConnectorProvider acp = new ApacheConnectorProvider();
        cfg.connectorProvider(acp);

        ClientBuilder builder = ClientBuilder.newBuilder();
        client = builder
                .hostnameVerifier((String hostname, SSLSession session) -> true)
                .withConfig(cfg)
                .register(JacksonFeature.class)
                .register(MultiPartWriter.class)
                .build();
    }

My cleanup code below is called before attempting another request. I store the last Response on a per-thread basis so my tests don't have to worry about cleaning up and I can make sure it is closed, regardless of whether the entity was consumed or not.

myJerseyClient.java:responseCleanup()
    /**
     * If previous request didn't need/want the entity, make sure previous request
     * is closed to free up resources.
     */
    private void responseCleanup() {
        Response r = getLastResponse();
        if (r != null) {
            r.close();  //Should be idempotent and can be called again w/out issue
        }
    }

This worked fine for HTTPS requests, presumably using the SSLConnectionSocketFactory. However, when switching to HTTP (via the PlainConnectionSocketFactory), the exception occurs.

I changed my responseCleanup() method to be:

myJerseyClient.java:fresponseCleanup()
    private void responseCleanup() {
        Response r = getLastResponse();
        if (r != null) {
            r.close();
            lastResponse.put(Thread.currentThread().getId(), null); //Works now if I prevent more than one call to close()
        }
    }

An additional scenario I noticed has issues is after calling readEntity(Class<T> entityType) I want to grab the raw payload (such as JSON) in case of parsing problems. This is the code I used for that case:

myJerseyClient.java:bufferEntitySnippet
        T retInstance = null;
        if (returnType != null) {
            r.bufferEntity();
            retInstance = r.readEntity(returnType);
            
            if (retInstance instanceof InjectRawPayload) {
                ((InjectRawPayload) retInstance).setRawPayload(r.readEntity(String.class));
            }
        }
        return retInstance;

However, when I call readEntity(String.class) to retrieve the raw JSON, an exception is thrown.

java.lang.IllegalStateException: Entity input stream has already been closed.
	at org.glassfish.jersey.message.internal.EntityInputStream.ensureNotClosed(EntityInputStream.java:228)
	at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:854)
	at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:808)
	at org.glassfish.jersey.client.ClientResponse.readEntity(ClientResponse.java:326)
	at org.glassfish.jersey.client.InboundJaxrsResponse$1.call(InboundJaxrsResponse.java:115)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:419)
	at org.glassfish.jersey.client.InboundJaxrsResponse.runInScopeIfPossible(InboundJaxrsResponse.java:267)
	at org.glassfish.jersey.client.InboundJaxrsResponse.readEntity(InboundJaxrsResponse.java:112)
...




[JERSEY-3231] RequestScoped objects destroyed in wrong order Created: 14/Feb/17  Updated: 14/Feb/17

Status: Open
Project: jersey
Component/s: core
Affects Version/s: 3.0, 2.25.1
Fix Version/s: None

Type: Bug Priority: Blocker
Reporter: injeniero Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

jdk1.8.0_111
Mac OSX 10.11.6



 Description   

Objects created by RequestScoped Factories can be disposed after the Factory itself, causing the creation of a new factory to dispose the object.

Bad Case:
  ObjectFactory instance created
  Object instance created from factory
  .....
  Execution of Resource endpoint
  .....
  ObjectFactory instance disposed
  ....
  Object instance dispose will need a new ObjectFactory created to call dispose on it.
  ObjectFactory second instance is disposed
Expected Case:
  ObjectFactory instance created
  Object instance created from factory
  .....
  Execution of Resource endpoint
  .....
  Object instance disposed by calling ObjectFactory.dispose method.
  ObjectFactory instance disposed

Objects should disposed in reverse order from creation. I created a gist with the needed changes to RequestScope.Instance class. Only the modified methods are part of the gist.



 Comments   
Comment by injeniero [ 14/Feb/17 ]

I forgot to share the gist: https://gist.github.com/injeniero/4c343b76ae168481774c37f0c5af9272





[JERSEY-3136] Proxy client throws UnsupportedOperationException when calling hashCode() Created: 14/Jul/16  Updated: 11/Feb/17

Status: Open
Project: jersey
Component/s: extensions
Affects Version/s: 2.22.2
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: rsass Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

In application tear-down phase, Spring Data JPA uses a remove() method on a ConcurrentHashMap (that's why it needs hashCode()) to close all entityManagers. This method is called for each registered bean, therefore the proxy clients as well. The proxy client throws UnsupportedOperationException.

Stack trace:

java.lang.UnsupportedOperationException: Not a resource method.
	at org.glassfish.jersey.client.proxy.WebResourceFactory.invoke(WebResourceFactory.java:189) ~[jersey-proxy-client-2.22.2.jar:na]
	at com.sun.proxy.$Proxy145.hashCode(Unknown Source) ~[na:na]
	at java.util.concurrent.ConcurrentHashMap.hash(ConcurrentHashMap.java:333) ~[na:1.7.0_79]
	at java.util.concurrent.ConcurrentHashMap.remove(ConcurrentHashMap.java:1175) ~[na:1.7.0_79]
	at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessBeforeDestruction(PersistenceAnnotationBeanPostProcessor.java:374) ~[spring-orm-4.2.6.RELEASE.jar:4.2.6.RELEASE]
	at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:243) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578) [spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554) [spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:972) [spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523) [spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:979) [spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1006) [spring-context-4.2.6.RELEASE.jar:4.2.6.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:982) [spring-context-4.2.6.RELEASE.jar:4.2.6.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext$1.run(AbstractApplicationContext.java:901) [spring-context-4.2.6.RELEASE.jar:4.2.6.RELEASE]

This is very similar to JERSEY-2724 and it is mentioned here



 Comments   
Comment by rsass [ 26/Jul/16 ]

I think there is already a pull request in "Waiting for OCA" state for this issue: https://github.com/jersey/jersey/pull/169

Comment by damokles [ 31/Aug/16 ]

With Spring Boot 1.4.0 another trigger for this problem was added.

Caused by: java.lang.UnsupportedOperationException: Not a resource method.
	at org.glassfish.jersey.client.proxy.WebResourceFactory.invoke(WebResourceFactory.java:189)
	at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
	at java.util.concurrent.ConcurrentHashMap.containsKey(ConcurrentHashMap.java:964)
	at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.requiresDestruction(ScheduledAnnotationBeanPostProcessor.java:423)
	at org.springframework.beans.factory.support.DisposableBeanAdapter.hasApplicableProcessors(DisposableBeanAdapter.java:431)

Looking at the PR 169, which is now older than a year, I highly doubt that the OCA will be signed. The fix itself is trivial however and should also include equals in addition to hashCode. Maybe someone with an already signed OCA could fix it an create a new PR?

Comment by wadechandler [ 11/Feb/17 ]

I would say this is a bit more than a minor for those using Spring Boot and some other things, so I have put up https://github.com/jersey/jersey/pull/262, so hopefully it can be reviewed and merged in, and then back ported as needed/allowed depending on planned releases.





[JERSEY-3230] LOG_TRAFFIC and DUMP_ENTITY TestProperties not honored. Created: 07/Feb/17  Updated: 08/Feb/17

Status: Open
Project: jersey
Component/s: test-framework
Affects Version/s: 2.23, 2.24, 2.23.1, 2.23.2, 2.24.1, 2.25, 2.25.1, 2.26-b01, 2.26-b02
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Romain Grécourt Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When running examples/json-moxy with jersey 2.22.2, the following output is seen:

Feb 07, 2017 2:34:06 PM org.glassfish.jersey.filter.LoggingFilter log
INFO: 1 * Sending client request on thread main
1 > GET http://localhost:9998/test
1 > Accept: application/json

Feb 07, 2017 2:34:07 PM org.glassfish.jersey.filter.LoggingFilter log
INFO: 1 * Client response received on thread main
1 < 200
1 < Content-Length: 21
1 < Content-Type: application/json
1 < Date: Tue, 07 Feb 2017 22:34:07 GMT
{"a":"a","b":1,"c":1}

This stopped working as of 2.23.
Seems like LoggingFeature was introduced with that version.



 Comments   
Comment by Pavel Bucek [ 08/Feb/17 ]

Messages might not be logged at all, depends on the level of the test logger. Seems like a valid issue, we need to make sure that the messages are properly logged. Maybe we need to increase defautl Logger level. Anyway, there is a workaround:

   @Override
   protected Application configure() {
//        enable(TestProperties.LOG_TRAFFIC);
//        enable(TestProperties.DUMP_ENTITY);

       return App.createApp();
   }

   @Override
   protected void configureClient(ClientConfig config) {
       config.register(App.createMoxyJsonResolver());
       config.register(new LoggingFeature(Logger.getAnonymousLogger(), Level.INFO, LoggingFeature.Verbosity.PAYLOAD_TEXT, 1500));
   }




[JERSEY-3228] Buffer overflow due to timeout with Netty + Jersey Created: 06/Feb/17  Updated: 07/Feb/17

Status: Open
Project: jersey
Component/s: None
Affects Version/s: 2.25.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: jekh Assignee: Pavel Bucek
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

OpenJDK 1.8.0_121



 Description   

When returning a large response using the Netty connector, a "Buffer overflow" error occurs. Switching from `jersey-container-netty-http` to `jersey-container-grizzly2-http` resolves the issue, so it appears to be specific to the netty connector.

Testing with a 521k response and Jersey 2.25.1, the buffer overflow occurs in org.glassfish.jersey.netty.connector.internal.JerseyChunkedInput#write at line 224. The revelant code is:

    private void write(Provider<ByteBuffer> bufferSupplier) throws IOException {

        checkClosed();

        try {
            boolean queued = queue.offer(bufferSupplier.get(), WRITE_TIMEOUT, TimeUnit.MILLISECONDS);
            if (!queued) {
                throw new IOException("Buffer overflow.");
            }

        } catch (InterruptedException e) {
            throw new IOException(e);
        }
    }

The queue has a capacity of 8, and the offer timeout is 1000ms, which seems low.

Relevant portion of the stack trace:

Caused by: java.io.IOException: Buffer overflow.
	at org.glassfish.jersey.netty.connector.internal.JerseyChunkedInput.write(JerseyChunkedInput.java:224)
	at org.glassfish.jersey.netty.connector.internal.JerseyChunkedInput.write(JerseyChunkedInput.java:204)
	at org.glassfish.jersey.message.internal.CommittingOutputStream.write(CommittingOutputStream.java:229)
	at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$UnCloseableOutputStream.write(WriterInterceptorExecutor.java:299)
	at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)


 Comments   
Comment by Pavel Bucek [ 07/Feb/17 ]

thanks for your report.

do you have any opinion about what are reasonable defaults here?

Also, proper solution to this one is to make these settings configurable..

Comment by jekh [ 07/Feb/17 ]

Would it make sense to have an unlimited wait when offering? Users would use a javax.ws.rs.core.StreamingOutput to avoid storing large amounts of data in memory, right?





[JERSEY-3227] jersey-spring should respect @Profile annotations Created: 03/Feb/17  Updated: 03/Feb/17

Status: Open
Project: jersey
Component/s: extensions
Affects Version/s: 2.26-b02
Fix Version/s: None

Type: Improvement Priority: Critical
Reporter: niels.doucet Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: spring
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

During registration of all jersey resource bindings, the jersey spring integration should make sure to exclude any component for which the proper profile is not active.
This should be both on class and method level.

Current behaviour will just (try to) create a bean behind your back anyway using the Injections abstraction.
In some cases this will fail, because the required dependencies are not (and should not be) available because of the inactive profile.

Expected behaviour:
Any rest endpoint with an @Profile annotation that points to an inactive profile should not be available and thus respond with a 404 if the jersey-spring extension is active.






[JERSEY-2933] ClassCastException with SelectableEntityFilteringFeature Created: 05/Aug/15  Updated: 02/Feb/17

Status: Reopened
Project: jersey
Component/s: extensions
Affects Version/s: 2.19
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: heruan Assignee: Unassigned
Resolution: Unresolved Votes: 6
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Glassfish 4.1


Attachments: Zip Archive jersey-selectable-filtering-master.zip    
Issue Links:
Duplicate
is duplicated by JERSEY-2932 ClassCastException with SelectableEnt... Resolved
Sprint: Triaged

 Description   

When registering org.glassfish.jersey.message.filtering.SelectableEntityFilteringFeature to select fields to be marshalled in the response, objects with nested List fields (I suppose) throw a ClassCastException.

java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class
	at org.glassfish.jersey.message.filtering.spi.FilteringHelper._getEntityClass(FilteringHelper.java:140)
	at org.glassfish.jersey.message.filtering.spi.FilteringHelper.getEntityClass(FilteringHelper.java:98)
	at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspectEntityProperties(EntityInspectorImpl.java:163)
	at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspect(EntityInspectorImpl.java:103)
	at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspect(EntityInspectorImpl.java:110)
	at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspect(EntityInspectorImpl.java:110)
	at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspect(EntityInspectorImpl.java:110)
	at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspect(EntityInspectorImpl.java:110)
	at org.glassfish.jersey.message.filtering.spi.AbstractObjectProvider.getFilteringObject(AbstractObjectProvider.java:89)
	at org.glassfish.jersey.message.filtering.spi.AbstractObjectProvider.getFilteringObject(AbstractObjectProvider.java:83)
	at org.glassfish.jersey.moxy.json.internal.FilteringMoxyJsonProvider.preWriteTo(FilteringMoxyJsonProvider.java:80)
	at org.eclipse.persistence.jaxb.rs.MOXyJsonProvider.writeTo(MOXyJsonProvider.java:941)
	at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265)
	at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250)
	at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
	at org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:106)
	at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
	at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:86)
	at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
	at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1128)
	at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:677)
	at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:424)
	at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:414)
	at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:311)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:291)
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1140)
	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:403)
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:386)
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:334)
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)
	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
	at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
	at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)
	at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
	at java.lang.Thread.run(Thread.java:745)


 Comments   
Comment by heruan [ 05/Aug/15 ]

Here's the application code:

Application.java
package org.example;

import javax.ws.rs.ApplicationPath;
import org.glassfish.jersey.message.filtering.SelectableEntityFilteringFeature;
import org.glassfish.jersey.server.ResourceConfig;

@ApplicationPath("/api")
public class Application extends ResourceConfig {
    public Application() {
        this.packages("org.example.resource");
        this.register(SelectableEntityFilteringFeature.class);
        this.property(SelectableEntityFilteringFeature.QUERY_PARAM_NAME, "fields");
    }
}
HostResource.java
package org.example.resource;

import org.example.entity.Host;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/hosts")
public class HostResource {
    @PersistenceContext
    EntityManager em;

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public List<Host> get() {
        return em.createNamedQuery("Host.findAll").getResultList();
    }
}
Host.java
package org.example.entity;

import java.util.List;

public class Host {
    long id;
    String host;
    List<Interface> interfaces;

    // getters and setters
}
Interface.java
package org.example.entity;

import java.util.List;

public class Interface {
    long id;
    boolean main;
    int type;
    String ip;
    String dns;
    List<Item> items;

    // getters and setters
}
Item.java
package org.example.entity;

import java.util.List;

public class Item {
    long id;
    String name;
    String key;
    List<Function> functions;

    // getters and setters
}
Function.java
package org.example.entity;

import java.util.List;

public class Function {
    long id;
    String function;
    Trigger trigger;

    // getters and setters
}
Trigger.java
package org.example.entity;

import java.util.List;

public class Trigger {
    long id;
    String expression;
    String description;
    int status;

    // getters and setters
}

And this is an unfiltered JSON response:

{
  "host": "10.26.5.158",
  "id": 12345,
  "interfaces": [
    {
      "dns": "",
      "id": 2615,
      "ip": "10.26.5.158",
      "items": [
        {
          "functions": [
            {
              "function": "max",
              "id": 32002,
              "trigger": {
                "description": "{HOST.NAME} is unavailable by ICMP",
                "expression": "{32002}=0",
                "id": 24961,
                "status": 0
              }
            }
          ],
          "id": 67019,
          "key": "icmpping",
          "name": "ICMP ping"
        },
        {
          "functions": [
            {
              "function": "min",
              "id": 24613,
              "trigger": {
                "description": "Ping loss is too high on {HOST.NAME}",
                "expression": "{24613}>20",
                "id": 24962,
                "status": 0
              }
            }
          ],
          "id": 67020,
          "key": "icmppingloss",
          "name": "ICMP loss"
        },
        {
          "functions": [
            {
              "function": "avg",
              "id": 46426,
              "trigger": {
                "description": "Response time is too high on {HOST.NAME}",
                "expression": "({TRIGGER.VALUE}=0&{46426}>0.5)|({TRIGGER.VALUE}=1&{46426}>0.25)",
                "id": 24963,
                "status": 0
              }
            }
          ],
          "id": 67021,
          "key": "icmppingsec",
          "name": "ICMP response time"
        }
      ],
      "main": true,
      "type": 2
    }
  ]
}

The exception reported is thrown on the first request with or without the query fields parameter, when the feature is registered; all is well when the feature isn't registered.

Comment by Adam Lindenthal [ 12/Aug/15 ]

Hi and thanks for creating the issue.
I just spent some time trying to reproduce the problem with no success.
Would you mind sharing a complete minimalistic ready-to-go app? E.g. maven-buildable and -runnable demo app or test case.

I just tried the selectable entity filtering feature with jackson using the code you provided (with minimal changes - I didn't want to configure the persistence, so I changed the querying the entity manager into returning sample test object right from the resource, but I left the rest of your code intact) and everything worked with the feature off and on, with or without the fields parameter.

it would be very helpful, if you could minimize your usecase into something standalone and share it with us.

Thanks,
Adam

Comment by Marek Potociar [ 03/Sep/15 ]

Closing as incomplete - no response from the filer.

Comment by heruan [ 07/Oct/15 ]

Sorry for the delay, it was not simple to reproduce the problem in a ready-to-go app since I've found the issue arises only when injection occurs in the resource (e.g. the EntityManager with @PersistenceContext, but also injecting a DAO with @Inject where the DAO has on its side an EntityManager injected with @PersistenceContext). I think this is why Adam couldn't reproduce the problem, since he didn't configure persistence.

I'm using MOXy and EclipseLink 2.6.

(Should I open a new bug or this can be reopened? Thank you!)

Comment by heruan [ 07/Oct/15 ]

Here's the ready-to-go app https://github.com/heruan/jersey-selectable-filtering which breaks when deployed.

Comment by heruan [ 06/Nov/15 ]

Did anyone besides me successfully replicated this?

Comment by csolem [ 26/Nov/15 ]

I'm seeing a similar stack trace in my application with Jersey Entity Filtering. It appears on the first request only. Jersey is not configured with the SelectableEntityFilteringFeature, but with the EntityFilteringFeature.

The application is built using spring boot (1.3.0.RELEASE), spring-boot-starter-data-jpa, jackson (not Moxy) and jersey-entity-filtering (2.22.1).

java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class
	at org.glassfish.jersey.message.filtering.spi.FilteringHelper._getEntityClass(FilteringHelper.java:140) ~[jersey-entity-filtering-2.22.1.jar:na]
	at org.glassfish.jersey.message.filtering.spi.FilteringHelper.getEntityClass(FilteringHelper.java:98) ~[jersey-entity-filtering-2.22.1.jar:na]
	at org.glassfish.jersey.message.filtering.spi.AbstractEntityProcessor.process(AbstractEntityProcessor.java:89) ~[jersey-entity-filtering-2.22.1.jar:na]
	at org.glassfish.jersey.message.filtering.EntityFilteringProcessor.process(EntityFilteringProcessor.java:76) ~[jersey-entity-filtering-2.22.1.jar:na]
	at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspectStandaloneAccessors(EntityInspectorImpl.java:204) ~[jersey-entity-filtering-2.22.1.jar:na]
	at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspect(EntityInspectorImpl.java:106) ~[jersey-entity-filtering-2.22.1.jar:na]
	at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspect(EntityInspectorImpl.java:110) ~[jersey-entity-filtering-2.22.1.jar:na]
	at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspect(EntityInspectorImpl.java:110) ~[jersey-entity-filtering-2.22.1.jar:na]
	at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspect(EntityInspectorImpl.java:110) ~[jersey-entity-filtering-2.22.1.jar:na]
	at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspect(EntityInspectorImpl.java:110) ~[jersey-entity-filtering-2.22.1.jar:na]
	at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspect(EntityInspectorImpl.java:110) ~[jersey-entity-filtering-2.22.1.jar:na]
	at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspect(EntityInspectorImpl.java:110) ~[jersey-entity-filtering-2.22.1.jar:na]
	at org.glassfish.jersey.message.filtering.spi.AbstractObjectProvider.getFilteringObject(AbstractObjectProvider.java:91) ~[jersey-entity-filtering-2.22.1.jar:na]
	at org.glassfish.jersey.message.filtering.spi.AbstractObjectProvider.getFilteringObject(AbstractObjectProvider.java:85) ~[jersey-entity-filtering-2.22.1.jar:na]
	at org.glassfish.jersey.jackson.internal.FilteringJacksonJaxbJsonProvider.writeTo(FilteringJacksonJaxbJsonProvider.java:130) ~[jersey-media-json-jackson-2.22.1.jar:na]
	at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265) ~[jersey-common-2.22.1.jar:na]
	at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250) ~[jersey-common-2.22.1.jar:na]
	at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) ~[jersey-common-2.22.1.jar:na]
	at org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:106) ~[jersey-server-2.22.1.jar:na]
	at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) ~[jersey-common-2.22.1.jar:na]
	at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:86) ~[jersey-server-2.22.1.jar:na]
	at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) ~[jersey-common-2.22.1.jar:na]
	at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1130) ~[jersey-common-2.22.1.jar:na]
	at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:711) ~[jersey-server-2.22.1.jar:na]
	at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:444) ~[jersey-server-2.22.1.jar:na]
	at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:434) ~[jersey-server-2.22.1.jar:na]
	at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:329) ~[jersey-server-2.22.1.jar:na]
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) ~[jersey-common-2.22.1.jar:na]
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) ~[jersey-common-2.22.1.jar:na]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:315) ~[jersey-common-2.22.1.jar:na]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:297) ~[jersey-common-2.22.1.jar:na]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:267) ~[jersey-common-2.22.1.jar:na]
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) ~[jersey-common-2.22.1.jar:na]
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) ~[jersey-server-2.22.1.jar:na]
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) ~[jersey-server-2.22.1.jar:na]
	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:471) ~[jersey-container-servlet-core-2.22.1.jar:na]
	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:425) ~[jersey-container-servlet-core-2.22.1.jar:na]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:383) ~[jersey-container-servlet-core-2.22.1.jar:na]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:336) ~[jersey-container-servlet-core-2.22.1.jar:na]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:223) ~[jersey-container-servlet-core-2.22.1.jar:na]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) ~[tomcat-embed-core-8.0.28.jar:8.0.28]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-8.0.28.jar:8.0.28]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-embed-websocket-8.0.28.jar:8.0.28]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) ~[tomcat-embed-core-8.0.28.jar:8.0.28]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-8.0.28.jar:8.0.28]
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) ~[tomcat-embed-core-8.0.28.jar:8.0.28]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-8.0.28.jar:8.0.28]
	at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87) ~[spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) ~[tomcat-embed-core-8.0.28.jar:8.0.28]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-8.0.28.jar:8.0.28]
	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) ~[spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) ~[tomcat-embed-core-8.0.28.jar:8.0.28]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-8.0.28.jar:8.0.28]
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121) ~[spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) ~[tomcat-embed-core-8.0.28.jar:8.0.28]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-8.0.28.jar:8.0.28]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217) ~[tomcat-embed-core-8.0.28.jar:8.0.28]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [tomcat-embed-core-8.0.28.jar:8.0.28]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) [tomcat-embed-core-8.0.28.jar:8.0.28]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) [tomcat-embed-core-8.0.28.jar:8.0.28]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.0.28.jar:8.0.28]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [tomcat-embed-core-8.0.28.jar:8.0.28]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518) [tomcat-embed-core-8.0.28.jar:8.0.28]
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091) [tomcat-embed-core-8.0.28.jar:8.0.28]
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673) [tomcat-embed-core-8.0.28.jar:8.0.28]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500) [tomcat-embed-core-8.0.28.jar:8.0.28]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456) [tomcat-embed-core-8.0.28.jar:8.0.28]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_66]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_66]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.0.28.jar:8.0.28]
	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_66]
Comment by Marek Potociar [ 25/Jan/16 ]

Reducing issue priority, which means that we may not be fixing this soon, depending on available resources.

Comment by mamghari [ 17/Feb/16 ]

Hi,

Please reopen the issue. The SelectableEntityFiltering introduce some issues even when the "select" query param is not specified!

From my point of view, the filtering should be activated only when the "select" query param is specified in the URL. Furthermore, the serialization of collections is not well working when the filtering is activated. I mean I got a lot of JsonMappingExceptionMapper. What I understand is that the filtering is applied when sending the payload to the client, during the serialization. I am using Jersey 2.22.1 + Jackson.

ERROR JsonMappingExceptionMapper:29 [http-bio-8080-exec-3] Malformed Json!
com.fasterxml.jackson.databind.JsonMappingException: Can not resolve PropertyFilter with id 'java.util.HashMap'; no FilterProvider configured

The work around I found is http://stackoverflow.com/questions/35437298/jersey-jackson-data-entity-filtering-jsonmappingexception-on-collection
But it works only if the root object is a Collection, not when it is included in a Pojo.

The new issue I got today is the following one when executing Cucumber tests:

java.lang.RuntimeException: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class
at org.glassfish.jersey.jetty.JettyHttpContainer.handle(JettyHttpContainer.java:197)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:459)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:281)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:232)
at org.eclipse.jetty.io.AbstractConnection$1.run(AbstractConnection.java:505)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class
at org.glassfish.jersey.message.filtering.spi.FilteringHelper._getEntityClass(FilteringHelper.java:140)
at org.glassfish.jersey.message.filtering.spi.FilteringHelper.getEntityClass(FilteringHelper.java:98)
at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspectEntityProperties(EntityInspectorImpl.java:163)
at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspect(EntityInspectorImpl.java:103)
at org.glassfish.jersey.message.filtering.spi.AbstractObjectProvider.getFilteringObject(AbstractObjectProvider.java:91)
at org.glassfish.jersey.message.filtering.spi.AbstractObjectProvider.getFilteringObject(AbstractObjectProvider.java:85)
at org.glassfish.jersey.jackson.internal.FilteringJacksonJaxbJsonProvider.writeTo(FilteringJacksonJaxbJsonProvider.java:130)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265)

Thank you very much to help and to fix this issue,
Mohamed

Comment by mamghari [ 22/Feb/16 ]

Hi,

Do you have any news regarding this issue ?

Thank you

Comment by ftaleman [ 25/Apr/16 ]

Hi,

Getting this for every one of our requests that is serializing a JPA entity from the moment the SelectableEntityFilteringFeature or EntityFilteringFeature is enabled.

On Glassfish 4.1.1

property(SelectableEntityFilteringFeature.QUERY_PARAM_NAME, "select");
register(SelectableEntityFilteringFeature.class);

Stack trace:

Severe: Exception: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class
java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class
at org.glassfish.jersey.message.filtering.spi.FilteringHelper._getEntityClass(FilteringHelper.java:140)
at org.glassfish.jersey.message.filtering.spi.FilteringHelper.getEntityClass(FilteringHelper.java:98)
at org.glassfish.jersey.message.filtering.spi.AbstractEntityProcessor.process(AbstractEntityProcessor.java:89)
at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspectStandaloneAccessors(EntityInspectorImpl.java:204)
at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspect(EntityInspectorImpl.java:106)
at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspect(EntityInspectorImpl.java:110)
at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspect(EntityInspectorImpl.java:110)
at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspect(EntityInspectorImpl.java:110)
at org.glassfish.jersey.message.filtering.spi.AbstractObjectProvider.getFilteringObject(AbstractObjectProvider.java:91)
at org.glassfish.jersey.message.filtering.spi.AbstractObjectProvider.getFilteringObject(AbstractObjectProvider.java:85)
at org.glassfish.jersey.moxy.json.internal.FilteringMoxyJsonProvider.preWriteTo(FilteringMoxyJsonProvider.java:80)
at org.eclipse.persistence.jaxb.rs.MOXyJsonProvider.writeTo(MOXyJsonProvider.java:949)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
at org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:106)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:86)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1130)
at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:711)
at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:444)
at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:434)
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:329)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:471)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:425)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:383)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:336)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:223)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:416)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:283)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
at java.lang.Thread.run(Thread.java:745)

Is there a way to work around this error?

Thanks in advance!

Best regards
Frederik

Comment by dansiviter [ 29/Jun/16 ]

Filtering is basically not fit for purpose as no Collection types can be serialised. Any update on when a fix will be available? FYI this affects 2.23.1 also including both 2.5.4 and 2.7.5 versions of Jackson.

Comment by dansiviter [ 30/Jun/16 ]

Here's a test that throws com.fasterxml.jackson.databind.JsonMappingException: Can not resolve PropertyFilter with id 'java.util.Map'; no FilterProvider configured:

public class EntityFilteringTest extends JerseyTest {
	private static final GenericType<Map<String, String>> STRING_MAP = new GenericType<Map<String, String>>() { };

	@Override
	protected Application configure() {
		return new ResourceConfig(
				Resource.class,
				EntityFilteringFeature.class,
				JacksonFeature.class)
			.property(
				ServerProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true);
	}

	@Override
	protected DeploymentContext configureDeployment() {
		SLF4JBridgeHandler.uninstall();
		SLF4JBridgeHandler.install();

		enable(TestProperties.LOG_TRAFFIC);
		enable(TestProperties.DUMP_ENTITY);
		set(TestProperties.RECORD_LOG_LEVEL, Level.ALL.intValue());
		return super.configureDeployment();
	}

	@Test
	public void get() {
		final Map<String, String> response = target().request().get(STRING_MAP);
		assertEquals(1,  response.size());
		assertEquals("World!", response.get("Hello"));
	}


	// --- Inner Classes ---

	@Path("/")
	@Produces(MediaType.APPLICATION_JSON)
	public static class Resource {
		@GET
		public Map<String, String> get() {
			return Collections.singletonMap("Hello", "World!");
		}
	}
}

I've tried List and Set and primitives and they're OK, it just seems to be Maps and implementations of.

Update: digging further, it appears Collection types do not perform BasicSerializerFactory#findFilterId where Map types do. As FilteringJacksonJaxbJsonProvider[line:112] returns the AnnotatedClass#getName (even though it's not annotated with a filter). I question if this is valid.

Comment by pjbarry [ 02/Feb/17 ]

Ran into this today. Is there any work around?





[JERSEY-3174] SAXParserFactory doesn't disable XML entity expansion Created: 07/Oct/16  Updated: 01/Feb/17

Status: Open
Project: jersey
Component/s: security
Affects Version/s: 2.24
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: alepulver Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The DocumentBuilderFactory and XmlInputFactory providers aren't vulnerable to Billion Laughs attacks (exponential entity expansion) by disabling entity expansion altogether.

But the SAXParserFactory provider is only disabling external entities, and it's possible to use the following input to generate a very high memory consumption (specially if the application using it allows parallel requests):

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE lolz [
  <!ENTITY lol "lollollollollollollol[...]">
  <!ENTITY lol2 "&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;">
  <!ENTITY lol3 "&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;">
  <!ENTITY lol4 "&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;">
  <!ENTITY lol5 "&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;">
  <!ENTITY lol6 "&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;">
]>
<Quote> 
<fName>FIRST NAME &lol6;</fName> 
</Quote> 

There is I actually a limit, but very high (like 100000 I think, and couldn't configure it with the entityExpansionLimit JDK property). If it doesn't work try removing the last level of recursion. Even if the depth is limited, there is no maximum for the expanded size so adding a few kilobytes to the entity text would make the attack successful.

Check disallow-doctype-decl feature in this example:
https://gist.github.com/asudhakar02/45e2e6fd8bcdfb4bc3b2



 Comments   
Comment by jkharness87 [ 01/Feb/17 ]

The default appears to be 64,000 (as of JAXP 1.4):

https://docs.oracle.com/javase/tutorial/jaxp/limits/limits.html
https://jaxp.java.net/1.4/JAXP-Compatibility.html#JAXP_security

Setting the following system property would greatly limit the impact of the issue you raise (setting to 0 makes it unlimited, which you wouldn't want):

jdk.xml.entityExpansionLimit=1

I agree, though. It would be helpful to disable entity expansion altogether for systems that don't require it. More generally speaking, it'd be nice to offer control over all the configuration options as recommended by OWASP:

https://www.owasp.org/index.php/XML_External_Entity_(XXE)_Prevention_Cheat_Sheet#Java





[JERSEY-3226] Nullpointer in ServerProcessingBinder Created: 29/Jan/17  Updated: 29/Jan/17

Status: Open
Project: jersey
Component/s: None
Affects Version/s: 2.23.1, 2.25, 2.25.1
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: amanteaux Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: exceptions
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

In a certain configuration, when a Factory is bound to a request scope, nullpointers occurs in ServerProcessingBinder.

I have tried to corner the issue, from what I have figured out, the nullpointer only occurred when the dependency jersey-media-json-jackson is in the classpath. If this dependency is not in the classpath, then all is fine. Moreover, If I use the same configuration, but if I use Tomcat instead of Grizzly, there are no problem at all.

I have created to test project to reproduce the problem: https://github.com/amanteaux/jersey-test
In this project, the only problem is the error log displayed. However, in some cases, Jersey also returns an error 500 response (though Jersey does execute the web-service). That is why I qualify this bug as critical: I cannot use Grizzly in production since all my web-services that are using a Context parameter are sometimes returning error 500 responses.

Here is a very small extract of the error log:
janv. 29, 2017 7:07:14 PM org.glassfish.jersey.internal.Errors logErrors
WARNING: The following warnings have been detected: WARNING: HK2 failure has been detected in a code that does not run in an active Jersey Error scope.
WARNING: Unknown HK2 failure detected:
MultiException stack 1 of 1
java.lang.NullPointerException
at org.glassfish.jersey.server.internal.process.ServerProcessingBinder$ContainerRequestFactory$1.transform(ServerProcessingBinder.java:154)
at org.glassfish.jersey.server.internal.process.ServerProcessingBinder$ContainerRequestFactory$1.transform(ServerProcessingBinder.java:151)
[...]






[JERSEY-3224] upgrade to 1.x breaks injection Created: 20/Jan/17  Updated: 23/Jan/17

Status: Open
Project: jersey
Component/s: extensions
Affects Version/s: 2.23.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: neadamthal Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

linux, java8


Tags: injection, validation

 Description   

We were running dropwizard 0.9.2 and had been using @Inject with constructor injection on our json deserialization validation. Everything was good.

We decided it was time to upgrade to latest dropwizard (1.0.5), and with that we discovered that no longer was javax.validation using injection, but rather just a plain ol' reflection newInstance() call (via org.hibernate.validator.internal.util.privilegedactions.NewInstance class).

This of course does no injection and results in NPEs.

Perhaps this isn't the right place to log the bug, but this REALLY seems like a blunder of a change to me. How on earth can we cleanly populate our injection dependencies now?? Please help!

also, it's actually 2.23.2, but the UI here wouldn't let me select that, even tho based on the maven page that's the version dropwizard depends on.
https://mvnrepository.com/artifact/io.dropwizard/dropwizard-jersey/1.0.5



 Comments   
Comment by neadamthal [ 20/Jan/17 ]

oops the 1.x is the dropwizard version not the jersey version, but i can't find an edit button for the title.

Comment by Pavel Bucek [ 21/Jan/17 ]

have you tried to file a bug against dropwizard?

Or do you have Jersey/JAX-RS only reproducer, which runs on any other container than dropwizard?

Comment by neadamthal [ 23/Jan/17 ]

no i have not. I failed to add the stack trace where the instantiation is done. you can see below that hibernate validation fails via org.glassfish.jersey.server. does this help?

2017-01-19T13:23:34.482872+00:00 app[web.2]: WARN  [2017-01-19 13:23:34,482] [requestId=INGEST-20170119-131251371_1f2098ee-85dd-42bd-bc92-20210b37eda1] org.glassfish.jersey.server.validation.internal.ValidationExceptionMapper: Unexpected Bean Validation problem.
2017-01-19T13:23:34.482875+00:00 app[web.2]:     at org.hibernate.validator.internal.util.privilegedactions.NewInstance.run(NewInstance.java:41)
2017-01-19T13:23:34.482876+00:00 app[web.2]:     at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintValidatorFactoryImpl.run(ConstraintValidatorFactoryImpl.java:43)
2017-01-19T13:23:34.482876+00:00 app[web.2]:     at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintValidatorFactoryImpl.getInstance(ConstraintValidatorFactoryImpl.java:28)
2017-01-19T13:23:34.482877+00:00 app[web.2]:     at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintValidatorManager.createAndInitializeValidator(ConstraintValidatorManager.java:177)
2017-01-19T13:23:34.482878+00:00 app[web.2]:     at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintValidatorManager.getInitializedValidator(ConstraintValidatorManager.java:122)
2017-01-19T13:23:34.482878+00:00 app[web.2]:     at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.getConstraintValidatorNoUnwrapping(ConstraintTree.java:303)
2017-01-19T13:23:34.482879+00:00 app[web.2]:     at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.getConstraintValidatorInstanceForAutomaticUnwrapping(ConstraintTree.java:244)
2017-01-19T13:23:34.482879+00:00 app[web.2]:     at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.getInitializedConstraintValidator(ConstraintTree.java:163)
2017-01-19T13:23:34.481731+00:00 app[web.2]: INFO  [2017-01-19 13:23:34,481] [requestId=INGEST-20170119-131251371_1f2098ee-85dd-42bd-bc92-20210b37eda1] c.s.a.api.common.filters.AuthorizationFilter: activity_name=validateSystemId, message=Adding [X-System-Id=23d2a806-a686-11e6-80f5-76304dec7eb7] to request header.
2017-01-19T13:23:34.482874+00:00 app[web.2]: javax.validation.ValidationException: HV000064: Unable to instantiate ConstraintValidator: class c.s.a.a.i.validation.EventValidator.
2017-01-19T13:23:34.560491+00:00 app[web.2]: INFO  [2017-01-19 13:23:34,560] [requestId=INGEST-20170119-130316051_c2d61168-d2ee-4f97-aa69-c49da5ce0592] c.s.a.common.aspects.DurationLogger: start[1484832214559] time[0] message[activity_name=durationLogging, methodName=[c.s.a.api.common.filters.AuthorizationFilter.authenticate], message=authenticate]
2017-01-19T13:23:34.482880+00:00 app[web.2]:     at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:116)
2017-01-19T13:23:34.482880+00:00 app[web.2]:     at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:87)
2017-01-19T13:23:34.482881+00:00 app[web.2]:     at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:73)
2017-01-19T13:23:34.482881+00:00 app[web.2]:     at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForGroup(ValidatorImpl.java:1488)
2017-01-19T13:23:34.482882+00:00 app[web.2]:     at org.hibernate.validator.internal.engine.ValidatorImpl.validateParametersForSingleGroup(ValidatorImpl.java:1277)
2017-01-19T13:23:34.482882+00:00 app[web.2]:     at org.hibernate.validator.internal.engine.ValidatorImpl.validateParametersForGroup(ValidatorImpl.java:1206)
2017-01-19T13:23:34.482884+00:00 app[web.2]:     at org.hibernate.validator.internal.engine.ValidatorImpl.validateParametersInContext(ValidatorImpl.java:1124)
2017-01-19T13:23:34.482885+00:00 app[web.2]:     at org.hibernate.validator.internal.engine.ValidatorImpl.validateParameters(ValidatorImpl.java:299)
2017-01-19T13:23:34.482885+00:00 app[web.2]:     at org.hibernate.validator.internal.engine.ValidatorImpl.validateParameters(ValidatorImpl.java:253)
2017-01-19T13:23:34.482886+00:00 app[web.2]:     at io.dropwizard.jersey.validation.DropwizardConfiguredValidator.validateResourceAndInputParams(DropwizardConfiguredValidator.java:45)
2017-01-19T13:23:34.482886+00:00 app[web.2]:     at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:134)
2017-01-19T13:23:34.482887+00:00 app[web.2]:     at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)
2017-01-19T13:23:34.483611+00:00 heroku[router]: at=info method=POST path="/v2/events" host=ingest-api-major-dev.herokuapp.com request_id=INGEST-20170119-131251371 fwd="142.166.68.36" dyno=web.2 connect=0ms service=3ms status=500 bytes=344
2017-01-19T13:23:34.482888+00:00 app[web.2]:     at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
2017-01-19T13:23:34.482888+00:00 app[web.2]:     at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
2017-01-19T13:23:34.482888+00:00 app[web.2]:     at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
2017-01-19T13:23:34.482889+00:00 app[web.2]:     at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
2017-01-19T13:23:34.482890+00:00 app[web.2]:     at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)
2017-01-19T13:23:34.561580+00:00 heroku[router]: at=info method=GET path="/v1/version" host=ingest-api-major-dev.herokuapp.com request_id=INGEST-20170119-130316051 fwd="142.166.68.36" dyno=web.2 connect=0ms service=2ms status=200 bytes=581
2017-01-19T13:23:34.482890+00:00 app[web.2]:     at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
2017-01-19T13:23:34.482891+00:00 app[web.2]:     at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
2017-01-19T13:23:34.482891+00:00 app[web.2]:     at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
2017-01-19T13:23:34.482892+00:00 app[web.2]:     at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
2017-01-19T13:23:34.482892+00:00 app[web.2]:     at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
2017-01-19T13:23:34.482893+00:00 app[web.2]:     at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
2017-01-19T13:23:34.482893+00:00 app[web.2]:     at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
2017-01-19T13:23:34.482894+00:00 app[web.2]:     at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
2017-01-19T13:23:34.482895+00:00 app[web.2]:     at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
2017-01-19T13:23:34.482896+00:00 app[web.2]:     at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
2017-01-19T13:23:34.482896+00:00 app[web.2]:     at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
2017-01-19T13:23:34.482897+00:00 app[web.2]:     at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
2017-01-19T13:23:34.482898+00:00 app[web.2]:     at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
2017-01-19T13:23:34.482898+00:00 app[web.2]:     at io.dropwizard.jetty.NonblockingServletHolder.handle(NonblockingServletHolder.java:49)
2017-01-19T13:23:34.482899+00:00 app[web.2]:     at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1689)
2017-01-19T13:23:34.482899+00:00 app[web.2]:     at io.dropwizard.servlets.ThreadNameFilter.doFilter(ThreadNameFilter.java:34)
2017-01-19T13:23:34.482899+00:00 app[web.2]:     at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1676)
2017-01-19T13:23:34.482900+00:00 app[web.2]:     at io.dropwizard.jersey.filter.AllowedMethodsFilter.handle(AllowedMethodsFilter.java:50)
2017-01-19T13:23:34.482900+00:00 app[web.2]:     at io.dropwizard.jersey.filter.AllowedMethodsFilter.doFilter(AllowedMethodsFilter.java:44)
2017-01-19T13:23:34.482901+00:00 app[web.2]:     at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1676)
2017-01-19T13:23:34.482901+00:00 app[web.2]:     at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)
2017-01-19T13:23:34.482902+00:00 app[web.2]:     at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1174)
2017-01-19T13:23:34.482902+00:00 app[web.2]:     at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
2017-01-19T13:23:34.482903+00:00 app[web.2]:     at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1106)
2017-01-19T13:23:34.482903+00:00 app[web.2]:     at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
2017-01-19T13:23:34.482904+00:00 app[web.2]:     at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
2017-01-19T13:23:34.482904+00:00 app[web.2]:     at com.codahale.metrics.jetty9.InstrumentedHandler.handle(InstrumentedHandler.java:240)
2017-01-19T13:23:34.482904+00:00 app[web.2]:     at io.dropwizard.jetty.RoutingHandler.handle(RoutingHandler.java:51)
2017-01-19T13:23:34.482905+00:00 app[web.2]:     at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:396)
2017-01-19T13:23:34.482905+00:00 app[web.2]:     at io.dropwizard.jetty.BiDiGzipHandler.handle(BiDiGzipHandler.java:68)
2017-01-19T13:23:34.482906+00:00 app[web.2]:     at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:56)
2017-01-19T13:23:34.482906+00:00 app[web.2]:     at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:169)
2017-01-19T13:23:34.482907+00:00 app[web.2]:     at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
2017-01-19T13:23:34.482907+00:00 app[web.2]:     at org.eclipse.jetty.server.Server.handle(Server.java:524)
2017-01-19T13:23:34.482908+00:00 app[web.2]:     at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:319)
2017-01-19T13:23:34.482908+00:00 app[web.2]:     at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:253)
2017-01-19T13:23:34.482908+00:00 app[web.2]:     at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
2017-01-19T13:23:34.482909+00:00 app[web.2]:     at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
2017-01-19T13:23:34.482909+00:00 app[web.2]:     at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
2017-01-19T13:23:34.482910+00:00 app[web.2]:     at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
2017-01-19T13:23:34.482910+00:00 app[web.2]:     at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
2017-01-19T13:23:34.482911+00:00 app[web.2]:     at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
2017-01-19T13:23:34.482911+00:00 app[web.2]:     at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
2017-01-19T13:23:34.482912+00:00 app[web.2]:     at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
2017-01-19T13:23:34.482912+00:00 app[web.2]:     at java.lang.Thread.run(Thread.java:745)
2017-01-19T13:23:34.482913+00:00 app[web.2]: Caused by: java.lang.InstantiationException: c.s.a.a.i.validation.EventValidator
2017-01-19T13:23:34.482913+00:00 app[web.2]:     at java.lang.Class.newInstance(Class.java:427)
2017-01-19T13:23:34.482914+00:00 app[web.2]:     at org.hibernate.validator.internal.util.privilegedactions.NewInstance.run(NewInstance.java:38)
2017-01-19T13:23:34.482914+00:00 app[web.2]:     ... 69 common frames omitted
2017-01-19T13:23:34.482915+00:00 app[web.2]: Caused by: java.lang.NoSuchMethodException: c.s.a.a.i.validation.EventValidator.<init>()
2017-01-19T13:23:34.482916+00:00 app[web.2]:     at java.lang.Class.getConstructor0(Class.java:3082)
2017-01-19T13:23:34.482917+00:00 app[web.2]:     at java.lang.Class.newInstance(Class.java:412)
2017-01-19T13:23:34.482917+00:00 app[web.2]:     ... 70 common frames omitted

Comment by neadamthal [ 23/Jan/17 ]

FYI we are putting together a minimal test app.





[JERSEY-2291] Support @Immediate services by default Created: 21/Dec/13  Updated: 23/Jan/17

Status: Reopened
Project: jersey
Component/s: core
Affects Version/s: 2.5.1
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: jwells Assignee: Unassigned
Resolution: Unresolved Votes: 6
Labels: None
Remaining Estimate: 2 days
Time Spent: 1 hour
Original Estimate: 1 hour

Issue Links:
Related
is related to JERSEY-2979 ImmediateThread memory leak Resolved

 Description   

HK2 has added a new feature called @Immediate services. These are services that are started as soon as they are bound into the system. It would be nice for Jersey to support this scope/context pair by default out of the box. This would be very similar to the PerThread scope/context pair that Jersey already supports out of the box.

Here is a request from the community to support this feature:

http://stackoverflow.com/questions/20713086/what-corresponds-to-aseagersingleton-in-hk2-in-jersey-2/20721765#20721765



 Comments   
Comment by Adam Lindenthal [ 07/Sep/15 ]

https://github.com/jersey/jersey/pull/173

Comment by Adam Lindenthal [ 18/Sep/15 ]

Merged, thanks for contributing!

Comment by Adam Lindenthal [ 18/Sep/15 ]

That was actually meant for Jord - the author of the pull request on github. To you, John, thanks for reporting !

Comment by Stepan Vavra [ 06/Oct/15 ]

We had to disable Immedate Scope HK2 feature due to several issues with ImmediateThreads (tracked as HK2-280). As a result, @Immediate services do not work by default anymore.

Comment by Stepan Vavra [ 16/Nov/15 ]

I just wanted to give it a quick shoot but without a success. With 2.4.0-b33, the problem still remains. Threads are left behind on application undeploy, and also jersey-client creation implies new thread for immediate services. I'm not saying though it won't be possible to do fine tuning and make it work in jersey by default. It will require more time than just an hour...

Comment by jwells [ 23/Jan/17 ]

The changes needed for Jersey to enable Immediate scope by default have been in hk2 for a long time. Can someone please re-enable Immediate scope. Please see HK2-280 for more details





[JERSEY-3223] ResponseWriter is catching Error and rethrowing as Exception Created: 19/Jan/17  Updated: 19/Jan/17

Status: Open
Project: jersey
Component/s: core
Affects Version/s: 2.25
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: carter_nimblestorage Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

We start Jetty with the Java flags configured to heap dump and kill (restart) when we hit an OutOfMemoryError. It is important so that we can diagnose the source of the error.

${JAVA_HOME}/bin/java \
    -XX:HeapDumpPath=/scratch/diags/cores \
    -XX:+HeapDumpOnOutOfMemoryError \
    -XX:OnOutOfMemoryError="/bin/date;echo \"Process %p got an OOME.\";kill -9 %p" \
...

However Jersey is wrapping the error as an Exception, which causes Jetty to simply log it. Now our Jetty continues trying to run (unsuccessfully of course).

Please fix the implementation of ResponseWriter.rethrow so that it does not wrap Errors as Exceptions. This is much worse than JERSEY-3220 because there is no clear way here to unwrap it and be able to bubble up the Error.

2017-01-19 06:19:02.138:WARN:oejs.ServletHandler:
javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: java.lang.OutOfMemoryError: unable to create new native thread
        at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:487)
        at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:425)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:383)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:336)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:223)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:669)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:457)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
        at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
        at org.eclipse.jetty.server.Server.handle(Server.java:368)
        at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
        at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:942)
        at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1004)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:640)
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
        at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
        at java.lang.Thread.run(Thread.java:745)
Caused by:
org.glassfish.jersey.server.ContainerException: java.lang.OutOfMemoryError: unable to create new native thread
        at org.glassfish.jersey.servlet.internal.ResponseWriter.rethrow(ResponseWriter.java:278)
        at org.glassfish.jersey.servlet.internal.ResponseWriter.failure(ResponseWriter.java:260)
        at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:509)
        at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:334)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
        at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:471)
        at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:425)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:383)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:336)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:223)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:669)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:457)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
        at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
        at org.eclipse.jetty.server.Server.handle(Server.java:368)
        at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
        at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:942)
        at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1004)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:640)
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
        at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
        at java.lang.Thread.run(Thread.java:745)
Caused by:
java.lang.OutOfMemoryError: unable to create new native thread
        at java.lang.Thread.start0(Native Method)
        at java.lang.Thread.start(Thread.java:714)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1056)
        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1332)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1359)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1343)
        at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
        at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1092)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
        at com.vmware.vim25.ws.WSClient.post(WSClient.java:210)
        at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:147)
        at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:140)
        at com.vmware.pbm.PbmStub.retrieveContent(PbmStub.java:38)
        at com.vmware.vim25.mo.PbmProfileProfileManager.retrieveContent(PbmProfileProfileManager.java:66)
        at com.nimblestorage.vmware.collect.VirtualMachineFactory.newVirtualDiskInstance(VirtualMachineFactory.java:179)
        at com.nimblestorage.vmware.collect.VirtualMachineFactory.newVirtualMachineInstance(VirtualMachineFactory.java:75)
        at com.nimblestorage.vmware.collect.VMwareCollect.collectVCenter(VMwareCollect.java:539)
        at com.nimblestorage.vmware.collect.VMwareCollect.collectXml(VMwareCollect.java:219)
        at com.nimblestorage.vmware.collect.VMwareCollect.collect(VMwareCollect.java:200)
        at com.nimblestorage.hs.vcplugin.rest.resources.array.VmCollectResource.collect(VmCollectResource.java:76)
        at sun.reflect.GeneratedMethodAccessor227.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
        at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
        at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
        at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:471)
        at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:425)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:383)
        at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:425)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:383)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:336)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:223)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:669)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:457)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
        at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
        at org.eclipse.jetty.server.Server.handle(Server.java:368)
        at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
        at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:942)
        at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1004)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:640)
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
        at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
        at java.lang.Thread.run(Thread.java:745)





[JERSEY-3222] I can't capture ProcessingException when sending object instead of array Created: 16/Jan/17  Updated: 16/Jan/17

Status: Open
Project: jersey
Component/s: None
Affects Version/s: 2.25
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Dissident Assignee: Pavel Bucek
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu or Windows / JDK 1.7 / Tomat 7



 Description   

Every time you send an object instead of an expected array I get an javax.ws.rs.ProcessingException that cannot be captured by a ExceptionMapper<Exception>
I have tried different jersey 2.0 versions with the same result.

http://stackoverflow.com/questions/41544413/i-cant-capture-processingexception-when-sending-object-instead-of-array



 Comments   
Comment by Pavel Bucek [ 16/Jan/17 ]

Can you please share complete project? (ideally as github project, with described reproducer / curl command)

The exception here means that Jersey created incorrect mode somewhere - it tries to invoke resource method with different number of parameters. I haven't seen that before and the information on stackoveflow is not enough to reproduce the issue locally.

Comment by Dissident [ 16/Jan/17 ]

http://www.jcgonzalez.com/img/TestJersey.zip This is a maven project.

http://localhost:8080/TestJersey/rest/hello/post
Content-Type: application/json

I'm using RestClient for Firefox

Result OK
[

{ "test":"123456" }

]

Result error

{ "test":"123456" }
Comment by Pavel Bucek [ 16/Jan/17 ]

so you are expecting an array and you send just an element and you'll get this exception, is that correct?

Also, your GenericException, which implements ExceptionMapper, is not annotated with @Provider. @Path is only for resource classes.

Can you re-run the test and evaluate again?

Comment by Dissident [ 16/Jan/17 ]

Now the issue seems to be that I can't capture a java.lang.IllegalArgumentException when I expect and array and I just send an element.

public Response testInJSON(@Valid Test[] test) {

http://www.jcgonzalez.com/img/TestJersey2.zip

Comment by Dissident [ 16/Jan/17 ]

It seemed to work fine for a moment. The ProcessingException problem still persist.





[JERSEY-2988] @Context doesn't work on CDI beans in Tomcat Created: 14/Oct/15  Updated: 15/Jan/17

Status: Reopened
Project: jersey
Component/s: containers
Affects Version/s: 2.21, 2.22, 2.22.1
Fix Version/s: 2.22.2, 2.23

Type: Bug Priority: Major
Reporter: Christian Kaltepoth Assignee: Petr Bouda
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Apache Tomcat 8.0.23, Weld 3.0.0.Alpha13 and latest stable version



 Description   

With Jersey 2.20 I can use @Context on a CDI bean like this:

@ApplicationScoped
public class SomeBean {

  @Context
  private Configuration configuration;

}

With Jersey 2.21 and 2.22.1 the injection doesn't work any more and I get null for the configuration.

This came up because the MVC RI Ozark relies on this behavior. See OZARK-61 for the original issue.

I'll attach a minimal Maven project for demonstration. Steps to reproduce:

  1. Build the project and deploy it to Tomcat 8
  2. Open http://localhost:8080/r/test
  3. You will see that injection worked fine
  4. Now open pom.xml and change the Jersey version to 2.22.1
  5. Build and deploy it again
  6. Open http://localhost:8080/r/test
  7. You will see that injection did not work


 Comments   
Comment by Christian Kaltepoth [ 14/Oct/15 ]

Seems like I cannot attach files here. So I pushed the example app to GitHub:

https://github.com/chkal/jersey-cdi-inject

You can download the full project here:

https://github.com/chkal/jersey-cdi-inject/archive/master.zip

Comment by Petr Bouda [ 12/Nov/15 ]

Fixed in 2.x version.

Comment by Christian Kaltepoth [ 13/Nov/15 ]

Fix confirmed! Thanks a lot!

Comment by Pavel Bucek [ 30/Nov/16 ]

I'm sorry to say that, but fix for this issue has been reverted, because it caused regression in upper stack product.

Comment by jdesmet [ 15/Jan/17 ]

Is that not a show-stopper? For myself - I have two sets of functionality I have to merge in one application, one using CDI including @Context, the other using Jersey JAX-RS.

Just for the record, to get the integration to work I would try to use following dependency:

pom.xml
    ...
    <dependency>
      <groupId>org.glassfish.jersey.ext.cdi</groupId>
      <artifactId>jersey-cdi1x</artifactId>
      <version>${jersey.version}</version>
    </dependency>
    ...

See also CDI Support





[JERSEY-3221] Add BeanParam support in Jersey 2 client Created: 13/Jan/17  Updated: 14/Jan/17

Status: Open
Project: jersey
Component/s: None
Affects Version/s: 2.25
Fix Version/s: None

Type: New Feature Priority: Major
Reporter: rachana.kumari Assignee: Pavel Bucek
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Comments   
Comment by Pavel Bucek [ 13/Jan/17 ]

Please add code samples or some description about what the feature should provide (feel free to use paragraph below to have something to start with). Failing you to do so will result in closing this report as incomplete.

It makes natural sense to have this supported on the server side - you can inject Query/Path/Form/... params and other, runtime related obects. Most of them are not available on client side, because they simply don't exists in that scope. Also, how would that be accessed by the user? (Client is "a builder which returns a Response.. how would you get the instance of the annotated object? There is no "client resource" .. ).

Thanks and regards,
Pavel

Comment by rachana.kumari [ 14/Jan/17 ]

I have business scenarios where I am fetching four query params and one path param combined into BeanParam from swagger in one of java component. Now, this component will pass same (four query param and one Path Param) ahead to other component using jersey client api. Now, my first component is client invoking call to other component. Client invocation is not supporting BeanParam while I am able to accep BeanParam at server end. My first component has to ipass each queryparam and path param separately as argument to client method which nvokes server rest method.

I have analysed jersey client code and I found issue. Please find code impact of jersey client to support BeanParam :-
1) WebResourceFactory : invoke method
2) WebresourceFactory : hasAnyParamAnnotation





[JERSEY-3220] ClientRuntime is catching Throwable and wrapping as an Exception Created: 12/Jan/17  Updated: 12/Jan/17

Status: Open
Project: jersey
Component/s: core
Affects Version/s: 2.25
Fix Version/s: None

Type: Bug Priority: Major
Reporter: carter_nimblestorage Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

See for example: https://github.com/jersey/jersey/blob/master/core-client/src/main/java/org/glassfish/jersey/client/ClientRuntime.java#L261

But I see several more just in that file.

We hit an OutOfMemoryError during the invoke method, but Jersey wrapped it as a ProcessingException, so we were not able to handle it properly (it was caught & logged by our catch(Exception) block, rather than gathering a heap dump and restarting the application). Now we are putting a hack in place to check the cause of any ProcessingException and look to see if it is an error and then rethrow it, but this is a silly workaround and not easy to maintain. When we write 'catch(Exception e)', we do not expect this to catch Error.

My suggestion is it should not catch an Error and wrap it as an Exception. Instead it should catch only Exception, and allow Errors to bubble up since they are typically fatal. Or perhaps have a separate ProcessingError class that extends from Error instead of Exception.






[JERSEY-3219] Support returning generated Responses with custom Dispatcher Created: 12/Jan/17  Updated: 12/Jan/17

Status: Open
Project: jersey
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: mwhipple Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I, somewhat masochistically, tried to allow a resource method within Jersey to returns an object which is converted to a Response through the a custom dispatcher/invoker (without the additional logic within the method body); specifically I'm looking to return an rx.Observable<Response.ResponseBuilder> which is resolved and built in the invoker. I bound a custom ResourceMethodDispatcher.Provider which seems to work well, however it chokes on writing the message because the genericType information from the original declaration is added here: https://github.com/jersey/jersey/blob/master/core-server/src/main/java/org/glassfish/jersey/server/model/ResourceMethodInvoker.java#L385 which causes the Jackson provider to bug out.

This could presumably be resolved by registering a writer to handle it but that seems very kludgy. Providing a means to disable the addition of that type information should resolve the issue.

I don't see a good way to handle this (but I may be missing something or doing this totally wrong). It seems as though the invoker is too downstream to have access to the RequestProcessingContext. I can also get together a pull request if the functionality is missing but I could use some design input since I've spent little time poking around Jersey internals.






[JERSEY-3217] Remove reference to Maven Tasks for Ant Created: 05/Jan/17  Updated: 05/Jan/17

Status: Open
Project: jersey
Component/s: docs
Affects Version/s: 2.25
Fix Version/s: None

Type: Task Priority: Major
Reporter: Michael Osipov Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Chapter 2.2 says:

... Ant developers are likely to find the Ant Tasks for Maven very useful.

Those tasks have been retired years ago. Remove this reference.






[JERSEY-3216] Correct naming of "Maven Central Repository" Created: 05/Jan/17  Updated: 05/Jan/17

Status: Open
Project: jersey
Component/s: docs
Affects Version/s: 2.25
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Michael Osipov Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Chapter 1.1 says:

All modules produced as part of Jersey project build are pushed to the Central Maven Repository.

but should say:

All modules produced as part of Jersey project build are pushed to the Maven Central Repository.

Chapter 2.2 says:

Jersey releases are deployed to the Central Maven Repository.

but should say:

Jersey releases are deployed to the Maven Central Repository.

The canonical name is Maven Central Repository.
Releases already implies non-SNAPSHOT.






[JERSEY-3213] Ambiguous dependencies for type OAuth1Provider Created: 02/Jan/17  Updated: 02/Jan/17

Status: Open
Project: jersey
Component/s: security
Affects Version/s: 2.25
Fix Version/s: None

Type: Bug Priority: Major
Reporter: jinahya Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When I implement my own OAuth1Provider CDI complains with

org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type OAuth1Provider with qualifiers @Default
  at injection point [UnbackedAnnotatedField] @Inject private org.glassfish.jersey.server.oauth1.internal.AccessTokenResource.provider
  at org.glassfish.jersey.server.oauth1.internal.AccessTokenResource.provider(AccessTokenResource.java:0)
  Possible dependencies:
  - Managed Bean [class org.glassfish.jersey.server.oauth1.DefaultOAuth1Provider] with qualifiers [@Any @Default],
  - Managed Bean [class ....OAuth1Provider_] with qualifiers [@Any @Default]

OAuth1Provider_ class is my own.






[JERSEY-3212] @Produces on interface ignored by SubResource Created: 28/Dec/16  Updated: 28/Dec/16

Status: Open
Project: jersey
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: mrickard Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I'm using interfaces with JAX-RS annotations in combination with SubResources. The @Produces at the class level on the interface seems to be ignored.

@Produces on the method itself in the interface works as expected. Also, annotating the implementation class with @Produces also seems to work as expected.

See the test case below for a minimal example that demonstrates this problem. I'm expecting a 406 response from testGetTextHtmlNotAcceptable but it returns a 200 instead. With any of the workaround described above the test passes.

package org.glassfish.jersey.tests.e2e.server;

import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.junit.Assert;
import org.junit.Test;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

public class SubResourceProducesTest extends JerseyTest {

    @Path("/")
    @Produces("application/json")
    public interface ResourceApi {

        @Path("subresource")
        SubResource subResource();

    }

    public static class Resource implements ResourceApi {

        public SubResource subResource() {
            return new SubResource();
        }

    }

    @Produces("application/json")
    public interface SubResourceApi {

        String GET_STRING = "Stuff";

        @GET
        String getStuff();

    }

    public static class SubResource implements SubResourceApi {

        public String getStuff() {
            return GET_STRING;
        }

    }

    @Override
    protected Application configure() {
        return new ResourceConfig(Resource.class);
    }

    @Test
    public void testGetApplicationJson() throws Exception {
        Response response = target("subresource").request().accept(MediaType.APPLICATION_JSON).get();
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals(SubResource.GET_STRING, response.readEntity(String.class));
    }

    @Test
    public void testGetTextHtmlNotAcceptable() throws Exception {
        Response response = target("subresource").request().accept(MediaType.TEXT_HTML).get();
        Assert.assertEquals(406, response.getStatus());
    }
}






[JERSEY-3211] CLONE - Jersey API v2.19 has few struck Threads Created: 28/Dec/16  Updated: 28/Dec/16

Status: Open
Project: jersey
Component/s: performance
Affects Version/s: 2.19
Fix Version/s: None

Type: Bug Priority: Major
Reporter: anil4376 Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: incomplete
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

AIX, Weblogic application Server


Issue Links:
Cloners
clones JERSEY-2935 Jersey API v2.19 has few struck Thre... Resolved

 Description   

We developed few webservices which are running with Jersey API v2.19, in normal case application is working fine as expected. But when we started a Load Test we are seeing Few Struck Threads issues in the JERSEY API.

Please find the Thread dump of my server where you can see these struck threads..

----------------------------------------------------------------------------
thread dumps are here...

 "main" waiting for lock weblogic.t3.srvr.T3Srvr@e5a10282 WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:167)
          
            	weblogic.t3.srvr.T3Srvr.waitForDeath(T3Srvr.java:983)
          
            	weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:490)
          
            	weblogic.Server.main(Server.java:74)
          
            "JIT Compilation Thread-0" RUNNABLE
          
            null
          
            "JIT Compilation Thread-1 Suspended" RUNNABLE
          
            null
          
            "JIT Compilation Thread-2 Suspended" RUNNABLE
          
            null
          
            "JIT Compilation Thread-3 Suspended" RUNNABLE
          
            null
          
            "IProfiler" RUNNABLE
          
            null
          
            "Signal Dispatcher" RUNNABLE native
          
            	com.ibm.misc.SignalDispatcher.waitForSignal(Native Method)
          
            	com.ibm.misc.SignalDispatcher.run(SignalDispatcher.java:66)
          
            "MemoryPoolMXBean notification dispatcher" RUNNABLE native
          
            	com.ibm.lang.management.MemoryNotificationThread.processNotificationLoop(Native Method)
          
            	com.ibm.lang.management.MemoryNotificationThread.run(MemoryNotificationThread.java:54)
          
            "OperatingSystemMXBean notification dispatcher" RUNNABLE native
          
            	com.ibm.lang.management.OperatingSystemNotificationThread.processNotificationLoop(Native Method)
          
            	com.ibm.lang.management.OperatingSystemNotificationThread.run(OperatingSystemNotificationThread.java:38)
          
            "RMI Scheduler(0)" waiting for lock java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@eb078f2e WAITING native
          
            	sun.misc.Unsafe.park(Native Method)
          
            	java.util.concurrent.locks.LockSupport.park(LockSupport.java:197)
          
            	java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2054)
          
            	java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1090)
          
            	java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:818)
          
            	java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1054)
          
            	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1114)
          
            	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
          
            	java.lang.Thread.run(Thread.java:779)
          
            "RMI TCP Accept-0" RUNNABLE native
          
            	java.net.PlainSocketImpl.socketAccept(Native Method)
          
            	java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:439)
          
            	java.net.ServerSocket.implAccept(ServerSocket.java:533)
          
            	java.net.ServerSocket.accept(ServerSocket.java:501)
          
            	sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:399)
          
            	sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:371)
          
            	java.lang.Thread.run(Thread.java:779)
          
            "RMI TCP Accept-8089" RUNNABLE native
          
            	java.net.PlainSocketImpl.socketAccept(Native Method)
          
            	java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:439)
          
            	java.net.ServerSocket.implAccept(ServerSocket.java:533)
          
            	java.net.ServerSocket.accept(ServerSocket.java:501)
          
            	sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:399)
          
            	sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:371)
          
            	java.lang.Thread.run(Thread.java:779)
          
            "RMI TCP Accept-0" RUNNABLE native
          
            	java.net.PlainSocketImpl.socketAccept(Native Method)
          
            	java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:439)
          
            	java.net.ServerSocket.implAccept(ServerSocket.java:533)
          
            	java.net.ServerSocket.accept(ServerSocket.java:501)
          
            	sun.management.jmxremote.LocalRMIServerSocketFactory$1.accept(LocalRMIServerSocketFactory.java:64)
          
            	sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:399)
          
            	sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:371)
          
            	java.lang.Thread.run(Thread.java:779)
          
            "Concurrent Mark Helper" RUNNABLE
          
            null
          
            "GC Slave" RUNNABLE
          
            null
          
            "GC Slave" RUNNABLE
          
            null
          
            "GC Slave" RUNNABLE
          
            null
          
            "GC Slave" RUNNABLE
          
            null
          
            "GC Slave" RUNNABLE
          
            null
          
            "GC Slave" RUNNABLE
          
            null
          
            "GC Slave" RUNNABLE
          
            null
          
            "GC Slave" RUNNABLE
          
            null
          
            "GC Slave" RUNNABLE
          
            null
          
            "GC Slave" RUNNABLE
          
            null
          
            "GC Slave" RUNNABLE
          
            null
          
            "GC Slave" RUNNABLE
          
            null
          
            "GC Slave" RUNNABLE
          
            null
          
            "GC Slave" RUNNABLE
          
            null
          
            "GC Slave" RUNNABLE
          
            null
          
            "dtautosensor" RUNNABLE
          
            null
          
            "dtcontroller" RUNNABLE
          
            null
          
            "dtmetricstimer" RUNNABLE
          
            null
          
            "Attach API wait loop" RUNNABLE native
          
            	com.ibm.tools.attach.javaSE.IPC.waitSemaphore(Native Method)
          
            	com.ibm.tools.attach.javaSE.CommonDirectory.waitSemaphore(CommonDirectory.java:193)
          
            	com.ibm.tools.attach.javaSE.AttachHandler$WaitLoop.waitForNotification(AttachHandler.java:328)
          
            	com.ibm.tools.attach.javaSE.AttachHandler$WaitLoop.run(AttachHandler.java:406)
          
            "Thread-13" waiting for lock java.util.Timer$TimerImpl@daed87c6 WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:167)
          
            	java.util.Timer$TimerImpl.run(Timer.java:230)
          
            "Thread-14" waiting for lock java.util.Timer$TimerImpl@b190e2c5 TIMED_WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:196)
          
            	java.util.Timer$TimerImpl.run(Timer.java:250)
          
            "[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'" waiting for lock com.ibm.mq.jmqi.remote.internal.system.RemoteProxyQueue$GetterEventMonitor@bb4a42bd TIMED_WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:196)
          
            	com.ibm.mq.jmqi.remote.internal.system.RemoteProxyQueue.proxyMQGET(RemoteProxyQueue.java:2569)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGetMessageWithRecon(RemoteFAP.java:6157)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGetMessage(RemoteFAP.java:6053)
          
            	com.ibm.mq.jmqi.internal.JmqiTools.getMessage(JmqiTools.java:1084)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGet(RemoteFAP.java:6021)
          
            	com.ibm.msg.client.wmq.internal.WMQConsumerShadow.getMsg(WMQConsumerShadow.java:1256)
          
            	com.ibm.msg.client.wmq.internal.WMQSyncConsumerShadow.receiveInternal(WMQSyncConsumerShadow.java:233)
          
            	com.ibm.msg.client.wmq.internal.WMQConsumerShadow.receive(WMQConsumerShadow.java:1009)
          
            	com.ibm.msg.client.wmq.internal.WMQMessageConsumer.receive(WMQMessageConsumer.java:459)
          
            	com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.receiveInboundMessage(JmsMessageConsumerImpl.java:765)
          
            	com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.receive(JmsMessageConsumerImpl.java:446)
          
            	com.ibm.mq.jms.MQMessageConsumer.receive(MQMessageConsumer.java:258)
          
            	weblogic.deployment.jms.WrappedMessageConsumer.receive(WrappedMessageConsumer.java:201)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller$1.run(NewJMSMessagePoller.java:272)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller$1.run(NewJMSMessagePoller.java:269)
          
            	weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
          
            	weblogic.ejb.container.internal.JMSConnectionPoller.doPrivilegedJMSAction(JMSConnectionPoller.java:2748)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller.processOneMessage(NewJMSMessagePoller.java:268)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller.run(NewJMSMessagePoller.java:126)
          
            	weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
          
            	weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
          
            	weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
          
            "weblogic.time.TimeEventGenerator" waiting for lock weblogic.time.common.internal.TimeTable@2cb31fcf TIMED_WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:196)
          
            	weblogic.time.common.internal.TimeTable.snooze(TimeTable.java:286)
          
            	weblogic.time.common.internal.TimeEventGenerator.run(TimeEventGenerator.java:117)
          
            	java.lang.Thread.run(Thread.java:779)
          
            "weblogic.timers.TimerThread" waiting for lock weblogic.timers.internal.TimerThread@e78cf78b TIMED_WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:196)
          
            	weblogic.timers.internal.TimerThread$Thread.run(TimerThread.java:262)
          
            "NM Reaper" waiting for lock java.util.Timer$TimerImpl@b943809f TIMED_WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:196)
          
            	java.util.Timer$TimerImpl.run(Timer.java:250)
          
            "[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'" RUNNABLE native
          
            	com.ibm.lang.management.ThreadMXBeanImpl.getMultiThreadInfoImpl(Native Method)
          
            	com.ibm.lang.management.ThreadMXBeanImpl.getThreadInfo(ThreadMXBeanImpl.java:251)
          
            	weblogic.platform.VM15.threadDumpAsString(VM15.java:22)
          
            	weblogic.platform.VM.threadDumpAsString(VM.java:137)
          
            	weblogic.t3.srvr.JVMRuntime.getThreadStackDump(JVMRuntime.java:114)
          
            	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          
            	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
          
            	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
          
            	java.lang.reflect.Method.invoke(Method.java:613)
          
            	weblogic.management.jmx.modelmbean.WLSModelMBean.getAttribute(WLSModelMBean.java:525)
          
            	com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:659)
          
            	com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:680)
          
            	weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase$12.run(WLSMBeanServerInterceptorBase.java:326)
          
            	java.security.AccessController.doPrivileged(AccessController.java:280)
          
            	weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase.getAttribute(WLSMBeanServerInterceptorBase.java:324)
          
            	weblogic.management.mbeanservers.internal.JMXContextInterceptor.getAttribute(JMXContextInterceptor.java:157)
          
            	weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase$12.run(WLSMBeanServerInterceptorBase.java:326)
          
            	java.security.AccessController.doPrivileged(AccessController.java:280)
          
            	weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase.getAttribute(WLSMBeanServerInterceptorBase.java:324)
          
            	weblogic.management.mbeanservers.internal.SecurityInterceptor.getAttribute(SecurityInterceptor.java:299)
          
            	weblogic.management.jmx.mbeanserver.WLSMBeanServer.getAttribute(WLSMBeanServer.java:279)
          
            	weblogic.management.mbeanservers.internal.JMXConnectorSubjectForwarder$5$1.run(JMXConnectorSubjectForwarder.java:326)
          
            	java.security.AccessController.doPrivileged(AccessController.java:280)
          
            	weblogic.management.mbeanservers.internal.JMXConnectorSubjectForwarder$5.run(JMXConnectorSubjectForwarder.java:324)
          
            	weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
          
            	weblogic.management.mbeanservers.internal.JMXConnectorSubjectForwarder.getAttribute(JMXConnectorSubjectForwarder.java:319)
          
            	javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1435)
          
            	javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:100)
          
            	javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1303)
          
            	java.security.AccessController.doPrivileged(AccessController.java:314)
          
            	javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1398)
          
            	javax.management.remote.rmi.RMIConnectionImpl.getAttribute(RMIConnectionImpl.java:632)
          
            	javax.management.remote.rmi.RMIConnectionImpl_WLSkel.invoke(Unknown Source)
          
            	weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:695)
          
            	weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:520)
          
            	weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
          
            	weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
          
            	weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:516)
          
            	weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
          
            	weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
          
            	weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
          
            "ExecuteThread: '0' for queue: 'weblogic.socket.Muxer'" waiting for lock weblogic.socket.PosixSocketMuxer$1@f856322a BLOCKED
          
            	weblogic.socket.PosixSocketMuxer.processSockets(PosixSocketMuxer.java:93)
          
            	weblogic.socket.SocketReaderRequest.run(SocketReaderRequest.java:29)
          
            	weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:42)
          
            	weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:147)
          
            	weblogic.kernel.ExecuteThread.run(ExecuteThread.java:119)
          
            "ExecuteThread: '1' for queue: 'weblogic.socket.Muxer'" RUNNABLE native
          
            	weblogic.socket.PosixSocketMuxer.poll(Native Method)
          
            	weblogic.socket.PosixSocketMuxer.processSockets(PosixSocketMuxer.java:102)
          
            	weblogic.socket.SocketReaderRequest.run(SocketReaderRequest.java:29)
          
            	weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:42)
          
            	weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:147)
          
            	weblogic.kernel.ExecuteThread.run(ExecuteThread.java:119)
          
            "ExecuteThread: '2' for queue: 'weblogic.socket.Muxer'" waiting for lock weblogic.socket.PosixSocketMuxer$1@f856322a BLOCKED
          
            	weblogic.socket.PosixSocketMuxer.processSockets(PosixSocketMuxer.java:93)
          
            	weblogic.socket.SocketReaderRequest.run(SocketReaderRequest.java:29)
          
            	weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:42)
          
            	weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:147)
          
            	weblogic.kernel.ExecuteThread.run(ExecuteThread.java:119)
          
            "ExecuteThread: '3' for queue: 'weblogic.socket.Muxer'" waiting for lock weblogic.socket.PosixSocketMuxer$1@f856322a BLOCKED
          
            	weblogic.socket.PosixSocketMuxer.processSockets(PosixSocketMuxer.java:93)
          
            	weblogic.socket.SocketReaderRequest.run(SocketReaderRequest.java:29)
          
            	weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:42)
          
            	weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:147)
          
            	weblogic.kernel.ExecuteThread.run(ExecuteThread.java:119)
          
            "VDE Transaction Processor Thread" waiting for lock com.octetstring.vde.backend.standard.TransactionProcessor@ecc086c0 WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:167)
          
            	com.octetstring.vde.backend.standard.TransactionProcessor.waitChange(TransactionProcessor.java:367)
          
            	com.octetstring.vde.backend.standard.TransactionProcessor.run(TransactionProcessor.java:212)
          
            "DoSManager" TIMED_WAITING native
          
            	java.lang.Thread.sleep(Native Method)
          
            	java.lang.Thread.sleep(Thread.java:903)
          
            	com.octetstring.vde.DoSManager.run(DoSManager.java:433)
          
            "Thread-23" waiting for lock java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@69cc497c WAITING native
          
            	sun.misc.Unsafe.park(Native Method)
          
            	java.util.concurrent.locks.LockSupport.park(LockSupport.java:197)
          
            	java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2054)
          
            	java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:453)
          
            	weblogic.utils.concurrent.JDK15ConcurrentBlockingQueue.take(JDK15ConcurrentBlockingQueue.java:89)
          
            	weblogic.store.internal.PersistentStoreImpl.getOutstandingWork(PersistentStoreImpl.java:676)
          
            	weblogic.store.internal.PersistentStoreImpl.run(PersistentStoreImpl.java:751)
          
            	java.lang.Thread.run(Thread.java:779)
          
            "WebSphere MQ Trace Monitor" TIMED_WAITING native
          
            	java.lang.Thread.sleep(Native Method)
          
            	java.lang.Thread.sleep(Thread.java:903)
          
            	com.ibm.mq.commonservices.internal.monitor.TraceMonitor.run(TraceMonitor.java:134)
          
            "JMSCCThreadPoolMaster" waiting for lock java.lang.Object@92a8915b WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:167)
          
            	com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$WorkQueueManagerThread.waitForNotification(WorkQueueManagerImplementation.java:651)
          
            	com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$WorkQueueManagerThread.waitForNotification(WorkQueueManagerImplementation.java:621)
          
            	com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$WorkQueueManagerThread.run(WorkQueueManagerImplementation.java:887)
          
            "Finalizer thread" RUNNABLE
          
            null
          
            "Thread-55" waiting for lock java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@7579b8c3 WAITING native
          
            	sun.misc.Unsafe.park(Native Method)
          
            	java.util.concurrent.locks.LockSupport.park(LockSupport.java:197)
          
            	java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2054)
          
            	java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:453)
          
            	weblogic.utils.concurrent.JDK15ConcurrentBlockingQueue.take(JDK15ConcurrentBlockingQueue.java:89)
          
            	weblogic.store.internal.PersistentStoreImpl.getOutstandingWork(PersistentStoreImpl.java:676)
          
            	weblogic.store.internal.PersistentStoreImpl.run(PersistentStoreImpl.java:751)
          
            	java.lang.Thread.run(Thread.java:779)
          
            "weblogic.cluster.MessageReceiver" waiting for lock java.util.ArrayList@cc6f8432 WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:167)
          
            	weblogic.cluster.messaging.internal.server.UnicastFragmentSocket.receive(UnicastFragmentSocket.java:105)
          
            	weblogic.cluster.FragmentSocketWrapper.receive(FragmentSocketWrapper.java:98)
          
            	weblogic.cluster.MulticastManager.run(MulticastManager.java:466)
          
            	java.lang.Thread.run(Thread.java:779)
          
            "[STUCK] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'" waiting for lock jersey.repackaged.com.google.common.util.concurrent.AbstractFuture$Sync@b075b646 WAITING native
          
            	sun.misc.Unsafe.park(Native Method)
          
            	java.util.concurrent.locks.LockSupport.park(LockSupport.java:197)
          
            	java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:845)
          
            	java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1005)
          
            	java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1314)
          
            	jersey.repackaged.com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:285)
          
            	jersey.repackaged.com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116)
          
            	org.glassfish.jersey.servlet.internal.ResponseWriter.getResponseContext(ResponseWriter.java:277)
          
            	org.glassfish.jersey.servlet.internal.ResponseWriter.commit(ResponseWriter.java:191)
          
            	org.glassfish.jersey.server.ContainerResponse.close(ContainerResponse.java:413)
          
            	org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:750)
          
            	org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:424)
          
            	org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:414)
          
            	org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:311)
          
            	org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
          
            	org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
          
            	org.glassfish.jersey.internal.Errors.process(Errors.java:315)
          
            	org.glassfish.jersey.internal.Errors.process(Errors.java:297)
          
            	org.glassfish.jersey.internal.Errors.process(Errors.java:267)
          
            	org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
          
            	org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:291)
          
            	org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1140)
          
            	org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:403)
          
            	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:386)
          
            	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:334)
          
            	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)
          
            	weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:242)
          
            	weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:216)
          
            	weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:132)
          
            	weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:338)
          
            	weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:221)
          
            	weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3284)
          
            	weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3254)
          
            	weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
          
            	weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
          
            	weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
          
            	weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2163)
          
            	weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2089)
          
            	weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2074)
          
            	weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1513)
          
            	weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254)
          
            	weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
          
            	weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
          
            "weblogic.GCMonitor" waiting for lock java.lang.ref.ReferenceQueue@ceccea6f TIMED_WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:196)
          
            	java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
          
            	weblogic.platform.GCMonitorThread.waitForNotification(GCMonitorThread.java:88)
          
            	weblogic.platform.GCMonitorThread.run(GCMonitorThread.java:64)
          
            "DynamicListenThread[Default]" RUNNABLE native
          
            	java.net.PlainSocketImpl.socketAccept(Native Method)
          
            	java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:439)
          
            	java.net.ServerSocket.implAccept(ServerSocket.java:533)
          
            	java.net.ServerSocket.accept(ServerSocket.java:501)
          
            	weblogic.socket.WeblogicServerSocket.accept(WeblogicServerSocket.java:38)
          
            	weblogic.server.channels.DynamicListenThread$SocketAccepter.accept(DynamicListenThread.java:535)
          
            	weblogic.server.channels.DynamicListenThread$SocketAccepter.access$200(DynamicListenThread.java:417)
          
            	weblogic.server.channels.DynamicListenThread.run(DynamicListenThread.java:173)
          
            	java.lang.Thread.run(Thread.java:779)
          
            "[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'" waiting for lock com.ibm.mq.jmqi.remote.internal.system.RemoteProxyQueue$GetterEventMonitor@5baca671 TIMED_WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:196)
          
            	com.ibm.mq.jmqi.remote.internal.system.RemoteProxyQueue.proxyMQGET(RemoteProxyQueue.java:2569)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGetMessageWithRecon(RemoteFAP.java:6157)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGetMessage(RemoteFAP.java:6053)
          
            	com.ibm.mq.jmqi.internal.JmqiTools.getMessage(JmqiTools.java:1084)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGet(RemoteFAP.java:6021)
          
            	com.ibm.msg.client.wmq.internal.WMQConsumerShadow.getMsg(WMQConsumerShadow.java:1256)
          
            	com.ibm.msg.client.wmq.internal.WMQSyncConsumerShadow.receiveInternal(WMQSyncConsumerShadow.java:233)
          
            	com.ibm.msg.client.wmq.internal.WMQConsumerShadow.receive(WMQConsumerShadow.java:1009)
          
            	com.ibm.msg.client.wmq.internal.WMQMessageConsumer.receive(WMQMessageConsumer.java:459)
          
            	com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.receiveInboundMessage(JmsMessageConsumerImpl.java:765)
          
            	com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.receive(JmsMessageConsumerImpl.java:446)
          
            	com.ibm.mq.jms.MQMessageConsumer.receive(MQMessageConsumer.java:258)
          
            	weblogic.deployment.jms.WrappedMessageConsumer.receive(WrappedMessageConsumer.java:201)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller$1.run(NewJMSMessagePoller.java:272)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller$1.run(NewJMSMessagePoller.java:269)
          
            	weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
          
            	weblogic.ejb.container.internal.JMSConnectionPoller.doPrivilegedJMSAction(JMSConnectionPoller.java:2748)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller.processOneMessage(NewJMSMessagePoller.java:268)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller.run(NewJMSMessagePoller.java:126)
          
            	weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
          
            	weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
          
            	weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
          
            "[ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'" waiting for lock com.ibm.mq.jmqi.remote.internal.system.RemoteProxyQueue$GetterEventMonitor@7e1c1699 TIMED_WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:196)
          
            	com.ibm.mq.jmqi.remote.internal.system.RemoteProxyQueue.proxyMQGET(RemoteProxyQueue.java:2569)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGetMessageWithRecon(RemoteFAP.java:6157)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGetMessage(RemoteFAP.java:6053)
          
            	com.ibm.mq.jmqi.internal.JmqiTools.getMessage(JmqiTools.java:1084)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGet(RemoteFAP.java:6021)
          
            	com.ibm.msg.client.wmq.internal.WMQConsumerShadow.getMsg(WMQConsumerShadow.java:1256)
          
            	com.ibm.msg.client.wmq.internal.WMQSyncConsumerShadow.receiveInternal(WMQSyncConsumerShadow.java:233)
          
            	com.ibm.msg.client.wmq.internal.WMQConsumerShadow.receive(WMQConsumerShadow.java:1009)
          
            	com.ibm.msg.client.wmq.internal.WMQMessageConsumer.receive(WMQMessageConsumer.java:459)
          
            	com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.receiveInboundMessage(JmsMessageConsumerImpl.java:765)
          
            	com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.receive(JmsMessageConsumerImpl.java:446)
          
            	com.ibm.mq.jms.MQMessageConsumer.receive(MQMessageConsumer.java:258)
          
            	weblogic.deployment.jms.WrappedMessageConsumer.receive(WrappedMessageConsumer.java:201)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller$1.run(NewJMSMessagePoller.java:272)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller$1.run(NewJMSMessagePoller.java:269)
          
            	weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
          
            	weblogic.ejb.container.internal.JMSConnectionPoller.doPrivilegedJMSAction(JMSConnectionPoller.java:2748)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller.processOneMessage(NewJMSMessagePoller.java:268)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller.run(NewJMSMessagePoller.java:126)
          
            	weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
          
            	weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
          
            	weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64511,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	java.lang.Thread.run(Thread.java:779)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64512,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.runTask(WorkQueueItem.java:209)
          
            	com.ibm.msg.client.commonservices.workqueue.SimpleWorkQueueItem.runItem(SimpleWorkQueueItem.java:100)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.run(WorkQueueItem.java:224)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.runWorkQueueItem(WorkQueueManager.java:298)
          
            	com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$ThreadPoolWorker.run(WorkQueueManagerImplementation.java:1220)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64515,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	java.lang.Thread.run(Thread.java:779)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64516,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.runTask(WorkQueueItem.java:209)
          
            	com.ibm.msg.client.commonservices.workqueue.SimpleWorkQueueItem.runItem(SimpleWorkQueueItem.java:100)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.run(WorkQueueItem.java:224)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.runWorkQueueItem(WorkQueueManager.java:298)
          
            	com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$ThreadPoolWorker.run(WorkQueueManagerImplementation.java:1220)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64519,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	java.lang.Thread.run(Thread.java:779)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64520,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.runTask(WorkQueueItem.java:209)
          
            	com.ibm.msg.client.commonservices.workqueue.SimpleWorkQueueItem.runItem(SimpleWorkQueueItem.java:100)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.run(WorkQueueItem.java:224)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.runWorkQueueItem(WorkQueueManager.java:298)
          
            	com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$ThreadPoolWorker.run(WorkQueueManagerImplementation.java:1220)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64522,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.runTask(WorkQueueItem.java:209)
          
            	com.ibm.msg.client.commonservices.workqueue.SimpleWorkQueueItem.runItem(SimpleWorkQueueItem.java:100)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.run(WorkQueueItem.java:224)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.runWorkQueueItem(WorkQueueManager.java:298)
          
            	com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$ThreadPoolWorker.run(WorkQueueManagerImplementation.java:1220)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64523,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.runTask(WorkQueueItem.java:209)
          
            	com.ibm.msg.client.commonservices.workqueue.SimpleWorkQueueItem.runItem(SimpleWorkQueueItem.java:100)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.run(WorkQueueItem.java:224)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.runWorkQueueItem(WorkQueueManager.java:298)
          
            	com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$ThreadPoolWorker.run(WorkQueueManagerImplementation.java:1220)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64524,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.runTask(WorkQueueItem.java:209)
          
            	com.ibm.msg.client.commonservices.workqueue.SimpleWorkQueueItem.runItem(SimpleWorkQueueItem.java:100)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.run(WorkQueueItem.java:224)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.runWorkQueueItem(WorkQueueManager.java:298)
          
            	com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$ThreadPoolWorker.run(WorkQueueManagerImplementation.java:1220)
          
            "[ACTIVE] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'" waiting for lock weblogic.work.ExecuteThread@328433a1 WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:167)
          
            	weblogic.work.ExecuteThread.waitForRequest(ExecuteThread.java:205)
          
            	weblogic.work.ExecuteThread.run(ExecuteThread.java:226)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64526,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	java.lang.Thread.run(Thread.java:779)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64527,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.runTask(WorkQueueItem.java:209)
          
            	com.ibm.msg.client.commonservices.workqueue.SimpleWorkQueueItem.runItem(SimpleWorkQueueItem.java:100)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.run(WorkQueueItem.java:224)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.runWorkQueueItem(WorkQueueManager.java:298)
          
            	com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$ThreadPoolWorker.run(WorkQueueManagerImplementation.java:1220)
          
            "[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'" waiting for lock weblogic.work.ExecuteThread@b7a4243e WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:167)
          
            	weblogic.work.ExecuteThread.waitForRequest(ExecuteThread.java:205)
          
            	weblogic.work.ExecuteThread.run(ExecuteThread.java:226)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64532,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.runTask(WorkQueueItem.java:209)
          
            	com.ibm.msg.client.commonservices.workqueue.SimpleWorkQueueItem.runItem(SimpleWorkQueueItem.java:100)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.run(WorkQueueItem.java:224)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.runWorkQueueItem(WorkQueueManager.java:298)
          
            	com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$ThreadPoolWorker.run(WorkQueueManagerImplementation.java:1220)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64531,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	java.lang.Thread.run(Thread.java:779)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64533,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.runTask(WorkQueueItem.java:209)
          
            	com.ibm.msg.client.commonservices.workqueue.SimpleWorkQueueItem.runItem(SimpleWorkQueueItem.java:100)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.run(WorkQueueItem.java:224)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.runWorkQueueItem(WorkQueueManager.java:298)
          
            	com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$ThreadPoolWorker.run(WorkQueueManagerImplementation.java:1220)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64537,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	java.lang.Thread.run(Thread.java:779)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64538,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.runTask(WorkQueueItem.java:209)
          
            	com.ibm.msg.client.commonservices.workqueue.SimpleWorkQueueItem.runItem(SimpleWorkQueueItem.java:100)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.run(WorkQueueItem.java:224)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.runWorkQueueItem(WorkQueueManager.java:298)
          
            	com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$ThreadPoolWorker.run(WorkQueueManagerImplementation.java:1220)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64539,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.runTask(WorkQueueItem.java:209)
          
            	com.ibm.msg.client.commonservices.workqueue.SimpleWorkQueueItem.runItem(SimpleWorkQueueItem.java:100)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.run(WorkQueueItem.java:224)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.runWorkQueueItem(WorkQueueManager.java:298)
          
            	com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$ThreadPoolWorker.run(WorkQueueManagerImplementation.java:1220)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64542,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	java.lang.Thread.run(Thread.java:779)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64543,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.runTask(WorkQueueItem.java:209)
          
            	com.ibm.msg.client.commonservices.workqueue.SimpleWorkQueueItem.runItem(SimpleWorkQueueItem.java:100)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.run(WorkQueueItem.java:224)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.runWorkQueueItem(WorkQueueManager.java:298)
          
            	com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$ThreadPoolWorker.run(WorkQueueManagerImplementation.java:1220)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64544,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.runTask(WorkQueueItem.java:209)
          
            	com.ibm.msg.client.commonservices.workqueue.SimpleWorkQueueItem.runItem(SimpleWorkQueueItem.java:100)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.run(WorkQueueItem.java:224)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.runWorkQueueItem(WorkQueueManager.java:298)
          
            	com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$ThreadPoolWorker.run(WorkQueueManagerImplementation.java:1220)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64547,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	java.lang.Thread.run(Thread.java:779)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64548,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.runTask(WorkQueueItem.java:209)
          
            	com.ibm.msg.client.commonservices.workqueue.SimpleWorkQueueItem.runItem(SimpleWorkQueueItem.java:100)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.run(WorkQueueItem.java:224)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.runWorkQueueItem(WorkQueueManager.java:298)
          
            	com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$ThreadPoolWorker.run(WorkQueueManagerImplementation.java:1220)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64549,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.runTask(WorkQueueItem.java:209)
          
            	com.ibm.msg.client.commonservices.workqueue.SimpleWorkQueueItem.runItem(SimpleWorkQueueItem.java:100)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.run(WorkQueueItem.java:224)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.runWorkQueueItem(WorkQueueManager.java:298)
          
            	com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$ThreadPoolWorker.run(WorkQueueManagerImplementation.java:1220)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64552,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.runTask(WorkQueueItem.java:209)
          
            	com.ibm.msg.client.commonservices.workqueue.SimpleWorkQueueItem.runItem(SimpleWorkQueueItem.java:100)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.run(WorkQueueItem.java:224)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.runWorkQueueItem(WorkQueueManager.java:298)
          
            	com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$ThreadPoolWorker.run(WorkQueueManagerImplementation.java:1220)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64553,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	java.lang.Thread.run(Thread.java:779)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64554,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.runTask(WorkQueueItem.java:209)
          
            	com.ibm.msg.client.commonservices.workqueue.SimpleWorkQueueItem.runItem(SimpleWorkQueueItem.java:100)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.run(WorkQueueItem.java:224)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.runWorkQueueItem(WorkQueueManager.java:298)
          
            	com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$ThreadPoolWorker.run(WorkQueueManagerImplementation.java:1220)
          
            "RcvThread: com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection[qmid=QM_OLT_PP_2015-05-22_15.17.20                   ,fap=10,peer=/10.10.10.10,localport=64555,ssl=no]" RUNNABLE native
          
            	java.net.SocketInputStream.socketRead0(Native Method)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:161)
          
            	java.net.SocketInputStream.read(SocketInputStream.java:132)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1409)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:737)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:701)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:146)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.runTask(WorkQueueItem.java:209)
          
            	com.ibm.msg.client.commonservices.workqueue.SimpleWorkQueueItem.runItem(SimpleWorkQueueItem.java:100)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.run(WorkQueueItem.java:224)
          
            	com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.runWorkQueueItem(WorkQueueManager.java:298)
          
            	com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$ThreadPoolWorker.run(WorkQueueManagerImplementation.java:1220)
          
            "[ACTIVE] ExecuteThread: '7' for queue: 'weblogic.kernel.Default (self-tuning)'" waiting for lock weblogic.work.ExecuteThread@7e87f493 WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:167)
          
            	weblogic.work.ExecuteThread.waitForRequest(ExecuteThread.java:205)
          
            	weblogic.work.ExecuteThread.run(ExecuteThread.java:226)
          
            "[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'" waiting for lock com.ibm.mq.jmqi.remote.internal.RemoteHconn$AsyncTshLock@9bc674a9 TIMED_WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:196)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteHconn.receiveAsyncTsh(RemoteHconn.java:1914)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteHconn.receiveTSH(RemoteHconn.java:1166)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteHconn.receiveMQIFlow(RemoteHconn.java:1711)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteFAP.xa_end(RemoteFAP.java:9977)
          
            	com.ibm.mq.jmqi.JmqiXAResource.end(JmqiXAResource.java:440)
          
            	weblogic.deployment.jms.WrappedXAResource_com_ibm_mq_jmqi_JmqiXAResource.end(Unknown Source)
          
            	weblogic.transaction.internal.XAServerResourceInfo.end(XAServerResourceInfo.java:1297)
          
            	weblogic.transaction.internal.XAServerResourceInfo.internalDelist(XAServerResourceInfo.java:415)
          
            	weblogic.transaction.internal.XAServerResourceInfo.delist(XAServerResourceInfo.java:337)
          
            	weblogic.transaction.internal.ServerTransactionImpl.delistAll(ServerTransactionImpl.java:1690)
          
            	weblogic.transaction.internal.ServerTransactionImpl.localRollback(ServerTransactionImpl.java:2083)
          
            	weblogic.transaction.internal.ServerTransactionImpl.globalRetryRollback(ServerTransactionImpl.java:3170)
          
            	weblogic.transaction.internal.ServerTransactionImpl.globalRollback(ServerTransactionImpl.java:2919)
          
            	weblogic.transaction.internal.ServerTransactionImpl.internalRollback(ServerTransactionImpl.java:442)
          
            	weblogic.transaction.internal.ServerTransactionImpl.rollback(ServerTransactionImpl.java:420)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller.processOneMessage(NewJMSMessagePoller.java:312)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller.run(NewJMSMessagePoller.java:126)
          
            	weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
          
            	weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
          
            	weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
          
            "[ACTIVE] ExecuteThread: '9' for queue: 'weblogic.kernel.Default (self-tuning)'" waiting for lock com.ibm.mq.jmqi.remote.internal.system.RemoteProxyQueue$GetterEventMonitor@92b50d70 TIMED_WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:196)
          
            	com.ibm.mq.jmqi.remote.internal.system.RemoteProxyQueue.proxyMQGET(RemoteProxyQueue.java:2569)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGetMessageWithRecon(RemoteFAP.java:6157)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGetMessage(RemoteFAP.java:6053)
          
            	com.ibm.mq.jmqi.internal.JmqiTools.getMessage(JmqiTools.java:1084)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGet(RemoteFAP.java:6021)
          
            	com.ibm.msg.client.wmq.internal.WMQConsumerShadow.getMsg(WMQConsumerShadow.java:1256)
          
            	com.ibm.msg.client.wmq.internal.WMQSyncConsumerShadow.receiveInternal(WMQSyncConsumerShadow.java:233)
          
            	com.ibm.msg.client.wmq.internal.WMQConsumerShadow.receive(WMQConsumerShadow.java:1009)
          
            	com.ibm.msg.client.wmq.internal.WMQMessageConsumer.receive(WMQMessageConsumer.java:459)
          
            	com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.receiveInboundMessage(JmsMessageConsumerImpl.java:765)
          
            	com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.receive(JmsMessageConsumerImpl.java:446)
          
            	com.ibm.mq.jms.MQMessageConsumer.receive(MQMessageConsumer.java:258)
          
            	weblogic.deployment.jms.WrappedMessageConsumer.receive(WrappedMessageConsumer.java:201)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller$1.run(NewJMSMessagePoller.java:272)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller$1.run(NewJMSMessagePoller.java:269)
          
            	weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
          
            	weblogic.ejb.container.internal.JMSConnectionPoller.doPrivilegedJMSAction(JMSConnectionPoller.java:2748)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller.processOneMessage(NewJMSMessagePoller.java:268)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller.run(NewJMSMessagePoller.java:126)
          
            	weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
          
            	weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
          
            	weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
          
            "[ACTIVE] ExecuteThread: '10' for queue: 'weblogic.kernel.Default (self-tuning)'" waiting for lock com.ibm.mq.jmqi.remote.internal.system.RemoteProxyQueue$GetterEventMonitor@b4c7f32d TIMED_WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:196)
          
            	com.ibm.mq.jmqi.remote.internal.system.RemoteProxyQueue.proxyMQGET(RemoteProxyQueue.java:2569)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGetMessageWithRecon(RemoteFAP.java:6157)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGetMessage(RemoteFAP.java:6053)
          
            	com.ibm.mq.jmqi.internal.JmqiTools.getMessage(JmqiTools.java:1084)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGet(RemoteFAP.java:6021)
          
            	com.ibm.msg.client.wmq.internal.WMQConsumerShadow.getMsg(WMQConsumerShadow.java:1256)
          
            	com.ibm.msg.client.wmq.internal.WMQSyncConsumerShadow.receiveInternal(WMQSyncConsumerShadow.java:233)
          
            	com.ibm.msg.client.wmq.internal.WMQConsumerShadow.receive(WMQConsumerShadow.java:1009)
          
            	com.ibm.msg.client.wmq.internal.WMQMessageConsumer.receive(WMQMessageConsumer.java:459)
          
            	com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.receiveInboundMessage(JmsMessageConsumerImpl.java:765)
          
            	com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.receive(JmsMessageConsumerImpl.java:446)
          
            	com.ibm.mq.jms.MQMessageConsumer.receive(MQMessageConsumer.java:258)
          
            	weblogic.deployment.jms.WrappedMessageConsumer.receive(WrappedMessageConsumer.java:201)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller$1.run(NewJMSMessagePoller.java:272)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller$1.run(NewJMSMessagePoller.java:269)
          
            	weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
          
            	weblogic.ejb.container.internal.JMSConnectionPoller.doPrivilegedJMSAction(JMSConnectionPoller.java:2748)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller.processOneMessage(NewJMSMessagePoller.java:268)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller.run(NewJMSMessagePoller.java:126)
          
            	weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
          
            	weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
          
            	weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
          
            "[ACTIVE] ExecuteThread: '11' for queue: 'weblogic.kernel.Default (self-tuning)'" waiting for lock weblogic.work.ExecuteThread@1de03352 WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:167)
          
            	weblogic.work.ExecuteThread.waitForRequest(ExecuteThread.java:205)
          
            	weblogic.work.ExecuteThread.run(ExecuteThread.java:226)
          
            "[ACTIVE] ExecuteThread: '12' for queue: 'weblogic.kernel.Default (self-tuning)'" waiting for lock weblogic.work.ExecuteThread@af32d5df WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:167)
          
            	weblogic.work.ExecuteThread.waitForRequest(ExecuteThread.java:205)
          
            	weblogic.work.ExecuteThread.run(ExecuteThread.java:226)
          
            "[ACTIVE] ExecuteThread: '13' for queue: 'weblogic.kernel.Default (self-tuning)'" waiting for lock com.ibm.mq.jmqi.remote.internal.system.RemoteProxyQueue$GetterEventMonitor@683035dd TIMED_WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:196)
          
            	com.ibm.mq.jmqi.remote.internal.system.RemoteProxyQueue.proxyMQGET(RemoteProxyQueue.java:2569)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGetMessageWithRecon(RemoteFAP.java:6157)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGetMessage(RemoteFAP.java:6053)
          
            	com.ibm.mq.jmqi.internal.JmqiTools.getMessage(JmqiTools.java:1084)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGet(RemoteFAP.java:6021)
          
            	com.ibm.msg.client.wmq.internal.WMQConsumerShadow.getMsg(WMQConsumerShadow.java:1256)
          
            	com.ibm.msg.client.wmq.internal.WMQSyncConsumerShadow.receiveInternal(WMQSyncConsumerShadow.java:233)
          
            	com.ibm.msg.client.wmq.internal.WMQConsumerShadow.receive(WMQConsumerShadow.java:1009)
          
            	com.ibm.msg.client.wmq.internal.WMQMessageConsumer.receive(WMQMessageConsumer.java:459)
          
            	com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.receiveInboundMessage(JmsMessageConsumerImpl.java:765)
          
            	com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.receive(JmsMessageConsumerImpl.java:446)
          
            	com.ibm.mq.jms.MQMessageConsumer.receive(MQMessageConsumer.java:258)
          
            	weblogic.deployment.jms.WrappedMessageConsumer.receive(WrappedMessageConsumer.java:201)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller$1.run(NewJMSMessagePoller.java:272)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller$1.run(NewJMSMessagePoller.java:269)
          
            	weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
          
            	weblogic.ejb.container.internal.JMSConnectionPoller.doPrivilegedJMSAction(JMSConnectionPoller.java:2748)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller.processOneMessage(NewJMSMessagePoller.java:268)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller.run(NewJMSMessagePoller.java:126)
          
            	weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
          
            	weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
          
            	weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
          
            "[ACTIVE] ExecuteThread: '14' for queue: 'weblogic.kernel.Default (self-tuning)'" waiting for lock com.ibm.mq.jmqi.remote.internal.system.RemoteProxyQueue$GetterEventMonitor@759e8fe7 TIMED_WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:196)
          
            	com.ibm.mq.jmqi.remote.internal.system.RemoteProxyQueue.proxyMQGET(RemoteProxyQueue.java:2569)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGetMessageWithRecon(RemoteFAP.java:6157)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGetMessage(RemoteFAP.java:6053)
          
            	com.ibm.mq.jmqi.internal.JmqiTools.getMessage(JmqiTools.java:1084)
          
            	com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGet(RemoteFAP.java:6021)
          
            	com.ibm.msg.client.wmq.internal.WMQConsumerShadow.getMsg(WMQConsumerShadow.java:1256)
          
            	com.ibm.msg.client.wmq.internal.WMQSyncConsumerShadow.receiveInternal(WMQSyncConsumerShadow.java:233)
          
            	com.ibm.msg.client.wmq.internal.WMQConsumerShadow.receive(WMQConsumerShadow.java:1009)
          
            	com.ibm.msg.client.wmq.internal.WMQMessageConsumer.receive(WMQMessageConsumer.java:459)
          
            	com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.receiveInboundMessage(JmsMessageConsumerImpl.java:765)
          
            	com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.receive(JmsMessageConsumerImpl.java:446)
          
            	com.ibm.mq.jms.MQMessageConsumer.receive(MQMessageConsumer.java:258)
          
            	weblogic.deployment.jms.WrappedMessageConsumer.receive(WrappedMessageConsumer.java:201)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller$1.run(NewJMSMessagePoller.java:272)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller$1.run(NewJMSMessagePoller.java:269)
          
            	weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
          
            	weblogic.ejb.container.internal.JMSConnectionPoller.doPrivilegedJMSAction(JMSConnectionPoller.java:2748)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller.processOneMessage(NewJMSMessagePoller.java:268)
          
            	weblogic.ejb.container.internal.NewJMSMessagePoller.run(NewJMSMessagePoller.java:126)
          
            	weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
          
            	weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
          
            	weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
          
            "[ACTIVE] ExecuteThread: '15' for queue: 'weblogic.kernel.Default (self-tuning)'" waiting for lock weblogic.work.ExecuteThread@669a111c WAITING native
          
            	java.lang.Object.wait(Native Method)
          
            	java.lang.Object.wait(Object.java:167)
          
            	weblogic.work.ExecuteThread.waitForRequest(ExecuteThread.java:205)
          
            	weblogic.work.ExecuteThread.run(ExecuteThread.java:226)
          
            "[STUCK] ExecuteThread: '16' for queue: 'weblogic.kernel.Default (self-tuning)'" waiting for lock jersey.repackaged.com.google.common.util.concurrent.AbstractFuture$Sync@512a6acb WAITING native
          
            	sun.misc.Unsafe.park(Native Method)
          
            	java.util.concurrent.locks.LockSupport.park(LockSupport.java:197)
          
            	java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:845)
          
            	java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1005)
          
            	java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1314)
          
            	jersey.repackaged.com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:285)
          
            	jersey.repackaged.com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116)
          
            	org.glassfish.jersey.servlet.internal.ResponseWriter.getResponseContext(ResponseWriter.java:277)
          
            	org.glassfish.jersey.servlet.internal.ResponseWriter.commit(ResponseWriter.java:191)
          
            	org.glassfish.jersey.server.ContainerResponse.close(ContainerResponse.java:413)
          
            	org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:750)
          
            	org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:424)
          
            	org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:414)
          
            	org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:311)
          
            	org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
          
            	org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
          
            	org.glassfish.jersey.internal.Errors.process(Errors.java:315)
          
            	org.glassfish.jersey.internal.Errors.process(Errors.java:297)
          
            	org.glassfish.jersey.internal.Errors.process(Errors.java:267)
          
            	org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
          
            	org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:291)
          
            	org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1140)
          
            	org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:403)
          
            	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:386)
          
            	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:334)
          
            	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)
          
            	weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:242)
          
            	weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:216)
          
            	weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:132)
          
            	weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:338)
          
            	weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:221)
          
            	weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3284)
          
            	weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3254)
          
            	weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
          
            	weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
          
            	weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
          
            	weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2163)
          
            	weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2089)
          
            	weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2074)
          
            	weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1513)
          
            	weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254)
          
            	weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
          
            	weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
          
            "[STUCK] ExecuteThread: '17' for queue: 'weblogic.kernel.Default (self-tuning)'" waiting for lock jersey.repackaged.com.google.common.util.concurrent.AbstractFuture$Sync@2b31f129 WAITING native
          
            	sun.misc.Unsafe.park(Native Method)
          
            	java.util.concurrent.locks.LockSupport.park(LockSupport.java:197)
          
            	java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:845)
          
            	java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1005)
          
            	java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1314)
          
            	jersey.repackaged.com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:285)
          
            	jersey.repackaged.com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116)
          
            	org.glassfish.jersey.servlet.internal.ResponseWriter.getResponseContext(ResponseWriter.java:277)
          
            	org.glassfish.jersey.servlet.internal.ResponseWriter.commit(ResponseWriter.java:191)
          
            	org.glassfish.jersey.server.ContainerResponse.close(ContainerResponse.java:413)
          
            	org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:750)
          
            	org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:424)
          
            	org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:414)
          
            	org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:311)
          
            	org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
          
            	org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
          
            	org.glassfish.jersey.internal.Errors.process(Errors.java:315)
          
            	org.glassfish.jersey.internal.Errors.process(Errors.java:297)
          
            	org.glassfish.jersey.internal.Errors.process(Errors.java:267)
          
            	org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
          
            	org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:291)
          
            	org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1140)
          
            	org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:403)
          
            	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:386)
          
            	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:334)
          
            	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)
          
            	weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:242)
          
            	weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:216)
          
            	weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:132)
          
            	weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:338)
          
            	weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:221)
          
            	weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3284)
          
            	weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3254)
          
            	weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
          
            	weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
          
            	weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
          
            	weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2163)
          
            	weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2089)
          
            	weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2074)
          
            	weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1513)
          
            	weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254)
          
            	weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
          
            	weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
  

Please provide a fix and work around for timebeling atleast.






[JERSEY-3210] Concurrency on EntityGraph initialization creates ObjectGraph without fields. Created: 22/Dec/16  Updated: 22/Dec/16

Status: Open
Project: jersey
Component/s: extensions, media
Affects Version/s: 2.22
Fix Version/s: None

Type: Bug Priority: Major
Reporter: adolfojunior Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: entity-filtering
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Cloners
clones JERSEY-3181 Usage of JacksonFilteringFeature prod... Open

 Description   

The cached FilterProvider of an entity type keeps an internal state to control nested rendering. When a thread is doing a stack.clear() and at the same time another thread is doing a stack.peek() it throws an exception, causing a failure during rendering of fields at BeanSerializerBase.






[JERSEY-3181] Usage of JacksonFilteringFeature produces empty or incomplete JSON as response. Created: 02/Nov/16  Updated: 22/Dec/16

Status: Open
Project: jersey
Component/s: extensions, media
Affects Version/s: 2.22
Fix Version/s: None

Type: Bug Priority: Major
Reporter: adolfojunior Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: entity-filtering
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Cloners
is cloned by JERSEY-3210 Concurrency on EntityGraph initializa... Open

 Description   

The cached FilterProvider of an entity type keeps an internal state to control nested rendering. When a thread is doing a stack.clear() and at the same time another thread is doing a stack.peek() it throws an exception, causing a failure during rendering of fields at BeanSerializerBase.



 Comments   
Comment by adolfojunior [ 21/Dec/16 ]

To emulate this problem, I did concurrent tests with JMeter. How should I work on a JUnit test for it?
I am providing a new instance of FilteringFilterProvider that handle a stack.

A fork with the fix: https://github.com/adolfojunior/jersey/commit/e971245384fccadbfbff6c5eaa31eeab283725a8

Any idea for a Unit test to it?





[JERSEY-3179] Jersey Client - Add Support for Project Reactor and Reactive Streams Created: 28/Oct/16  Updated: 20/Dec/16

Status: Open
Project: jersey
Component/s: extensions
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major
Reporter: adamzr Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

There already is a Jersey Client extension for RxJava. This ticket is to create another extension using Project Reactor instead of RxJava. Project Reactor implements the new Reactive Streams standard and has some performance improvements over RxJava.



 Comments   
Comment by adamzr [ 20/Dec/16 ]

Pull Request: https://github.com/jersey/jersey/pull/252





[JERSEY-3209] jersey-spring doesn't register sub resources with the SpringComponentProvider Created: 15/Dec/16  Updated: 15/Dec/16

Status: Open
Project: jersey
Component/s: extensions
Affects Version/s: 2.24.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: rodney757 Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: spring
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

jersey-spring will only register spring bean resources with the SpringComponentProvider if they are registered at application initialization.

Since jersey only registers root resources and @Provider classes at application init, subResource spring beans are not registered with SpringComponentProvider and are managed by hk2 instead of spring.

When returning a sub resource, jersey should check if the subresource is a spring bean and return the spring managed bean, instead of the hk2 managed bean.

current workarounds:
1. explicitly register each subresource with jersey upon startup (ex with ResourceConfig.register)
2. or annotate the subresource with @Provider






[JERSEY-3207] SSE: IllegalFormatConversionException when creating EventSource Created: 12/Dec/16  Updated: 15/Dec/16

Status: Open
Project: jersey
Component/s: media
Affects Version/s: 2.22.2, 2.25
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Archangel1C Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: client
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: SSE

 Description   

When creating an EventSource from a WebTarget with a URI containing a percent sign (f.i. a query parameter with a colon, which is URL encoded into "%3A"), an IllegalFormatConversionException is thrown, because the name of the Thread is built with String.format, but including the URI in the format argument.

Example Code
WebTarget target = client.target(someUriString).path(somePathComponent).queryParam("this-causes-percents-chars-in-the-URI", "a:b");

// this eventually calls String.format, which tries to replace the percent character and fails
EventSource eventSource = EventSource.target(target).build();
Stacktrace
 java.util.IllegalFormatConversionException: a != java.lang.Integer
      at java.util.Formatter$FormatSpecifier.failConversion(Formatter.java:4302)
      at java.util.Formatter$FormatSpecifier.printFloat(Formatter.java:2806)
      at java.util.Formatter$FormatSpecifier.print(Formatter.java:2753)
      at java.util.Formatter.format(Formatter.java:2520)
      at java.util.Formatter.format(Formatter.java:2455)
      at java.lang.String.format(String.java:2940)
      at jersey.repackaged.com.google.common.util.concurrent.ThreadFactoryBuilder.setNameFormat(ThreadFactoryBuilder.java:71)
      at org.glassfish.jersey.media.sse.EventSource.<init>(EventSource.java:387)
      at org.glassfish.jersey.media.sse.EventSource.<init>(EventSource.java:134)
      at org.glassfish.jersey.media.sse.EventSource$Builder.build(EventSource.java:278)

The problem is the following line

new ThreadFactoryBuilder().setNameFormat(esName + "-%d")

where esName contains the URI with the % sign.



 Comments   
Comment by Archangel1C [ 14/Dec/16 ]

Okay, I just realized, in my case, I can preset the the thread name via the method "named(String)".

But when using the constructor of EventSource, this is not possible before the thread name is tried to be set.





[JERSEY-3208] jersey-container-servlet-core web services are not running on LJS server. Created: 15/Dec/16  Updated: 15/Dec/16

Status: Open
Project: jersey
Component/s: containers
Affects Version/s: 2.25
Fix Version/s: None

Type: Bug Priority: Major
Reporter: manojpandey89 Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

LJS server.



 Description   

Hi,

Applications with org.glassfish.jersey.containers webservices are not running in LJS server. Its throwing below error on trying to access web services:

org.glassfish.jersey.server.internal.scanning.ResourceFinderException: The URI scheme bundleentry of the URI bundleentry://6914.fwk686299093/WEB-INF/classes/io/swagger/generator/resource/ExceptionWriter.class is not supported. Package scanning deployment is not supported for such URIs.
Try using a different deployment mechanism such as explicitly declaring root resource and provider classes using an extension of javax.ws.rs.core.Application
org.glassfish.jersey.server.internal.scanning.PackageNamesScanner.addResourceFinder(PackageNamesScanner.java:282)
org.glassfish.jersey.server.internal.scanning.PackageNamesScanner.init(PackageNamesScanner.java:196)
org.glassfish.jersey.server.internal.scanning.PackageNamesScanner.<init>(PackageNamesScanner.java:153)
org.glassfish.jersey.server.internal.scanning.PackageNamesScanner.<init>(PackageNamesScanner.java:110)
org.glassfish.jersey.server.ResourceConfig.scanClasses(ResourceConfig.java:876)
org.glassfish.jersey.server.ResourceConfig._getClasses(ResourceConfig.java:849)
org.glassfish.jersey.server.ResourceConfig.getClasses(ResourceConfig.java:755)
org.glassfish.jersey.server.ResourceConfig$RuntimeConfig.<init>(ResourceConfig.java:1180)
org.glassfish.jersey.server.ResourceConfig$RuntimeConfig.<init>(ResourceConfig.java:1153)
org.glassfish.jersey.server.ResourceConfig.createRuntimeConfig(ResourceConfig.java:1149)
org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:318)
org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:285)
org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:310)
org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:169)
org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:359)
javax.servlet.GenericServlet.init(GenericServlet.java:244)
org.eclipse.virgo.web.enterprise.security.valve.OpenEjbSecurityInitializationValve.invoke(OpenEjbSecurityInitializationValve.java:44)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
com.sap.core.jpaas.security.auth.service.lib.AbstractAuthenticator.invoke(AbstractAuthenticator.java:168)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
com.sap.core.tenant.valve.TenantValidationValve.invokeNextValve(TenantValidationValve.java:168)
com.sap.core.tenant.valve.TenantValidationValve.invoke(TenantValidationValve.java:94)
com.sap.js.statistics.tomcat.valve.RequestTracingValve.invoke(RequestTracingValve.java:38)
com.sap.core.js.monitoring.tomcat.valve.RequestTracingValve.invoke(RequestTracingValve.java:27)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:745)






[JERSEY-3206] requestContext.setRequestUri(uri) doesn't use the existing baseUri Created: 10/Dec/16  Updated: 10/Dec/16

Status: Open
Project: jersey
Component/s: core
Affects Version/s: 2.24.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: rodney757 Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I am using a @PreMatching filter to forward requests.

If I call requestContext.setRequestUri(new Uri("/relative/resource/path")), jersey will not find the matching resource.

The same thing happens if I call requestContext.setRequestUri(new Uri("http://localhost:8080/rest/"), new Uri("/relative/resource/path"))

I can only get jersey to match the resource if I specify the entire url ex.
requestContext.setRequestUri(new Uri("http://localhost:8080/rest/relative/resource/path"))






[JERSEY-3205] WorkerComparator not following spec when multiple interface inheritance Created: 08/Dec/16  Updated: 08/Dec/16

Status: Open
Project: jersey
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: Fran_Ois Assignee: Unassigned
Resolution: Unresolved Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

org.glassfish.jersey.message.internal.MessageBodyFactory.WorkerComparator#getTypeDistance has a bug when the wanted type is two or more deep interface inheritance.

Exemple:

I have 2 interfaces, D and C. C extends D and a class A implementing C. If we model horizontally interface inheritance and vertically class inheritance we would get something like this.

A - C - D

Object

If I have two MessageBodyWriter one for Object and one for D, when selecting which is closest, getTypeDistance will return 2 for Object and 3 for D which is not valid. It makes no sense to have an interface or class be further from another than Object. Object should always be the furthest class from any given class.



 Comments   
Comment by Fran_Ois [ 08/Dec/16 ]

Pull request:
https://github.com/jersey/jersey/pull/249





[JERSEY-3204] AsyncResponse.resume(Throwable) loses stack traces Created: 08/Dec/16  Updated: 08/Dec/16

Status: Open
Project: jersey
Component/s: None
Affects Version/s: 2.23.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: bjkail Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

If an unmappable exception is passed to AsyncResponse.resume(Throwable), the stack trace is lost.

I believe this incorrect behavior was introduced by JERSEY-1630, which adjusted ServerRuntime.Responder.process to log exceptions at a FINE level rather than SEVERE. I think that change was good for the synchronous case where the exception will ultimately be rethrown to the caller for logging by the application or servlet container. However, for the asynchronous case, ServerRuntime.AsyncResponder.resume swallows the exception rethrown from process (correctly), which means the stack trace is lost. I believe this flow should be adjusted so that unmappable exceptions passed to AsyncResponse.resume(Throwable) are again logged with a SEVERE level.






[JERSEY-3203] org.glassfish.jersey.jdkhttp.JdkHttpServerFactory is leaking sun.net.httpserver.HttpConnection if POST to a non-exist endponit Created: 08/Dec/16  Updated: 08/Dec/16

Status: Open
Project: jersey
Component/s: containers
Affects Version/s: 2.24.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: ralf0131 Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

mac



 Description   

Step to reproduce:

1. create a http server using JdkHttpServerFactory.createHttpServer
2. curl -v --data "aaa=bbb" http://localhost:8006/path/to/non/exist/endpoint for several times.
3. if using apache bench to send a bunch of requests, sooner the target jvm will start to do fullgc.

In our production server, the heap dump tell us that over 300k HttpConnection(sun.net.httpserver.ServerImpl#reqConnections) objects can never be garbage collected.

Further investigation shows that in org.glassfish.jersey.server.ServerRuntime#process, a NotFoundException is thrown if the endpoint is not found, therefore in nowhere has the related HttpConnection object been released.



 Comments   
Comment by ralf0131 [ 08/Dec/16 ]

Minimal code to reproduce this issue:

@Test
    public void testHttpServerLeak() {
        URI baseUri = UriBuilder.fromUri("http://localhost/").port(8888).build();
        ResourceConfig config = new ResourceConfig();
        JdkHttpServerFactory.createHttpServer(baseUri, config);
        try {
            Thread.sleep(10000000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
Comment by Pavel Bucek [ 08/Dec/16 ]

Hi ralf0131,

thanks for your report!

I'm not saying this is not a bug (clearly is), but .. please don't use JdkHttpServer in production. Try Grizzly Http - its far more performant and actually battle tested.

Regards,
Pavel

Comment by ralf0131 [ 08/Dec/16 ]

Hi Pavel,

We've just made the decision to switch to Grizzly http.

Thanks!





[JERSEY-3202] Jersey Threads blocking under heavy load Created: 07/Dec/16  Updated: 07/Dec/16

Status: Open
Project: jersey
Component/s: None
Affects Version/s: 2.19
Fix Version/s: None

Type: Bug Priority: Major
Reporter: ahm_mushtaq Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: jersey, stuck, thread
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Production



 Description   

Been constantly getting the below error in weblogic when we put JERSEY under heavy stress.

####<Dec 7, 2016 3:09:32 PM GMT> <Info> <Health> <prlprws01> <PayRoll_Srv1> <weblogic.GCMonitor> <<anonymous>> <> <> <1481123372881> <BEA-310002> <48% of the total memory in the server is free.> 
####<Dec 7, 2016 3:12:21 PM GMT> <Error> <WebLogicServer> <prlprws01> <PayRoll_Srv1> <[ACTIVE] ExecuteThread: '22' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1481123541709> <BEA-000337> <[STUCK] ExecuteThread: '12' for queue: 'weblogic.kernel.Default (self-tuning)' has been busy for "645" seconds working on the request "Workmanager: default, Version: 5, Scheduled=true, Started=true, Started time: 645131 ms
", which is more than the configured time (StuckThreadMaxTime) of "600" seconds. Stack trace:
	sun.misc.Unsafe.park(Native Method)
	java.util.concurrent.locks.LockSupport.park(LockSupport.java:198)
	java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:846)
	java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1006)
	java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1315)
	jersey.repackaged.com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:285)
	jersey.repackaged.com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116)
	org.glassfish.jersey.servlet.internal.ResponseWriter.getResponseContext(ResponseWriter.java:277)
	org.glassfish.jersey.servlet.internal.ResponseWriter.commit(ResponseWriter.java:191)
	org.glassfish.jersey.server.ContainerResponse.close(ContainerResponse.java:413)
	org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:750)
	org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:424)
	org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:414)
	org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:311)
	org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
	org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
	org.glassfish.jersey.internal.Errors.process(Errors.java:315)
	org.glassfish.jersey.internal.Errors.process(Errors.java:297)
	org.glassfish.jersey.internal.Errors.process(Errors.java:267)
	org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
	org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:291)
	org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1140)
	org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:403)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:386)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:334)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)
	weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:242)
	weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:216)
	weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:132)
	weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:338)
	weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:221)
	weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3284)
	weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3254)
	weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
	weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
	weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
	weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2163)
	weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2089)
	weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2074)
	weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1513)
	weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254)
	weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
	weblogic.work.ExecuteThread.run(ExecuteThread.java:221)


 Comments   
Comment by Pavel Bucek [ 07/Dec/16 ]

This is impossible to diagnose without a proper context or a reproducer.

Can you try to re-create this with minimal Jersey/JAX-RS application and share it somewhere?

Comment by ahm_mushtaq [ 07/Dec/16 ]

Sure will try doing it..any hints on what could possibly be causing this error? Its quite intermittent





[JERSEY-3201] Allow use of Priority for MessageBodyReader/Writer Created: 07/Dec/16  Updated: 07/Dec/16

Status: Open
Project: jersey
Component/s: core
Affects Version/s: 3.0
Fix Version/s: None

Type: New Feature Priority: Minor
Reporter: dkleszyk Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Currently, the message body worker selection algorithm either sorts by declaration distance, media type distance, and origin (custom/provided), or by origin (custom/provided), media type distance, and declaration distance (if using the legacy configuration flag). The current sorting algorithms make it impossible to prioritize application-provided message body workers ahead of jersey-provided message body workers that have the same declaration distance and media type. This makes it difficult to inherit from the built-in providers to modify their behavior. It would be nice if there were an option to use Priority annotations to allow for more-granular ordering of message body workers.

One possible way of achieving this would be to modify MessageBodyFactory to use RankedProvider when querying for available message body workers; I am currently working on a patch that would use this method.

Related issues seem to be JERSEY-2489 and JERSEY-2797; however, those were closed as "works as designed". This was opened as a new feature request since it would add functionality that is not currently in Jersey.






[JERSEY-3200] HTTPUrlConnector: 40x Errors during large puts result in IOException Created: 06/Dec/16  Updated: 06/Dec/16

Status: Open
Project: jersey
Component/s: core
Affects Version/s: 2.24.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: ppatel Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Mac, Linux



 Description   

I don't have an example yet, but it's fairly easy to describe.

  • use HTTPUrlConnector
  • enable streaming (fixed content length)
  • do a put/post operation where the body is large (>20mb usually works)
  • have the server return a 40x response after reading the headers and close the connection

This connector delegates to HttpUrlConnection, which during a streaming write, will attempt to validate there was no error (see 'checkError' on line 3477 line here):
http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/sun/net/www/protocol/http/HttpURLConnection.java#3470

In this case, the connector fails to read the response code because it received an IOException during entity write.

I haven't tried this, but I think if you surround the entire block in the connector that writes the entity if its not null (lines 359-397 in version 2.24.1) in a try/catch, and then attempt to read the response code it might work.






[JERSEY-3199] RequestScope is not released if Exception occurs while writing response Created: 06/Dec/16  Updated: 06/Dec/16

Status: Open
Project: jersey
Component/s: core
Affects Version/s: 2.24.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: sofax Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Tested on Linux, but source code analysis reveals that this issue is os-unrelated.



 Description   

The RequestScope is not released if an exception occurs while writing the response.

What happens is that in the catch block of ContainerResponse.writerResponse() the method processingContext.asyncContext() is called, which results in calling AsyncResponderHolder.get().

The actual bug seems to be in AsyncResponderHolder.get(), which is, in fact, a setter:

        public AsyncContext get() {
            final AsyncResponder ar = new AsyncResponder(responder, scopeInstance, externalScope, externalContext);
            asyncResponder = ar;
            return ar;
        }

This prevents the scopeInstance to be released:

   private static class AsyncResponderHolder implements Value<AsyncContext> {
      ...

        public void release() {
            if (asyncResponder == null) {
                scopeInstance.release();
            }
        }
    }


 Comments   
Comment by sofax [ 06/Dec/16 ]

RequestScope.runInScope() correctly calls asyncResponderHolder.release(), it just has no effect because of the side-effect in AsyncResponderHolder.get():

        requestScope.runInScope(requestScopeInstance, new Runnable() {
            @Override
            public void run() {
                try {
                   ...
                } catch (final Throwable throwable) {
                    responder.process(throwable);
                } finally {
                    asyncResponderHolder.release();     // <----------- HERE
                    // clear base URI from the thread
                    OutboundJaxrsResponse.Builder.clearBaseUri();
                }
            }
        });
Comment by sofax [ 06/Dec/16 ]

The implementation of AsyncResponderHolder.get() also does not follow the documentation, which states that the method is to return null, if the context has not been initialized yet:

    /**
     * Get the asynchronous context associated with this request processing context.
     *
     * May return {@code null} if no asynchronous context has been initialized in this request processing context yet.
     *
     * @return asynchronous context associated with this request processing context, or {@code null} if the
     * asynchronous context has not been initialized yet
     * (see {@link #initAsyncContext(org.glassfish.jersey.internal.util.collection.Value)}).
     */
    public AsyncContext asyncContext() {
        return asyncContextValueRef.get().get();
    }
Comment by sofax [ 06/Dec/16 ]

This is the code in ContainerResponse.writerResponse() that triggers the error:

                try {
                    response.setEntityStream(request.getWorkers().writeTo(
                            entity,
                            entity.getClass(),
                            response.getEntityType(),
                            response.getEntityAnnotations(),
                            response.getMediaType(),
                            response.getHeaders(),
                            request.getPropertiesDelegate(),
                            response.getEntityStream(),
                            request.getWriterInterceptors()));
                } catch (final MappableException mpe) {
                    if (mpe.getCause() instanceof IOException) {
// Calls getter with side-effect:
                        connectionCallbackRunner.onDisconnect(processingContext.asyncContext());  
                    }
                    throw mpe;
                }




[JERSEY-3197] rendering of underscore in docs Created: 02/Dec/16  Updated: 05/Dec/16

Status: Open
Project: jersey
Component/s: docs
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: arrais Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Firefox 38.0.5
Chrome 48.0.2564.116



 Description   

This line of docbook gets rendered weirdly when zoomed in. The underscore disappears. I'll try to append a screenshot of Firefox 38.0.5, but I was able to reproduce the bug in Chrome 48 too.

This may be a browser issue, but maybe jersey will want to fix that.

File: jaxrs-resources.xml
Line: 138
Link: https://github.com/jersey/jersey/blob/1d48272/docs/src/main/docbook/jaxrs-resources.xml#L138

Zoom level used: 120% (at 100% the underscore gets rendered correctly)



 Comments   
Comment by arrais [ 02/Dec/16 ]

Here's the image: http://imgur.com/a/3DTEG

Comment by Pavel Bucek [ 02/Dec/16 ]

Thanks for your report!

I can't see anything wrong in Chrome 54.0.2840.98 (64-bit) @ Mac Os X .. couldn't this be some OS specific rendering issue?

(I really don't know how we could fix that in Jersey docs..)

Comment by arrais [ 05/Dec/16 ]

> couldn't this be some OS specific rendering issue?

Yeah, it could certainly be. I am using Linux on both cases. Firefox with Ubuntu 12 and Chrome with Mint 14.

Maybe Chrome on OS X renders monospaced text with a different typeface...

> (I really don't know how we could fix that in Jersey docs..)

Maybe changing typefaces fixes this. Don't know if it is worth it, though.





[JERSEY-3198] FormDataBodyPart type handling inconsistency Created: 05/Dec/16  Updated: 05/Dec/16

Status: Open
Project: jersey
Component/s: None
Affects Version/s: 1.19.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: ukmtk Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I think that the type handling in com.sun.jersey.multipart.FormDataBodyPart is inconsistent. We noticed this issue with jersey-multipart-1.16.0.jar but it still exists in 1.19.

We noticed the issue with "Content-Type: text/plain; charset=US-ASCII" as compared to "Content-Type: text/plain".

The issue is related to the comparisons against MediaType.TEXT_PLAIN_TYPE. In 2 places it is a direct comparison: setValue() and isSimple(). In the other location it is a clever comparison: getValue().

I think it would be better if isSimple() was coded as:

public boolean isSimple()

{ return MediaTypes.typeEquals(MediaType.TEXT_PLAIN_TYPE, getMediaType()); }

and that setValue() and getValue() used the isSimple() method.






[JERSEY-3196] problems with the LoggingFeature in the jersey client and very long lines Created: 01/Dec/16  Updated: 01/Dec/16

Status: Open
Project: jersey
Component/s: core
Affects Version/s: 2.23.2, 2.24.1
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: _ZeD_ Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

tomcat 8, java 8, jersey libraries retrieved from maven, on windows (devel machines) and on aws



 Description   

The jersey client has the ability to support a custom LoggingFeature. We experienced problems (with the loss of the last part of the logs rows) in scenarios with very long log rows (from 16K character up, but I think it depends on the machine)



 Comments   
Comment by _ZeD_ [ 01/Dec/16 ]
LogTooLong.java
package logging;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.ws.rs.ApplicationPath;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Invocation;
import javax.ws.rs.core.UriBuilder;

import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.jetty.JettyHttpContainerFactory;
import org.glassfish.jersey.logging.LoggingFeature;
import org.glassfish.jersey.logging.LoggingFeature.Verbosity;
import org.glassfish.jersey.server.ResourceConfig;
import org.junit.Assert;
import org.junit.Test;

public class LogTooLong {

	static final int N = 48_000;

	public static class LogValidator extends Logger {
		protected LogValidator() {
			super(null, null);
		}

		@Override
		public void log(final Level level, final String msg) {
			// request
			if (msg.length() < 500)
				return;

			if (msg.substring(msg.length() - 5).equals("fine\n"))
				return;

			throw new RuntimeException("length: " + msg.length() + " (should be something around " + N + ") ends with: "
					+ msg.substring(msg.length() - 5, msg.length() - 1) + " (should be fine)");
		}
	}

	@Path("foo")
	@Produces("text/plain")
	public static class Foo {
		@GET
		@Path("bar")
		public String bar() {
			final StringBuilder sb = new StringBuilder();
			for (int i = 0; i < N - 5; i += 1)
				sb.append(".");
			sb.append("-fine");
			return sb.toString();
		}
	}

	@ApplicationPath("")
	public static class FooBar extends ResourceConfig {
		public FooBar() {
			register(new Foo());
		}
	}

	@Test
	public void test() throws Throwable {
		// server
		JettyHttpContainerFactory.createServer(UriBuilder.fromUri("http://localhost/").port(9998).build(), new FooBar())
				.start();

		// client
		final ClientConfig cc = new ClientConfig()
				.register(new LoggingFeature(new LogValidator(), Level.OFF, Verbosity.PAYLOAD_ANY, 160_000));

		final List<RuntimeException> es = new ArrayList<>();

		for (int i = 0; i < 20; i += 1) {
			final Invocation get = ClientBuilder.newClient(cc).target("http://localhost:9998/foo/bar").request()
					.buildGet();

			try {
				final String s = get.invoke(String.class);
				Assert.assertEquals(s.length(), N);
			} catch (final RuntimeException e) {
				es.add(e);
			}
		}

		if (es.isEmpty())
			return;

		final StringBuilder sb = new StringBuilder();
		for (final RuntimeException e : es)
			sb.append("\n" + e.getMessage());
		Assert.fail(sb.toString());
	}

}
Comment by _ZeD_ [ 01/Dec/16 ]

in the above snippet I wrote a dummy test to verify the problem: I set up a server instance, with just an endpoint producing a very long string as output. I also create a client, configured to use a custom Logger instance.
the LogValidator instance verifies that the message containing the response contains the expected response (the very long line ending with the "fine" word)

most of the time I had errors (on my machine) with this final message

java.lang.AssertionError:
length: 32957 (should be something around 48000) ends with: .... (should be fine)
length: 32957 (should be something around 48000) ends with: .... (should be fine)
length: 32957 (should be something around 48000) ends with: .... (should be fine)
length: 32957 (should be something around 48000) ends with: .... (should be fine)
length: 32957 (should be something around 48000) ends with: .... (should be fine)
length: 32957 (should be something around 48000) ends with: .... (should be fine)
length: 32957 (should be something around 48000) ends with: .... (should be fine)
length: 32957 (should be something around 48000) ends with: .... (should be fine)
length: 32957 (should be something around 48000) ends with: .... (should be fine)
length: 32957 (should be something around 48000) ends with: .... (should be fine)
length: 32957 (should be something around 48000) ends with: .... (should be fine)
length: 32957 (should be something around 48000) ends with: .... (should be fine)
length: 32957 (should be something around 48000) ends with: .... (should be fine)
length: 32957 (should be something around 48000) ends with: .... (should be fine)
length: 32957 (should be something around 48000) ends with: .... (should be fine)
length: 32957 (should be something around 48000) ends with: .... (should be fine)
length: 32957 (should be something around 48000) ends with: .... (should be fine)
at org.junit.Assert.fail(Assert.java:88)
at logging.LogTooLong.test(LogTooLong.java:98)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)





[JERSEY-2818] RolesAllowedDynamicFeature can return 401 or 403 errors. Created: 10/Mar/15  Updated: 01/Dec/16

Status: Reopened
Project: jersey
Component/s: core, security
Affects Version/s: 2.16
Fix Version/s: 2.18

Type: Improvement Priority: Major
Reporter: krotscheck Assignee: Unassigned
Resolution: Unresolved Votes: 4
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Currently, the RolesAllowedRequestFilter will always return HTTP 403 Forbidden. This is accurate in all cases where the security context is aware of the principal (securityContext.getUserPrincipal() is not null), however it is not strictly accurate in the case where a user has not been authenticated. In that case, returning HTTP 401 Unauthorized is more accurate, as the user has not provided the correct credentials.

The following code should suffice, if inserted before the role check loop.

if(requestContext.getSecurityContext().getUserPrincipal() == null && rolesAllowed.length > 0)  {
     throw new NotAuthorizedException();
}


 Comments   
Comment by Adam Lindenthal [ 11/Mar/15 ]

Hi krotscheck,

thanks for reporting the improvement suggestion.
I will put it to backlog, so that someone can look at it in one of the future sprints.

Regards,
Adam

Comment by brunosimioni [ 18/Mar/15 ]

Guys,

Same problem over here. Since my API with RolesAllowedDynamicFeature is returning 403 instead of 401, Actually, I'm stucked in the same step and I'm currently integrating with others systems with this API. Returning then with forbidden 403 to a non-authenticated user just makes no sense.

Would you guys priorize this issue, or do you have a release date, or even can I make the fix and make a pull request under github repositories?

Best!

Comment by brunosimioni [ 19/Mar/15 ]

Guys,

I've forked the Jersey's github repository, patched up with krotscheck's fix and made a pull request to merge with master branch. Hope you guys accept it as soon as possible, since there is a scheduled build on April.

Please check this out: https://github.com/jersey/jersey/pull/150

Comment by Michal Gajdos [ 19/Mar/15 ]

I'll deliver fix for this internally - it'd be faster.

Comment by brunosimioni [ 19/Mar/15 ]

Thanks Michal!

Would it be available at April 8th?

I'll sign out the OCA too, for future collaborations.

Thank you very much.

Comment by Michal Gajdos [ 19/Mar/15 ]

It'll be in 2.18 (April 8th is approximate but 2.18 should be out that week).

Comment by Michal Gajdos [ 19/Mar/15 ]

Merged into master branch.

Comment by brunosimioni [ 19/Mar/15 ]

Michal, I've just saw you merge. Thank you for that!

Just a question: shouldn't NotAuthorizedException preceeds the ForbiddenException? Authorization should be evaluted before Permission rights, do you agree? Because to check wether the user can or cannot access the resource, it must be known.

In my patch (thanks to krotscheck) I've checked Authorization before DenyAll condition, but in your implementation, you did the inverse.

Best

Comment by andrewzimmer [ 15/Apr/15 ]

Glad to hear that this is going to be taken care of!

Comment by bdemers [ 21/Nov/16 ]

This issue should be reopened, this the fix for this issue was removed in JERSEY-2908.

Comment by eioki [ 30/Nov/16 ]

Can we reopen this issue, as it's no longer fixed? Current Jersey in unusable for me.

Comment by Pavel Bucek [ 30/Nov/16 ]

Is the description still valid or do you want to suggest any changes or maybe ideally rephrase the description (as a comment) to reflect latest changes?

Comment by eioki [ 01/Dec/16 ]

I'll try.

Currently, the RolesAllowedRequestFilter returns HTTP 403 both when a user is authenticated but doesn't have the required role, and when is not authenticated at all. Thereby, clients are unable to distinguish whether they should, for example, refresh expired token or display the "access denied" message. When the user is not authenticated, returning HTTP 401, even with hard coded Basic auth, would be more accurate and way more useful even if not 100% correct (see JERSEY-2908). I'd like to propose bringing back the fix already provided in this issue, and then develop a final solution.





[JERSEY-3195] Overridden priority is not honoured Created: 24/Nov/16  Updated: 24/Nov/16

Status: Open
Project: jersey
Component/s: core
Affects Version/s: 2.24.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: bricedutheil Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Due to filter ordering issues (especially with a CORSFilter that aborts and the jersey-spring3 RequestContextFilter), I want to order the filters with determinist priorities.

The javadoc of ResourceConfig.register(Class<?> componentClass, int bindingPriority) says :

Description copied from interface: javax.ws.rs.core.Configurable Register a class of a custom JAX-RS component (such as an extension provider or a feature meta-provider) to be instantiated and used in the scope of this configurable context.
This registration method provides the same functionality as register(Class) except that any priority specified on the registered JAX-RS component class via javax.annotation.Priority annotation is overridden with the supplied priority value.
Note that in case the priority is not applicable to a particular provider contract implemented by the class of the registered component, the supplied priority value will be ignored for that contract.

With that information I crafted the following configuration :

EndointsConfig
@ApplicationPath("/")
public class EndpointsConfig extends ResourceConfig {

    public EndpointsConfig(@Context ServletContext context) {
        WebApplicationContext webAppContext = WebApplicationContextUtils.getWebApplicationContext(context);

        this.property(WADL_FEATURE_DISABLE, true)
            .register(MultiPartFeature.class)
            .register(webAppContext.getBean(CORSFilter.class), 500)
            .register(RequestContextFilter.class, -500)
            .register(JacksonJsonProvider.class)
            .register(StreamableObjectWriter.class)
            .register(new LoggingFeature(Logger.getLogger("http"), PAYLOAD_TEXT))
            // ...
        ;
    }
}
CORSFilter
@Provider
@PreMatching
@Priority(0)
public class CORSFilter implements ContainerRequestFilter, ContainerResponseFilter {
    // ...
}
org.glassfish.jersey.server.spring.scope.RequestContextFilter
@Provider
@PreMatching
public final class RequestContextFilter implements ContainerRequestFilter, ContainerResponseFilter {
    // ...
}

However the CORSFilter is always executed before the Spring related filter.

While debugging I found out that providers is sorted according to an internal rank

Unable to find source-code formatter for language: containerfilteringstage.apply. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
    public Continuation<RequestProcessingContext> apply(RequestProcessingContext context) {
        // ...
        if (postMatching) {
            // ...
        } else {
            // pre-matching (response filter stage is pushed in pre-matching phase, so that if pre-matching filter
            // throws exception, response filters get still invoked)
            context.push(new ResponseFilterStage(context, responseFilters, tracingLogger));
            sortedRequestFilters = Providers.sortRankedProviders(new RankedComparator<ContainerRequestFilter>(), requestFilters);
        }

However the sorted filters does not match what I have defined in the EndpointsConfig.

Indeed looking at the rank value I see that overridden binding priority values are not there. Instead Values from the annotation are used.

RankedProvider.computeRank
private int computeRank(final T provider, final int rank) {
    if (rank > 0) {
        return rank;
    } else {
        if (provider.getClass().isAnnotationPresent(Priority.class)) {
            return provider.getClass().getAnnotation(Priority.class).value();
        } else {
            return Priorities.USER;
        }
    }
}

While debugging I have found that all providers are created with the rank value 0. That rank value comes from HK2 ActiveDescriptor.getRanking, and is used to create the RankedProvider as shown below :

Providers.getAllRankedProviders
    public static <T> Iterable<RankedProvider<T>> getAllRankedProviders(final ServiceLocator locator, final Class<T> contract) {
        final List<ServiceHandle<T>> providers = getServiceHandles(locator, contract, CustomAnnotationLiteral.INSTANCE);
        providers.addAll(getServiceHandles(locator, contract));

        final LinkedHashMap<ActiveDescriptor<T>, RankedProvider<T>> providerMap =
                new LinkedHashMap<ActiveDescriptor<T>, RankedProvider<T>>();

        for (final ServiceHandle<T> provider : providers) {
            final ActiveDescriptor<T> key = provider.getActiveDescriptor();
            if (!providerMap.containsKey(key)) {
                final Set<Type> contractTypes = key.getContractTypes();
                final Class<?> implementationClass = key.getImplementationClass();
                boolean proxyGenerated = true;
                for (Type ct : contractTypes) {
                    if (((Class<?>) ct).isAssignableFrom(implementationClass)) {
                        proxyGenerated = false;
                        break;
                    }
                }
                providerMap.put(key,
                        new RankedProvider<T>(provider.getService(), key.getRanking(), proxyGenerated ? contractTypes : null));
            }
        }

        return providerMap.values();
    }

I'm a bit lost when debugging the code between the actual configuration, and the initialisation phase here. Yet I think this is a fault behaviour according the the javadoc.

The only solution to counter that is to wrap these filters in a wrapping class annotated with the wanted binding priority.






[JERSEY-3194] org.glassfish.jersey.server.mvc.jsp.RequestDispatcherWrapper#forward causes WARNING: Cannot set header. Response already committed in WebSphere Created: 24/Nov/16  Updated: 24/Nov/16

Status: Open
Project: jersey
Component/s: extensions
Affects Version/s: 2.24.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: impaler7701 Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

AIX, WebSphere 9.0.1, Java 8, Servlet 3.0. Jersey 2.24.1



 Description   

org.glassfish.jersey.server.mvc.jsp.RequestDispatcherWrapper#forward method uses
dispatcher.forward(request, response);
to call jsp page/template. Since the control is handed over to jsp servlet the calling servlet is no longer able to set headers and throws warnings in WebSphere 9.0.1

[11/22/16 23:26:51:496 CST] 000000ab SRTServletRes W com.ibm.ws.webcontainer.srt.SRTServletResponse setIntHeader SRVE8094W: WARNING: Cannot set header. Response already committed.
[11/22/16 23:26:51:499 CST] 000000ab SRTServletRes W com.ibm.ws.webcontainer.srt.SRTServletResponse setHeader SRVE8094W: WARNING: Cannot set header. Response already committed.
[11/22/16 23:26:51:499 CST] 000000ab SRTServletRes W com.ibm.ws.webcontainer.srt.SRTServletResponse setStatus WARNING: Cannot set status. Response already committed.

Tomcat does not display such behavior.

I replaced forward with include and it fixed the problem. Suggested fix is

dispatcher.include(request, response);






[JERSEY-3193] Context injection doesn't work for registered bean proxied instance Created: 22/Nov/16  Updated: 22/Nov/16

Status: Open
Project: jersey
Component/s: extensions
Affects Version/s: 2.24.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: bricedutheil Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: proxies, spring
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Java 8
Spring 3/4



 Description   

Similar to JERSEY-3126 / JERSEY-2171, context injection in an advised instance does not work.

This test has been created in the jersey-spring3 sub-project (https://github.com/jersey/jersey/tree/2.x/ext/spring3).

The fix of JERSEY-3126 don't work, the new code is not even invoked. In this case, notice in the below example the .register(context.getBean(JaxRsResource.class)) that illustrate programatic registration of resources, typically actual code (that work for non advised bean) looks like :

webApplicationContext.getBeansWithAnnotation(ThisKindOfService.class)
                     .forEach((name, resource) -> register(resource));

Also notice in the below example that JaxRsResource.class is an interface that is shareable.

package org.glassfish.jersey.server.spring.proxies;

import javax.inject.Provider;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import org.glassfish.jersey.logging.LoggingFeature;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.server.spring.scope.RequestContextFilter;
import org.glassfish.jersey.test.JerseyTest;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.concurrent.ConcurrentMapCache;
import org.springframework.cache.support.SimpleCacheManager;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Service;

import static java.util.Collections.singletonList;

public class SpringWithProxiesResourceTest extends JerseyTest {

    @Override
    protected Application configure() {
        ApplicationContext context = new AnnotationConfigApplicationContext(SpringWithProxyConfiguration.class);
        return new ResourceConfig()
                .register(RequestContextFilter.class)
                .register(LoggingFeature.class)
                .register(context.getBean(JaxRsResource.class))
                .property("contextConfig", context);
    }

    @Test
    public void shouldUseDefaultComponent() {
        final String result = target("spring-resource").request().get(String.class);
        Assert.assertEquals("spring-resource", result);
    }

    @Configuration
    @EnableCaching
    public static class SpringWithProxyConfiguration {
        @Bean
        public JaxRsResource jaxRsResource() {
            return new SpringWithProxiesResourceImpl();
        }

        @Bean
        public CacheManager cacheManager() {
            SimpleCacheManager cm = new SimpleCacheManager();
            cm.setCaches(singletonList(new ConcurrentMapCache("default")));
            return cm;
        }
    }

    @Service
    public static class SpringWithProxiesResourceImpl implements JaxRsResource {

        @Context
        Provider<UriInfo> uriInfoProvider;

        @Context
        private UriInfo uriInfo;

        @Cacheable("default")
        @Override
        public String doSomething() {
            return uriInfo.getPath();
        }

    }

    @Path("spring-resource")
    public interface JaxRsResource {
        @GET
        @Produces(MediaType.TEXT_PLAIN)
        String doSomething();
    }
}

The issue is that the extension is not even used in this situation. The applicationHandler invokes directly locator.inject(instance), and this doesn't work as this code doesn't perform the unwrapping necessary for spring proxies. This part of the code doesn't even provide an extension mechanism.

Relevant code : https://github.com/jersey/jersey/blob/2.x/core-server/src/main/java/org/glassfish/jersey/server/ApplicationHandler.java#L615-L621

Having a way to tell Jersey to inject in the advised bean could solve the issue

locator.inject(((Advised) instance).getTargetSource().getTarget())


 Comments   
Comment by bricedutheil [ 22/Nov/16 ]

In the example above the following field can be dismissed.

        @Context
        Provider<UriInfo> uriInfoProvider;
Comment by bricedutheil [ 22/Nov/16 ]

By the way at the time of this writing 2.x and master have both this issue.

The reproducible example is on my fork (while trying to fix the issue) : https://github.com/bric3/jersey/blob/JERSEY-3193/ext/spring3/src/test/java/org/glassfish/jersey/server/spring/proxies/SpringWithProxiesResourceTest.java

I may be able to propose a fix, but since the issue at hand seems related to the core, I'd like guidance.





[JERSEY-3192] Jersey client seems to create dupliate requests Created: 22/Nov/16  Updated: 22/Nov/16

Status: Open
Project: jersey
Component/s: connectors
Affects Version/s: 1.12
Fix Version/s: None

Type: Bug Priority: Major
Reporter: pvsurnt Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

PROD



 Description   

Hi,
we're using Jersey v1.12 in a PROD environnement for Banking purpose.

Since we're are getting duplicates requests received on the server side and nothing indicates that the client send two but I'd like to see with you guys if you now anything that could be related to the Jersey api and the way we implemented it.

public CertaPayResponse postApplicationXmlAsCertaPayResponse(CertaPayRequest input) {
UriBuilder localUriBuilder = _uriBuilder.clone();
WebResource resource = _client.resource(localUriBuilder.buildFromMap(_templateAndMatrixParameterValues));
WebResource.Builder resourceBuilder = resource.getRequestBuilder();
resourceBuilder = resourceBuilder.type("application/xml");
resourceBuilder = resourceBuilder.accept("application/xml");
return resourceBuilder.method("POST", CertaPayResponse.class, input);

Thanks for your help.
Pat






[JERSEY-3191] Error occured when create restful api with jersey2.22.2 + spring4.1.7 Created: 21/Nov/16  Updated: 21/Nov/16

Status: Open
Project: jersey
Component/s: extensions
Affects Version/s: 2.22.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: pengpeng2611 Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

windows 64bit, tomcat7.x, JDK7, apache maven 3.3.3



 Description   
pom.xml
<dependency>
			<groupId>org.glassfish.jersey.containers</groupId>
			<artifactId>jersey-container-servlet-core</artifactId>
			<version>2.22.2</version>
</dependency>
<dependency>
			<groupId>org.glassfish.jersey.ext</groupId>
			<artifactId>jersey-spring3</artifactId>
			<version>2.22.2</version>
			<exclusions>
				<exclusion>
					<groupId>org.springframework</groupId>
					<artifactId>spring-core</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.springframework</groupId>
					<artifactId>spring-web</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.springframework</groupId>
					<artifactId>spring-beans</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.springframework</groupId>
					<artifactId>spring-context</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.springframework</groupId>
					<artifactId>spring-aop</artifactId>
				</exclusion>
			</exclusions>
</dependency>
<dependency>
			<groupId>org.codehaus.jackson</groupId>
			<artifactId>jackson-core-asl</artifactId>
		</dependency>
		<dependency>
			<groupId>org.codehaus.jackson</groupId>
			<artifactId>jackson-mapper-asl</artifactId>
		</dependency>
		<dependency>
			<groupId>org.codehaus.jackson</groupId>
			<artifactId>jackson-jaxrs</artifactId>
			<version>1.9.12</version>
</dependency>
web.xml
<servlet>
    <servlet-name>jersey restful</servlet-name>
    <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
    <init-param>
      <param-name>javax.ws.rs.Application</param-name>
      <param-value>com.boco.gpsp.rest.RestApplicationInit</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>jersey restful</servlet-name>
    <url-pattern>/rest/*</url-pattern>
</servlet-mapping>
RestApplicationInit
package com.boco.gpsp.rest;

import javax.ws.rs.ApplicationPath;
import org.codehaus.jackson.jaxrs.JacksonJsonProvider;
import org.glassfish.jersey.filter.LoggingFilter;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.server.spring.scope.RequestContextFilter;
import com.boco.gpsp.rest.resource.UserResource;


@ApplicationPath("/rest")
public class RestApplicationInit extends ResourceConfig{

	public RestApplicationInit() {  
        packages("com.boco.gpsp.rest.resource");
        register(UserResource.class);
		    register(JacksonJsonProvider.class);
        register(RequestContextFilter.class);
        register(LoggingFilter.class);
    }
	
}
UserResource
package com.boco.gpsp.rest.resource;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.boco.gpsp.service.UserService;

@Path("users")
@Component
public class UserResource {

	@Autowired
	private UserService userService;

	@GET
	@Path("{name}")
	@Produces(MediaType.TEXT_PLAIN)
	public String search(@PathParam("id") String name) {
		return userService.getUserByName(name);
	}
}
UserService
package com.boco.gpsp.service;

import org.springframework.stereotype.Service;

import com.boco.gpsp.service.UserService;

@Service
public class UserService {

	public String getUserByName(String name) {
		return "user: name=" + name;
	}

}
spring-servlet.xml
<context:annotation-config />
<context:component-scan base-package="com.boco.gpsp.*" />

When i test my api in chrome by :
http://localhost:9090/app/rest/users/jack
error appeared as below:

javax.servlet.ServletException: A MultiException has 3 exceptions. They are:
1. org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.boco.gpsp.service.UserService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations:

{@org.springframework.beans.factory.annotation.Autowired(required=true)}

2. java.lang.IllegalArgumentException: While attempting to resolve the dependencies of com.boco.gpsp.rest.resource.UserResource errors were found
3. java.lang.IllegalStateException: Unable to perform operation: resolve on com.boco.gpsp.rest.resource.UserResource

org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:489)
org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)






[JERSEY-3188] Stuck threads under heavy load Created: 18/Nov/16  Updated: 18/Nov/16

Status: Open
Project: jersey
Component/s: None
Affects Version/s: 1.19.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: stefan.friedrich Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

JDK 1.7.0_85
WebLogic 10.3.5



 Description   

Under heavy load in a production environment we see a dead-lock situation. Here is the thread dump:

ExecuteThread: '118' for queue: 'weblogic.kernel.Default (self-tuning)'" waiting for lock java.util.WeakHashMap@357951b8 BLOCKED
com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.getStoredJAXBContext(AbstractJAXBProvider.java:193)
com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.getJAXBContext(AbstractJAXBProvider.java:188)
com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.getMarshaller(AbstractJAXBProvider.java:166)
com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.getMarshaller(AbstractJAXBProvider.java:145)
com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.writeTo(AbstractRootElementProvider.java:151)
com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:302)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1510)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:558)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:733)
javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
...
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71)
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3748)
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3714)
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2283)
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2182)
weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1491)
weblogic.work.ExecuteThread.execute(ExecuteThread.java:263)
weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

AbstractJAXBProvider.getStoredJAXBContext() synchronizes on the static field jaxbContexts and accesses jaxbContexts in line 193. This may cause the problem.

There were also some problems with WeakHahsMap we want to mention:

https://bugs.openjdk.java.net/browse/JDK-8075006
https://java.net/jira/browse/JAVASERVERFACES-2544






[JERSEY-3187] Useless exception when client closes stream whilst response transfer Created: 18/Nov/16  Updated: 18/Nov/16

Status: Open
Project: jersey
Component/s: core
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: mkarg Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When a client closes the TCP connection while the transmission of the response is in process, an EXCEPTION is logged.

It is a pretty normal use case that users simply close their browser while in the background it is still receiving data.

Hence it might make sense to log this case, but it is really not worth logging a STACK TRACE, as this is neither an exceptional case nor a fault in any way.

Moreover, it is pretty scary to see that Jersey rates this use case as a SERVER error (see below: 500 Server Error), as the server did not fail in any way!

Example:

[2016-11-18T08:56:10.541+0100] [Payara 4.1] [SEVERE] [] [org.glassfish.jersey.server.ServerRuntime$Responder] [tid: _ThreadID=32 _ThreadName=http-listener-1(5)] [timeMillis: 1479455770541] [levelValue: 1000] [[
An I/O error has occurred while writing a response message entity to the container output stream.
javax.ws.rs.InternalServerErrorException: HTTP 500 Internal Server Error
at org.glassfish.jersey.jaxb.internal.AbstractRootElementJaxbProvider.writeTo(AbstractRootElementJaxbProvider.java:182)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
at org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:106)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:86)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1130)
at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:711)
at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:444)
at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:434)
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:329)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:471)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:425)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:383)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:336)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:223)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at net.java.dev.webdav.interop.WindowsRedirectorPatchResourceFilter.doFilter(WindowsRedirectorPatchResourceFilter.java:205)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:416)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:283)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.xml.bind.MarshalException

  • with linked exception:
    [java.io.IOException: Connection closed]
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:328)
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:251)
    at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:110)
    at org.glassfish.jersey.jaxb.internal.AbstractRootElementJaxbProvider.writeTo(AbstractRootElementJaxbProvider.java:201)
    at org.glassfish.jersey.jaxb.internal.AbstractRootElementJaxbProvider.writeTo(AbstractRootElementJaxbProvider.java:180)
    ... 58 more
    Caused by: java.io.IOException: Connection closed
    at org.glassfish.grizzly.asyncqueue.TaskQueue.onClose(TaskQueue.java:317)
    at org.glassfish.grizzly.nio.AbstractNIOAsyncQueueWriter.onClose(AbstractNIOAsyncQueueWriter.java:501)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.closeConnection(TCPNIOTransport.java:412)
    at org.glassfish.grizzly.nio.NIOConnection.doClose(NIOConnection.java:604)
    at org.glassfish.grizzly.nio.NIOConnection$5.run(NIOConnection.java:570)
    at org.glassfish.grizzly.nio.DefaultSelectorHandler.execute(DefaultSelectorHandler.java:235)
    at org.glassfish.grizzly.nio.NIOConnection.terminate0(NIOConnection.java:564)
    at org.glassfish.grizzly.nio.transport.TCPNIOConnection.terminate0(TCPNIOConnection.java:291)
    at org.glassfish.grizzly.nio.transport.TCPNIOAsyncQueueWriter.writeCompositeRecord(TCPNIOAsyncQueueWriter.java:197)
    at org.glassfish.grizzly.nio.transport.TCPNIOAsyncQueueWriter.write0(TCPNIOAsyncQueueWriter.java:92)
    at org.glassfish.grizzly.nio.AbstractNIOAsyncQueueWriter.processAsync(AbstractNIOAsyncQueueWriter.java:344)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:107)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.executeIoEvent(WorkerThreadIOStrategy.java:103)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.executeIoEvent(AbstractIOStrategy.java:89)
    at org.glassfish.grizzly.nio.SelectorRunner.iterateKeyEvents(SelectorRunner.java:415)
    at org.glassfish.grizzly.nio.SelectorRunner.iterateKeys(SelectorRunner.java:384)
    at org.glassfish.grizzly.nio.SelectorRunner.doSelect(SelectorRunner.java:348)
    at org.glassfish.grizzly.nio.SelectorRunner.run(SelectorRunner.java:279)
    ... 3 more
    Caused by: java.io.IOException: Eine vorhandene Verbindung wurde vom Remotehost geschlossen
    at sun.nio.ch.SocketDispatcher.write0(Native Method)
    at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:51)
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
    at sun.nio.ch.IOUtil.write(IOUtil.java:51)
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471)
    at org.glassfish.grizzly.nio.transport.TCPNIOUtils.flushByteBuffer(TCPNIOUtils.java:149)
    at org.glassfish.grizzly.nio.transport.TCPNIOAsyncQueueWriter.writeCompositeRecord(TCPNIOAsyncQueueWriter.java:187)
    ... 16 more





[JERSEY-3185] Attribute "filename" of header Content-Disposition with incorrect codificacition Created: 14/Nov/16  Updated: 17/Nov/16

Status: Open
Project: jersey
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: nelson_nba Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

ubuntu



 Description   

Processing a post request of Content-Type: multipart/form-data, if the original file name of one of the parts in the client side have accentuated characters, the attribute "filename" of header Content-Disposition of this bodypart that i get in the server side when i parse the multimpart iterating for the parts, is incorrectly encoded.

I use jersey 2.22.2 y mimepull 1.9.6



 Comments   
Comment by nelson_nba [ 17/Nov/16 ]

The problem seems to be mimepull library, that since version 1.9.1 or after produces this error. Using jersey 2.22.2 and forcing to use mimepull 1.9 not occurs this error





[JERSEY-3166] Configurable.register(Object) should also handle injection of DynamicFeature. Created: 26/Sep/16  Updated: 15/Nov/16

Status: Open
Project: jersey
Component/s: containers
Affects Version/s: 2.23.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: victornoel Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Hi,

According to the JAX-RS specification, register(Object) is meant to inject @Context (and I guess @Inject?) into the object.

Currently, it does so if the object implements Feature but it should at least do so also for DynamicFeature, and maybe other classes (I'm not sure how to interpret "JAX-RS component" in the citation below).

Here is two relevant documentation of javax.ws.rs.core.Configurable.register(Object):

The registered JAX-RS component is registered as a contract provider of all the recognized JAX-RS or implementation-specific extension contracts including meta-provider contracts, such as {@code Feature} or {@link javax.ws.rs.container.DynamicFeature}.

Fields and properties of all registered JAX-RS component instances are injected with their declared dependencies (see {@link Context}) by the JAX-RS runtime prior to use.



 Comments   
Comment by bricedutheil [ 15/Nov/16 ]

Indeed I'm surprised this specification part is not handled by Jersey / HK2.

It may really fix JERSEY-1960





[JERSEY-3186] FormDataParam is not seen by jersey when not the last parameter annotation Created: 15/Nov/16  Updated: 15/Nov/16

Status: Open
Project: jersey
Component/s: core
Affects Version/s: 2.24
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: bricedutheil Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b16, mixed mode)



 Description   

Hi,

Jersey reports the following error (edited for readbility)

error log
[FATAL] No injection source found for a parameter of type

public javax.ws.rs.core.Response com.product.resource.CustomerResourceImpl.uploadFile(java.io.InputStream) at index 0.;

source='ResourceMethod{
  httpMethod=POST,
  consumedTypes=[multipart/form-data],
  producedTypes=[],
  suspended=false,
  suspendTimeout=0,
  suspendTimeoutUnit=MILLISECONDS,
  invocable=Invocable{
    handler=ClassBasedMethodHandler{
      handlerClass=class com.product.resource.CustomerResourceImpl,
      handlerConstructors=[org.glassfish.jersey.server.model.HandlerConstructor@99ffd68]},
      definitionMethod=public abstract javax.ws.rs.core.Response com.product.api.CustomerResource.uploadFile(java.io.InputStream),
      parameters=[Parameter [type=class java.io.InputStream, source=..., defaultValue=null]],
      responseType=class javax.ws.rs.core.Response
  },
  nameBindings=[]
}'

The code looks like

resource definition
@Path("customers")
@Api("customers")
public interface CustomerResource {
    @POST
    @ApiOperation("...")
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    Response uploadFile(
            @FormDataParam("customers-file") 
            @ApiParam(value = "the CSV file for customer's updates", required = true)
            InputStream fileAsStream
    );
}

Note the order of the annotations, first @FormDataParam then the swagger annotation @ApiParam.

resource implementation
@Component
public class CustomerResourceImpl implements CustomerResource {
    @Override
    public Response uploadFile(InputStream fileAsStream) {
        // ...
    }
}

Also the form data extension is correctly registered in the application.

The problem here is that jersey picks the last annotation* on the parameter as the source provider marker. This problem appeared with the MultipartFeature however the issue can show up for any other extension using the same mechanism. There was a similar issue JERSEY-787 but it relates to Jersey 1.x and it is fixed.

The issue is hard to diagnose form a user perspective because the log doesn't mention the annotation type as the source provider or don't mention the last annotation is used when the source is unknown.


At the very least the error message should be modified regarding that :

When no source provider are found for a resource method the error message should be tweaked.

1. First the message template (regarding the annotation order)

org.glassfish.jersey.server.model.ResourceMethodValidator#checkValueProviders
    private void checkValueProviders(ResourceMethod method) {
        final List<? extends Factory<?>> valueProviders = method.getInvocable().getValueProviders(locator);
        if (valueProviders.contains(null)) {
            int index = valueProviders.indexOf(null);
            Errors.fatal(method, LocalizationMessages.ERROR_PARAMETER_MISSING_VALUE_PROVIDER(index, method.getInvocable()
                    .getHandlingMethod()));
        }
    }

ERROR_PARAMETER_MISSING_VALUE_PROVIDER refers to the following localisation key error.parameter.missing.value.provider.

2. Regarding how the invocation is printed. The previous code pass the method method, however the annotation type is not printed as shown in the log excerpt.

class Parameter
    @Override
    public String toString() {
        return String.format("Parameter [type=%s, source=%s, defaultValue=%s]",
                getRawType(), getSourceName(), getDefaultValue());
    }

I propose to add the sourceAnnotation to get the actual annotation type.


Fixing the root of the problem may be more problematic, as the parameter factory is not extensible and is non deterministic when the source is unknown as the code only takes the last annotation (not documented here https://jersey.java.net/documentation/latest/media.html#multipart)

Parameter.create
public class Parameter implements AnnotatedElement {
    // ...
    public static Parameter create(
            Class concreteClass,
            Class declaringClass,
            boolean encodeByDefault,
            Class<?> rawType,
            Type type,
            Annotation[] annotations) {
        // ...

        /**
         * Create a parameter from the list of annotations. Unknown annotated
         * parameters are also supported, and in such a cases the last
         * unrecognized annotation is taken to be that associated with the
         * parameter.
         */
        for (Annotation annotation : annotations) {
            if (ANNOTATION_HELPER_MAP.containsKey(annotation.annotationType())) {
                ParamAnnotationHelper helper = ANNOTATION_HELPER_MAP.get(annotation.annotationType());
                paramAnnotation = annotation;
                paramSource = helper.getSource();
                paramName = helper.getValueOf(annotation);
            } else if (Encoded.class == annotation.annotationType()) {
                paramEncoded = true;
            } else if (DefaultValue.class == annotation.annotationType()) {
                paramDefault = ((DefaultValue) annotation).value();
            } else {
                // Take latest unknown annotation, but don't override known annotation
                if ((paramAnnotation == null) || (paramSource == Source.UNKNOWN)) {
                    paramAnnotation = annotation;
                    paramSource = Source.UNKNOWN;
                    paramName = getValue(annotation);
                }
            }
        }
// ...

Hence depending the order of the annotation in the source, the provider may not be found. What happens with the snippet code is that this codes uses the @ApiParam annotation, that of course won't match when the provider looks for a known annotation :

org.glassfish.jersey.media.multipart.internal.FormDataParamValueFactoryProvider#createValueFactory
    @Override
    protected Factory<?> createValueFactory(final Parameter parameter) {
        final Class<?> rawType = parameter.getRawType();
        if (Parameter.Source.ENTITY == parameter.getSource()) {
            // ...
        } else if (parameter.getSourceAnnotation().annotationType() == FormDataParam.class) {
            // ...
        }
        return null;
    }

One idea when the parameter source is unknown would be to pass all annotations as possible source candidates. Then value factory provider will look at all annotations and return the value factory.

Of course if there's multiple value factory for a parameter then there's a configuration or definition problem.



 Comments   
Comment by bricedutheil [ 15/Nov/16 ]

Hi, I missed something when cleaning the code for public eyes, I cannot edit the ticket.
Is it possible to remove/clean

  • the value of annotation ApiOperation
  • the value of the source in the log excerpt : parameters=[Parameter [type=class java.io.InputStream, source=...

Thanks in advance.

Comment by Pavel Bucek [ 15/Nov/16 ]

done.

Comment by bricedutheil [ 15/Nov/16 ]

@Pavel, thanks !





[JERSEY-3184] When using CDI (weld) 1.x integration, sub-resources defined vial locator returning Class<SubRes> are not integrated with CDI Created: 14/Nov/16  Updated: 14/Nov/16

Status: Open
Project: jersey
Component/s: extensions
Affects Version/s: 2.24
Fix Version/s: None

Type: Bug Priority: Major
Reporter: roytmana Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Weld 2.4, Tomcat 7, JDK 1.8



 Description   

DataAccessResource exposes NewBlueDataAccessResource sub-resource by returning its class

@ApplicationScoped
@Path("data")
public class DataAccessResource {
  @Path("newblue")
  public Class<NewBlueDataAccessResource> getNewBlueResource() {
    return NewBlueDataAccessResource.class;
  }
}

The sub-resource has CDI (weld) injection point (DomainCacheService cacheService) which fail because hk2 tries to manage it.

@RequestScoped
public class NewBlueDataAccessResource {
  @Inject private DomainCacheService cacheService;

On root resource level CDI managed resources get injected just fine. If I inject CDI BeanManager and obtain reference to sub-resource directly and return it rather than use class based locator it works as well

the exception is

javax.servlet.ServletException: A MultiException has 1 exceptions.  They are:
1. org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at SystemInjecteeImpl(requiredType=DomainCacheService,parent=NewBlueDataAccessResource,qualifiers={},position=-1,optional=false,self=false,unqualified=null,1256464973)

	org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:489)
	org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	gov.gao.ems.gateway.util.HttpHeadersFilter.doFilter(HttpHeadersFilter.java:22)

root cause

A MultiException has 1 exceptions.  They are:
1. org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at SystemInjecteeImpl(requiredType=DomainCacheService,parent=NewBlueDataAccessResource,qualifiers={},position=-1,optional=false,self=false,unqualified=null,1256464973)

	org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:75)
	org.jvnet.hk2.internal.Utilities.justInject(Utilities.java:941)
	org.jvnet.hk2.internal.ServiceLocatorImpl.inject(ServiceLocatorImpl.java:980)
	org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1055)
	org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1046)
	org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:173)
	org.glassfish.jersey.server.internal.routing.SubResourceLocatorRouter.apply(SubResourceLocatorRouter.java:131)
	org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:109)
	org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
	org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
	org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
	org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
	org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:92)
	org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:61)
	org.glassfish.jersey.process.internal.Stages.process(Stages.java:197)
	org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:318)
	org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
	org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
	org.glassfish.jersey.internal.Errors.process(Errors.java:315)
	org.glassfish.jersey.internal.Errors.process(Errors.java:297)
	org.glassfish.jersey.internal.Errors.process(Errors.java:267)
	org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
	org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
	org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
	org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
	org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	gov.gao.ems.gateway.util.HttpHeadersFilter.doFilter(HttpHeadersFilter.java:22)

root cause

org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at SystemInjecteeImpl(requiredType=DomainCacheService,parent=NewBlueDataAccessResource,qualifiers={},position=-1,optional=false,self=false,unqualified=null,1256464973)
	org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:75)
	org.jvnet.hk2.internal.Utilities.justInject(Utilities.java:941)
	org.jvnet.hk2.internal.ServiceLocatorImpl.inject(ServiceLocatorImpl.java:980)
	org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1055)
	org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1046)
	org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:173)
	org.glassfish.jersey.server.internal.routing.SubResourceLocatorRouter.apply(SubResourceLocatorRouter.java:131)
	org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:109)
	org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
	org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
	org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
	org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
	org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:92)
	org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:61)
	org.glassfish.jersey.process.internal.Stages.process(Stages.java:197)
	org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:318)
	org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
	org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
	org.glassfish.jersey.internal.Errors.process(Errors.java:315)
	org.glassfish.jersey.internal.Errors.process(Errors.java:297)
	org.glassfish.jersey.internal.Errors.process(Errors.java:267)
	org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
	org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
	org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
	org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
	org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	gov.gao.ems.gateway.util.HttpHeadersFilter.doFilter(HttpHeadersFilter.java:22)


 Comments   
Comment by roytmana [ 14/Nov/16 ]

if I annotate my sub-resource with a @Path("xxx") it works but of course we should not be doing it as the sub-resource becomes available directly via that path





[JERSEY-3175] ChunkedOutput.close is not flushing all the pending output to client before it is actually closed Created: 11/Oct/16  Updated: 14/Nov/16

Status: Open
Project: jersey
Component/s: containers
Affects Version/s: 2.22.1, 2.22.2, 2.23.1
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: clsiu Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

It is critical as it is affecting the stability of our server that run on Jersey 2.22.1 (2.23.1 tested but still not working)

Server running on ChunkedOutput is not returning anything to client end occasionally. Below is the step of the logic:
1) Client initiate a post request to server.
2) Server route the request to a subresource
3) Subresource, PositionValidatorSubResource, is handling this request as a chunkedOutput. It create a future task, and handle it to a java executor.
4) The task is writing several string from client to server as chunkedoutput.
5) Client received chunkedinput.
6) Issue: We found that for some of the chunkedoutput, there're no message received on client end (no log for http). We received a null from chunkedInput.read in such case. Additionally, we found that client connection is being released from the pool and closed
7) Another issue: ChunkedInput.close is not triggering any closing. Server can still write data to ChunkedOutput even after ChunkedInput.close is called.

Server:

@Path("/validate")
@Singleton
public class ValidationResource {
	private static Log LOG = LogFactory.getLog(ValidationResource.class);
	@Inject ValidationServiceResource valResource;
	
	public ValidationResource() {
		if (LOG.isDebugEnabled()) {
			LOG.debug(String.format("Root Resource %s has been initialized", this.getClass()));
		}
	}
	
	@Path("/position")
    public Class<PositionValidatorSubResource> validateOrder() {	
    	return PositionValidatorSubResource.class;
    }
}

SubResource:
The subresource below is constructing a AsyncValidationWorkflow, which spawn a AsyncValidationTask (doing a dummy string return),

@Singleton
public class PositionValidatorSubResource {
	private static final Log LOG = LogFactory.getLog(PositionValidatorSubResource.class);
	private final ValidationServiceResource valResource;
	private final AtomicInteger requestCount;

	@Inject
	public PositionValidatorSubResource(ValidationServiceResource valResource) {
		this.valResource = valResource;
		requestCount = new AtomicInteger(0);
	}

	@POST
	@Path("/async")
	@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
	public ChunkedOutput<ValidationResponse> validatePositionsWorkflow(com.ml.elt.vs.request.obj.ValidationRequest valReq) {
		final ChunkedOutput<ValidationResponse> output = new ChunkedOutput<>(ValidationResponse.class, CommonConsts.CHUNKED_DELIMITER);
		try {			
			AsyncValidationWorkflow<ValidationResponse> workflowWorker = new AsyncValidationWorkflow<>(output, valResp, valReq.getReqID(), valReq, valCoreValReq, valResource, reqCounter);
			valResource.getServiceExecutor().execute(workflowWorker);
		}
		catch (Exception e) {
			LOG.error(e, e);
		}
		return output;
	}	
}

public class AsyncValidationWorkflow<T extends ValidationResponse> extends RunnableControllableValidationServiceTask {
	private final ChunkedOutput<T> output;
	private com.ml.equity.firm.validation.request.ValidationRequest valReq;	
	private final int reqCount;
	private String reqID;
	private T response;
	private ValidationServiceResource valResource;
	private ValidationRequest vsValRequest;

	public AsyncValidationWorkflow(ChunkedOutput<T> output, T response, String reqID, ValidationRequest vsValRequest, com.ml.equity.firm.validation.request.ValidationRequest valReq, ValidationServiceResource valResource, int reqCount) {
		this.output = output;
		this.valReq = valReq;		
		this.reqCount = reqCount;
		this.reqID = reqID;
		this.response = response;
		this.valResource = valResource;
		this.vsValRequest = vsValRequest;
	}

	@Override
	public Runnable getForceCompletionHandlingTask() {
		return new AsyncDefaultReturnHandlerTask<>(output, response, reqCount);
	}

	@Override
	public Runnable getExecutionTask() {
		return new AsyncValidationTask<>(output, response, reqID, vsValRequest, valReq, valResource, reqCount);
	}
}

public class AsyncValidationTask<T extends ValidationResponse> extends RejectableAsyncTask<T> implements Runnable {
	private static final Log LOG = LogFactory.getLog(AsyncValidationTask.class);
	private final com.ml.equity.firm.validation.request.ValidationRequest valReq;
	private final ValidationRequest vsValReq;
	private final int reqCount;
	private final String reqID;
	private final ValidationServiceResource valResource;

	public AsyncValidationTask(ChunkedOutput<T> output, T response, String reqID, ValidationRequest vsValReq, com.ml.equity.firm.validation.request.ValidationRequest valReq, ValidationServiceResource valResource, int reqCount) {
		super(output, response);
		this.valReq = valReq;
		this.reqCount = reqCount;
		this.reqID = reqID;
		this.vsValReq = vsValReq;
		this.valResource = valResource;
	}
	
	public void run() {
		try {
			response = (T)new ValidationResponse();
		response.setStatusCode("ABCDEEEERRRFFFF");
		output.write(response);
		response = (T)new ValidationResponse();
		response.setStatusCode("ABCDEEEERRRFFFF_EEERTTRTRGGGS");		
		output.write(response);
		response = (T)new ValidationResponse();
		response.setRetMsgs(Collections.singletonList(ReturnMessage.newReturnMessage(ReturnCode.BOOK_MISSING_AGGUNIT_DESK, "Test is a stupid debug message")));
		output.write(response);
		
		}
		catch (Exception e) {
			e.printStackTrace();
		}
		finally {
			try {
				if (output.isClosed()) {
			output.close();
			}
			}
			catch (Exception e) {
				e.printStackTrace();
			} 
		}
	}
}

Client Code:

public class ValidationClient {

	private static final Log LOG = LogFactory.getLog(ValidationClient.class);

	private final String urlBase;
	private final Client client;
	private final WebTarget baseTarget;
	private final LoadingCache<String, WebTarget> cachedWebTargets = CacheBuilder.newBuilder().build(new CacheLoader<String, WebTarget>() {
		public WebTarget load(String path) {
			return baseTarget.path(path);
		}
	});
	private final ValidationClientAsyncExecutorProvider asyncExecutorProvider;
		
	protected ValidationClient() {
		this.urlBase = "<ServerName>";

		final PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
		connectionManager.setMaxTotal(1);
		connectionManager.setDefaultMaxPerRoute(1);
		connectionManager.setValidateAfterInactivity(2 * 1000);

		defaultResponseTimeout = 20 * 1000;
		defaultChunkedResponseTimeout = 86400 * 1000;

		final ClientConfig clientConfig = new ClientConfig();
		clientConfig.register(MOXyJsonProvider.class);
		clientConfig.property(ApacheClientProperties.CONNECTION_MANAGER, connectionManager);
		clientConfig.property(ApacheClientProperties.REQUEST_CONFIG,
				RequestConfig.custom().setSocketTimeout(defaultResponseTimeout).setConnectTimeout(20 * 1000).build());
		clientConfig.property(ClientProperties.ASYNC_THREADPOOL_SIZE, 1);
		clientConfig.connectorProvider(new ApacheConnectorProvider());
		asyncExecutorProvider = new ValidationClientAsyncExecutorProvider(1);
		asyncExecutorProvider.setAsyncExecutorTerminationTimeoutInSecs(20 * 200);
		clientConfig.register(asyncExecutorProvider);

		this.mediaType = MediaType.APPLICATION_XML;
		this.client = ClientBuilder.newClient(clientConfig);

		this.baseTarget = client.target(urlBase);

		LOG.info("ValidationClient constructed successfully");
	}


	private <I extends ServiceRequest, O extends ServiceResponse> void asyncChunkedResponsePostRequest(String path, final I request, final InvocationCallback<ChunkedInput<O>> callback, Integer chunkedResponseTimeout)
			throws ValidationClientException {
		try {
			cachedWebTargets.get(path).request().accept(mediaType).property(ClientProperties.READ_TIMEOUT, defaultChunkedResponseTimeout) // Overridden timeout value for this
																																																		// request, null will use default to
																																																		// defaultChunkedResponseTimeout
					.async().post(Entity.entity(request, mediaType), callback);
		}
		catch (Exception e) {
			throw handleException(e);
		}
	}
	
	public void asyncChunkedResponseValidationRequest(final ValidationRequest request, final ValidationClientAsyncChunkedResponseCallback<ValidationRequest, ValidationResponse> callback)
			throws ValidationClientException {
		asyncChunkedResponsePostRequest("/validate/position/async", request, new InvocationCallback<ChunkedInput<ValidationResponse>>() {

			@Override
			public void failed(Throwable throwable) {
				callback.failed(handleException(throwable));
			}

			@Override
			public void completed(ChunkedInput<ValidationResponse> response) {
				completedAsyncChunkedResponse(request, response, callback);
			}
		}, chunkedResponseTimeout);
	}


	private <I extends ServiceRequest, O extends ServiceResponse> void completedAsyncChunkedResponse(I request, ChunkedInput<O> response, ValidationClientAsyncChunkedResponseCallback<I, O> callback) {
		response.setParser(ChunkedInput.createParser(CommonConsts.CHUNKED_DELIMITER));
		O chunk;
		while (!response.isClosed() && ((chunk = response.read()) != null)) { // Close by server side, or server return with a null
			callback.response(request, chunk);
			if (callback.shouldClose(request, chunk)) { // client side reaches the stop condition
				LOG.info("Closing Connection from client......");
				response.close();
				break;
			}
		}
		
		if (!response.isClosed()) {
			response.close(); // close in case server return null but not sitting within should close logic
		}
		LOG.info("Return...");
	}
}

Testing Client:

@Ignore
public class ManualTestClient {

	private static final Log LOG = LogFactory.getLog(ManualTestClient.class);
	static AtomicInteger atm = new AtomicInteger(0);

	private static ValidationClient client = ValidationClientBuilder.newClient(new ValidationClientConfigurations());

	private static class TestCallback implements ValidationClientAsyncChunkedResponseCallback<ValidationRequest, ValidationResponse> {
		private int val;		

		public TestCallback(int val) {
			this.val = val;
			
		}

		public void response(ValidationRequest request, ValidationResponse response) {
			if (response == null) {
				LOG.debug("Received : " + val + " has null response.");
			}
			else {
				if (response.getRetMsgs() != null && !response.getRetMsgs().isEmpty()) {
					LOG.debug(val + "," + "NotEmpty");
					try {
					Thread.sleep(10);
					}
					catch (Exception e) {
						e.printStackTrace();
					}
				}
			}
		}

		@Override
		public void failed(ValidationClientException validationClientException) {
			LOG.error("[received async response] failed !" + " " + val, validationClientException);
		}

		@Override
		public boolean shouldClose(ValidationRequest request, ValidationResponse response) {
			if (response != null) {
				return response.getIsServiceCompleted();
			}
			else {
				return false;
			}
		}

	}

	private static ValidationRequest getValidationRequest(int i) {
		ValidationRequest req = new ValidationRequest();
		
		return req;
	}

	private static void testAsyncChunked() throws InterruptedException {

		for (int i = 1; i < 301; i++) {
			try {
				LOG.info("Request sent " +  i);				
				client.asyncChunkedResponseValidationRequest(getValidationRequest(i), new TestCallback(i));				
			}
			catch (Exception e) {
				LOG.error("Error in test async chunked response", e);
			}
		}
	}	

	public static void main(String[] args) throws InterruptedException {
		BasicConfigurator.configure();
		
		testAsyncChunked();		
	}

	
}


 Comments   
Comment by clsiu [ 11/Oct/16 ]

http log for Failed case, as you can see after request is sent nothing is received on response until the connection is closed by server and released:
2898 [validationclient-async-executor-0] DEBUG org.apache.http.impl.execchain.MainClientExec - Executing request POST /validate/position/async HTTP/1.1
2898 [validationclient-async-executor-0] DEBUG org.apache.http.impl.execchain.MainClientExec - Target auth state: UNCHALLENGED
2898 [validationclient-async-executor-0] DEBUG org.apache.http.impl.execchain.MainClientExec - Proxy auth state: UNCHALLENGED
2899 [validationclient-async-executor-0] DEBUG org.apache.http.headers - http-outgoing-0 >> POST /validate/position/async HTTP/1.1
2899 [validationclient-async-executor-0] DEBUG org.apache.http.headers - http-outgoing-0 >> Accept: application/xml
2899 [validationclient-async-executor-0] DEBUG org.apache.http.headers - http-outgoing-0 >> Content-Type: application/xml
2899 [validationclient-async-executor-0] DEBUG org.apache.http.headers - http-outgoing-0 >> User-Agent: Jersey/2.22.2 (Apache HttpClient 4.5)
2899 [validationclient-async-executor-0] DEBUG org.apache.http.headers - http-outgoing-0 >> Transfer-Encoding: chunked
2899 [validationclient-async-executor-0] DEBUG org.apache.http.headers - http-outgoing-0 >> Host: VFHKGP101172.ASIA.bankofamerica.com:20299
2899 [validationclient-async-executor-0] DEBUG org.apache.http.headers - http-outgoing-0 >> Connection: Keep-Alive
2899 [validationclient-async-executor-0] DEBUG org.apache.http.headers - http-outgoing-0 >> Accept-Encoding: gzip,deflate
2899 [validationclient-async-executor-0] DEBUG org.apache.http.wire - http-outgoing-0 >> "POST /validate/position/async HTTP/1.1[\r][\n]"
2899 [validationclient-async-executor-0] DEBUG org.apache.http.wire - http-outgoing-0 >> "Accept: application/xml[\r][\n]"
2899 [validationclient-async-executor-0] DEBUG org.apache.http.wire - http-outgoing-0 >> "Content-Type: application/xml[\r][\n]"
2899 [validationclient-async-executor-0] DEBUG org.apache.http.wire - http-outgoing-0 >> "User-Agent: Jersey/2.22.2 (Apache HttpClient 4.5)[\r][\n]"
2899 [validationclient-async-executor-0] DEBUG org.apache.http.wire - http-outgoing-0 >> "Transfer-Encoding: chunked[\r][\n]"
2899 [validationclient-async-executor-0] DEBUG org.apache.http.wire - http-outgoing-0 >> "Host: VFHKGP101172.ASIA.bankofamerica.com:20299[\r][\n]"
2899 [validationclient-async-executor-0] DEBUG org.apache.http.wire - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
2899 [validationclient-async-executor-0] DEBUG org.apache.http.wire - http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
2899 [validationclient-async-executor-0] DEBUG org.apache.http.wire - http-outgoing-0 >> "[\r][\n]"
2899 [validationclient-async-executor-0] DEBUG org.apache.http.wire - http-outgoing-0 >> "49b[\r][\n]"
2899 [validationclient-async-executor-0] DEBUG org.apache.http.wire - http-outgoing-0 >> "<?xml version="1.0" encoding="UTF-8" standalone="yes"?><validationRequest><productType>SWAPS</productType><reqID>1475837309068</reqID><clientAccount>TEST_CLIENT</clientAccount><clientSLAccountShortSellQty>0</clientSLAccountShortSellQty><clientSLAccountSynthShortSellQty>0</clientSLAccountSynthShortSellQty><cummQty>0</cummQty><deskSLAccountShortSellQty>0</deskSLAccountShortSellQty><deskSLAccountSynthShortSellQty>0</deskSLAccountSynthShortSellQty><deskSLAcct>SL_TEST_CLIENT</deskSLAcct><elocateRequestRetryIntervalms>20000</elocateRequestRetryIntervalms><elocateSiteID>

{E5285C1D-5E1A-4953-A00F-34779147328F}

</elocateSiteID><execID>1475837309068</execID><isEnableAutoElocate>true</isEnableAutoElocate><isOverrideRequest>false</isOverrideRequest><isUpdatePKE>true</isUpdatePKE><isValidateBANAClientList>true</isValidateBANAClientList><isValidateSEBIClientList>true</isValidateSEBIClientList><lastShares>0</lastShares><orderID>1475837309068</orderID><orderSide>2</orderSide><orderdQty>81</orderdQty><originalOrderQty>0</originalOrderQty><requestValidationType>accepted</requestValidationType><transactionTime>0</transactionTime><underlying>0027.HK</underlying></validationRequest>[\r][\n]"
2899 [validationclient-async-executor-0] DEBUG org.apache.http.wire - http-outgoing-0 >> "0[\r][\n]"
2899 [validationclient-async-executor-0] DEBUG org.apache.http.wire - http-outgoing-0 >> "[\r][\n]"
2901 [validationclient-async-executor-0] DEBUG org.apache.http.wire - http-outgoing-0 << "HTTP/1.1 200 OK[\r][\n]"
2901 [validationclient-async-executor-0] DEBUG org.apache.http.wire - http-outgoing-0 << "Content-Type: application/xml[\r][\n]"
2901 [validationclient-async-executor-0] DEBUG org.apache.http.wire - http-outgoing-0 << "Date: Fri, 07 Oct 2016 10:48:30 GMT[\r][\n]"
2901 [validationclient-async-executor-0] DEBUG org.apache.http.wire - http-outgoing-0 << "Transfer-Encoding: chunked[\r][\n]"
2901 [validationclient-async-executor-0] DEBUG org.apache.http.wire - http-outgoing-0 << "[\r][\n]"
2901 [validationclient-async-executor-0] DEBUG org.apache.http.wire - http-outgoing-0 << "0[\r][\n]"
2901 [validationclient-async-executor-0] DEBUG org.apache.http.wire - http-outgoing-0 << "[\r][\n]"
2901 [validationclient-async-executor-0] DEBUG org.apache.http.headers - http-outgoing-0 << HTTP/1.1 200 OK
2901 [validationclient-async-executor-0] DEBUG org.apache.http.headers - http-outgoing-0 << Content-Type: application/xml
2901 [validationclient-async-executor-0] DEBUG org.apache.http.headers - http-outgoing-0 << Date: Fri, 07 Oct 2016 10:48:30 GMT
2901 [validationclient-async-executor-0] DEBUG org.apache.http.headers - http-outgoing-0 << Transfer-Encoding: chunked
2902 [validationclient-async-executor-0] DEBUG org.apache.http.impl.execchain.MainClientExec - Connection can be kept alive indefinitely
2902 [validationclient-async-executor-0] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection [id: 0][route: {}->http://VFHKGP101172.ASIA.bankofamerica.com:20299] can be kept alive indefinitely
2902 [validationclient-async-executor-0] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection released: [id: 0][route: {}->http://VFHKGP101172.ASIA.bankofamerica.com:20299][total kept alive: 1; route allocated: 1 of 1; total allocated: 1 of 1]
2902 [validationclient-async-executor-0] INFO com.ml.equity.firm.validation.client.ValidationClient - Return...
2903 [validationclient-async-executor-0] DEBUG org.apache.http.client.protocol.RequestAddCookies - CookieSpec selected: default
2903 [validationclient-async-executor-0] DEBUG org.apache.http.client.protocol.RequestAuthCache - Auth cache not set in the context
2903 [validationclient-async-executor-0] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection request: [route: {}->http://VFHKGP101172.ASIA.bankofamerica.com:20299][total kept alive: 1; route allocated: 1 of 1; total allocated: 1 of 1]
2903 [validationclient-async-executor-0] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection leased: [id: 0][route: {}->http://VFHKGP101172.ASIA.bankofamerica.com:20299][total kept alive: 0; route allocated: 1 of 1; total allocated: 1 of 1]

Comment by clsiu [ 11/Oct/16 ]

http log for a successful response, some response messages are received

2903 [validationclient-async-executor-0] DEBUG org.apache.http.impl.execchain.MainClientExec - Executing request POST /validate/position/async HTTP/1.1
2903 [validationclient-async-executor-0] DEBUG org.apache.http.impl.execchain.MainClientExec - Target auth state: UNCHALLENGED
2903 [validationclient-async-executor-0] DEBUG org.apache.http.impl.execchain.MainClientExec - Proxy auth state: UNCHALLENGED
2903 [validationclient-async-executor-0] DEBUG org.apache.http.headers - http-outgoing-0 >> POST /validate/position/async HTTP/1.1
2903 [validationclient-async-executor-0] DEBUG org.apache.http.headers - http-outgoing-0 >> Accept: application/xml
2903 [validationclient-async-executor-0] DEBUG org.apache.http.headers - http-outgoing-0 >>