New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

am getting this error when i try to access the appsensor rest api. I am using the spring boot version #30

Closed
shreyasdn opened this Issue Oct 25, 2015 · 21 comments

Comments

Projects
None yet
3 participants
@shreyasdn

shreyasdn commented Oct 25, 2015

05:04:00.216 [http-nio-8085-exec-4] ERROR o.g.j.s.ServerRuntime$Responder - An I
/O error has occurred while writing a response message entity to the container o
utput stream.
java.lang.IllegalStateException: The output stream has already been closed.
at org.glassfish.jersey.message.internal.CommittingOutputStream.setStrea
mProvider(CommittingOutputStream.java:146) ~[jersey-common-2.14.jar:na]
at org.glassfish.jersey.message.internal.OutboundMessageContext.setStrea
mProvider(OutboundMessageContext.java:798) ~[jersey-common-2.14.jar:na]
at org.glassfish.jersey.server.ContainerResponse.setStreamProvider(Conta
inerResponse.java:372) ~[jersey-server-2.14.jar:na]
at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(Ser
verRuntime.java:606) [jersey-server-2.14.jar:na]
at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(S
erverRuntime.java:377) [jersey-server-2.14.jar:na]
at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRun
time.java:420) [jersey-server-2.14.jar:na]
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:27
7) [jersey-server-2.14.jar:na]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) [jersey-
common-2.14.jar:na]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) [jersey-
common-2.14.jar:na]
at org.glassfish.jersey.internal.Errors.process(Errors.java:315) [jersey
-common-2.14.jar:na]
at org.glassfish.jersey.internal.Errors.process(Errors.java:297) [jersey
-common-2.14.jar:na]
at org.glassfish.jersey.internal.Errors.process(Errors.java:267) [jersey
-common-2.14.jar:na]
at org.glassfish.jersey.process.internal.RequestScope.runInScope(Request
Scope.java:297) [jersey-common-2.14.jar:na]
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:
254) [jersey-server-2.14.jar:na]
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHand
ler.java:1030) [jersey-server-2.14.jar:na]
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:3
77) [jersey-container-servlet-core-2.14.jar:na]
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContaine
r.java:381) [jersey-container-servlet-core-2.14.jar:na]
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContaine
r.java:344) [jersey-container-servlet-core-2.14.jar:na]
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContaine
r.java:221) [jersey-container-servlet-core-2.14.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:291) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52
) [tomcat-embed-websocket-8.0.26.jar:8.0.26]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:239) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(
RequestContextFilter.java:99) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
equestFilter.java:107) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:239) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterIntern
al(CharacterEncodingFilter.java:85) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]

    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR

equestFilter.java:107) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:239) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:219) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:106) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:502) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:142) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:79) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:88) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:518) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp
11Processor.java:1091) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
AbstractProtocol.java:673) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpo
int.java:1526) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoin
t.java:1482) [tomcat-embed-core-8.0.26.jar:8.0.26]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1142) [na:1.8.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:617) [na:1.8.0_60]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskTh
read.java:61) [tomcat-embed-core-8.0.26.jar:8.0.26]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]

Is there anyone who can help me solve this problem.

@ProZachJ

This comment has been minimized.

Show comment
Hide comment
@ProZachJ

ProZachJ Oct 25, 2015

Contributor

Does this occur at startup or when you send a request to the server?

On Oct 25, 2015, at 7:11 AM, shreyasdn notifications@github.com wrote:

05:04:00.216 [http-nio-8085-exec-4] ERROR o.g.j.s.ServerRuntime$Responder - An I
/O error has occurred while writing a response message entity to the container o
utput stream.
java.lang.IllegalStateException: The output stream has already been closed.
at org.glassfish.jersey.message.internal.CommittingOutputStream.setStrea
mProvider(CommittingOutputStream.java:146) ~[jersey-common-2.14.jar:na]
at org.glassfish.jersey.message.internal.OutboundMessageContext.setStrea
mProvider(OutboundMessageContext.java:798) ~[jersey-common-2.14.jar:na]
at org.glassfish.jersey.server.ContainerResponse.setStreamProvider(Conta
inerResponse.java:372) ~[jersey-server-2.14.jar:na]
at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(Ser
verRuntime.java:606) [jersey-server-2.14.jar:na]
at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(S
erverRuntime.java:377) [jersey-server-2.14.jar:na]
at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRun
time.java:420) [jersey-server-2.14.jar:na]
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:27
7) [jersey-server-2.14.jar:na]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) [jersey-
common-2.14.jar:na]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) [jersey-
common-2.14.jar:na]
at org.glassfish.jersey.internal.Errors.process(Errors.java:315) [jersey
-common-2.14.jar:na]
at org.glassfish.jersey.internal.Errors.process(Errors.java:297) [jersey
-common-2.14.jar:na]
at org.glassfish.jersey.internal.Errors.process(Errors.java:267) [jersey
-common-2.14.jar:na]
at org.glassfish.jersey.process.internal.RequestScope.runInScope(Request
Scope.java:297) [jersey-common-2.14.jar:na]
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:
254) [jersey-server-2.14.jar:na]
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHand
ler.java:1030) [jersey-server-2.14.jar:na]
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:3
77) [jersey-container-servlet-core-2.14.jar:na]
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContaine
r.java:381) [jersey-container-servlet-core-2.14.jar:na]
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContaine
r.java:344) [jersey-container-servlet-core-2.14.jar:na]
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContaine
r.java:221) [jersey-container-servlet-core-2.14.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:291) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52
) [tomcat-embed-websocket-8.0.26.jar:8.0.26]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:239) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(
RequestContextFilter.java:99) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
equestFilter.java:107) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:239) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterIntern
al(CharacterEncodingFilter.java:85) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR

equestFilter.java:107) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:239) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:219) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:106) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:502) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:142) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:79) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:88) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:518) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp
11Processor.java:1091) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
AbstractProtocol.java:673) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpo
int.java:1526) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoin
t.java:1482) [tomcat-embed-core-8.0.26.jar:8.0.26]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1142) [na:1.8.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:617) [na:1.8.0_60]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskTh
read.java:61) [tomcat-embed-core-8.0.26.jar:8.0.26]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]

Is there anyone who can help me solve this problem.


Reply to this email directly or view it on GitHub.

Contributor

ProZachJ commented Oct 25, 2015

Does this occur at startup or when you send a request to the server?

On Oct 25, 2015, at 7:11 AM, shreyasdn notifications@github.com wrote:

05:04:00.216 [http-nio-8085-exec-4] ERROR o.g.j.s.ServerRuntime$Responder - An I
/O error has occurred while writing a response message entity to the container o
utput stream.
java.lang.IllegalStateException: The output stream has already been closed.
at org.glassfish.jersey.message.internal.CommittingOutputStream.setStrea
mProvider(CommittingOutputStream.java:146) ~[jersey-common-2.14.jar:na]
at org.glassfish.jersey.message.internal.OutboundMessageContext.setStrea
mProvider(OutboundMessageContext.java:798) ~[jersey-common-2.14.jar:na]
at org.glassfish.jersey.server.ContainerResponse.setStreamProvider(Conta
inerResponse.java:372) ~[jersey-server-2.14.jar:na]
at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(Ser
verRuntime.java:606) [jersey-server-2.14.jar:na]
at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(S
erverRuntime.java:377) [jersey-server-2.14.jar:na]
at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRun
time.java:420) [jersey-server-2.14.jar:na]
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:27
7) [jersey-server-2.14.jar:na]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) [jersey-
common-2.14.jar:na]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) [jersey-
common-2.14.jar:na]
at org.glassfish.jersey.internal.Errors.process(Errors.java:315) [jersey
-common-2.14.jar:na]
at org.glassfish.jersey.internal.Errors.process(Errors.java:297) [jersey
-common-2.14.jar:na]
at org.glassfish.jersey.internal.Errors.process(Errors.java:267) [jersey
-common-2.14.jar:na]
at org.glassfish.jersey.process.internal.RequestScope.runInScope(Request
Scope.java:297) [jersey-common-2.14.jar:na]
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:
254) [jersey-server-2.14.jar:na]
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHand
ler.java:1030) [jersey-server-2.14.jar:na]
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:3
77) [jersey-container-servlet-core-2.14.jar:na]
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContaine
r.java:381) [jersey-container-servlet-core-2.14.jar:na]
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContaine
r.java:344) [jersey-container-servlet-core-2.14.jar:na]
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContaine
r.java:221) [jersey-container-servlet-core-2.14.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:291) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52
) [tomcat-embed-websocket-8.0.26.jar:8.0.26]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:239) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(
RequestContextFilter.java:99) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
equestFilter.java:107) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:239) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterIntern
al(CharacterEncodingFilter.java:85) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR

equestFilter.java:107) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:239) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:219) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:106) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:502) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:142) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:79) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:88) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:518) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp
11Processor.java:1091) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
AbstractProtocol.java:673) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpo
int.java:1526) [tomcat-embed-core-8.0.26.jar:8.0.26]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoin
t.java:1482) [tomcat-embed-core-8.0.26.jar:8.0.26]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1142) [na:1.8.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:617) [na:1.8.0_60]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskTh
read.java:61) [tomcat-embed-core-8.0.26.jar:8.0.26]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]

Is there anyone who can help me solve this problem.


Reply to this email directly or view it on GitHub.

@ProZachJ

This comment has been minimized.

Show comment
Hide comment
@ProZachJ

ProZachJ Oct 25, 2015

Contributor

Please make sure you are on the latest master. I'm pretty sure we made some POM changes recently to allow this server to boot correctly.

Here are the steps I just took to get it running. If this doesn't work for you I'll need more info to help you trouble shoot.

  1. Clone latest master
  2. Switch to sample-apps/appsensor-ws-rest-server-boot
  3. Run mvn spring-boot:run

Here is the startup:
screen shot 2015-10-25 at 10 54 02 am

Here is an expected response:
screen shot 2015-10-25 at 10 54 33 am

Contributor

ProZachJ commented Oct 25, 2015

Please make sure you are on the latest master. I'm pretty sure we made some POM changes recently to allow this server to boot correctly.

Here are the steps I just took to get it running. If this doesn't work for you I'll need more info to help you trouble shoot.

  1. Clone latest master
  2. Switch to sample-apps/appsensor-ws-rest-server-boot
  3. Run mvn spring-boot:run

Here is the startup:
screen shot 2015-10-25 at 10 54 02 am

Here is an expected response:
screen shot 2015-10-25 at 10 54 33 am

@shreyasdn

This comment has been minimized.

Show comment
Hide comment
@shreyasdn

shreyasdn Oct 25, 2015

I get the above response but when I try through the rest api client with the application header set I get back no response and the above error. Both the rest server and the spring boot servers send the same response error. Let me know if you need more details will provide them.

shreyasdn commented Oct 25, 2015

I get the above response but when I try through the rest api client with the application header set I get back no response and the above error. Both the rest server and the spring boot servers send the same response error. Let me know if you need more details will provide them.

@ProZachJ

This comment has been minimized.

Show comment
Hide comment
@ProZachJ

ProZachJ Oct 25, 2015

Contributor

I was able to reproduce this by issuing a couple requests to the server, even without the header, the first request gets a proper response and then the second one errors out. Attempting to dig into it.

Contributor

ProZachJ commented Oct 25, 2015

I was able to reproduce this by issuing a couple requests to the server, even without the header, the first request gets a proper response and then the second one errors out. Attempting to dig into it.

@ProZachJ

This comment has been minimized.

Show comment
Hide comment
@ProZachJ

ProZachJ Oct 25, 2015

Contributor

Are you using the default header or setting a custom one via config?

Contributor

ProZachJ commented Oct 25, 2015

Are you using the default header or setting a custom one via config?

@ProZachJ

This comment has been minimized.

Show comment
Hide comment
@ProZachJ

ProZachJ Oct 25, 2015

Contributor

I found a way to resolve the issue that I'm seeing without any header, but the fix leads me to believe that the only way you should be seeing this error is if you aren't passing a header.

@jtmelton I'm not 100% on this yet but looking here:

    private final static WebApplicationException unauthorized =
               new WebApplicationException(
                   Response.status(Status.UNAUTHORIZED)
                           .entity("Page requires sending configured client application identification header.").build());
    ...
        // Get the client application identifier passed in HTTP headers parameters
        String clientApplicationIdentifier = context.getHeaderString(HEADER_NAME);

        if (clientApplicationIdentifier == null) {
            throw unauthorized;
        }

        context.setProperty(RestRequestHandler.APPSENSOR_CLIENT_APPLICATION_IDENTIFIER_ATTR, clientApplicationIdentifier);
    }

You can see how a subsequent request without a header would cause the "unauthorized" error to be thrown. Looking at how this is written, being a final static, I believe the issue is that "Response" is getting reused causing the error. Similar to this example: dropwizard/dropwizard#893

As a test I changed the throw to look like this:

if (clientApplicationIdentifier == null) {
                throw new WebApplicationException(
                               Response.status(Status.UNAUTHORIZED)
                                       .entity("Page requires sending configured client application identification header.").build());
            }

This caused me to no longer trigger the IO exception when I send multiple requests without a header but I'm still unsure how this error could be trigged in the case that clientApplicationIdentifier !== null. I'm thinking I'll need to trace further down the request chain to see how the response is handled in those cases. Perhaps it is used off of the context causing a similar issue?

Contributor

ProZachJ commented Oct 25, 2015

I found a way to resolve the issue that I'm seeing without any header, but the fix leads me to believe that the only way you should be seeing this error is if you aren't passing a header.

@jtmelton I'm not 100% on this yet but looking here:

    private final static WebApplicationException unauthorized =
               new WebApplicationException(
                   Response.status(Status.UNAUTHORIZED)
                           .entity("Page requires sending configured client application identification header.").build());
    ...
        // Get the client application identifier passed in HTTP headers parameters
        String clientApplicationIdentifier = context.getHeaderString(HEADER_NAME);

        if (clientApplicationIdentifier == null) {
            throw unauthorized;
        }

        context.setProperty(RestRequestHandler.APPSENSOR_CLIENT_APPLICATION_IDENTIFIER_ATTR, clientApplicationIdentifier);
    }

You can see how a subsequent request without a header would cause the "unauthorized" error to be thrown. Looking at how this is written, being a final static, I believe the issue is that "Response" is getting reused causing the error. Similar to this example: dropwizard/dropwizard#893

As a test I changed the throw to look like this:

if (clientApplicationIdentifier == null) {
                throw new WebApplicationException(
                               Response.status(Status.UNAUTHORIZED)
                                       .entity("Page requires sending configured client application identification header.").build());
            }

This caused me to no longer trigger the IO exception when I send multiple requests without a header but I'm still unsure how this error could be trigged in the case that clientApplicationIdentifier !== null. I'm thinking I'll need to trace further down the request chain to see how the response is handled in those cases. Perhaps it is used off of the context causing a similar issue?

jtmelton added a commit that referenced this issue Oct 26, 2015

Fixing issue for #30 -
removing caching for WebApplicationException when authorization is
invalid.
@jtmelton

This comment has been minimized.

Show comment
Hide comment
@jtmelton

jtmelton Oct 26, 2015

Owner

@shreyasdn thanks for catching this issue - I've not seen it before.

@ProZachJ thanks for jumping in and looking at the result. Yes, this is likely the (or at least an) issue. I should not have been caching the response. There is implicit state there, and it would cause caching issues on multiple requests. I agree I'm not sure how it could be triggered with if the appropriate authz header was sent, though.

I just pushed a change that should resolve this.

@shreyasdn please let me know if that change resolves this issue.

Owner

jtmelton commented Oct 26, 2015

@shreyasdn thanks for catching this issue - I've not seen it before.

@ProZachJ thanks for jumping in and looking at the result. Yes, this is likely the (or at least an) issue. I should not have been caching the response. There is implicit state there, and it would cause caching issues on multiple requests. I agree I'm not sure how it could be triggered with if the appropriate authz header was sent, though.

I just pushed a change that should resolve this.

@shreyasdn please let me know if that change resolves this issue.

@shreyasdn

This comment has been minimized.

Show comment
Hide comment
@shreyasdn

shreyasdn Oct 26, 2015

@ProZachJ thanks a lot for replying so quickly and looking at the issue.
@jtmelton I tried the latest code for the spring boot server and i ran mvn spring-boot:run command but as @ProZachJ said the second response is still throwing the error i got earliar. I just downloaded the latest commit.

shreyasdn commented Oct 26, 2015

@ProZachJ thanks a lot for replying so quickly and looking at the issue.
@jtmelton I tried the latest code for the spring boot server and i ran mvn spring-boot:run command but as @ProZachJ said the second response is still throwing the error i got earliar. I just downloaded the latest commit.

@jtmelton

This comment has been minimized.

Show comment
Hide comment
@jtmelton

jtmelton Oct 26, 2015

Owner

@shreyasdn Ok, is there any way you could send over your code/test case? I can't reproduce. I'm assuming you're using the spring boot rest server, and the rest api client - is that right? Could you send your client code?

Owner

jtmelton commented Oct 26, 2015

@shreyasdn Ok, is there any way you could send over your code/test case? I can't reproduce. I'm assuming you're using the spring boot rest server, and the rest api client - is that right? Could you send your client code?

@jtmelton

This comment has been minimized.

Show comment
Hide comment
@jtmelton

jtmelton Oct 26, 2015

Owner

@shreyasdn also, how are you starting up the server? What you should do after pulling the latest code is a 'mvn clean install' from the root appsensor directory (that'll install the rest-server changes I made as well as run the tests). After that, you can run 'mvn spring-boot:run' from the spring boot rest server directory.

Owner

jtmelton commented Oct 26, 2015

@shreyasdn also, how are you starting up the server? What you should do after pulling the latest code is a 'mvn clean install' from the root appsensor directory (that'll install the rest-server changes I made as well as run the tests). After that, you can run 'mvn spring-boot:run' from the spring boot rest server directory.

@shreyasdn

This comment has been minimized.

Show comment
Hide comment
@shreyasdn

shreyasdn Oct 26, 2015

@jtmelton thanks that fixed the issue but why do i get a unauthorized for my request as i have configured to correct client auth header. Please find below the screenshot of my client. Can you tell me if i need to add any other headers?
appsensor

shreyasdn commented Oct 26, 2015

@jtmelton thanks that fixed the issue but why do i get a unauthorized for my request as i have configured to correct client auth header. Please find below the screenshot of my client. Can you tell me if i need to add any other headers?
appsensor

@jtmelton

This comment has been minimized.

Show comment
Hide comment
@jtmelton

jtmelton Oct 26, 2015

Owner

@shreyasdn No that looks mostly right. Can you send me the url you were hitting, the verb (get/post) and the content you were sending?

The only thing I see in the screenshot that looks odd is the cookie. Looks like it's a google analytics cookie - that shouldn't be coming from our server. Ours would have a jsessionid cookie.

Owner

jtmelton commented Oct 26, 2015

@shreyasdn No that looks mostly right. Can you send me the url you were hitting, the verb (get/post) and the content you were sending?

The only thing I see in the screenshot that looks odd is the cookie. Looks like it's a google analytics cookie - that shouldn't be coming from our server. Ours would have a jsessionid cookie.

@shreyasdn

This comment has been minimized.

Show comment
Hide comment
@shreyasdn

shreyasdn Oct 26, 2015

i am hitting the url http://localhost:8085/api/v1.0/responses and using get verb and sending no content.

shreyasdn commented Oct 26, 2015

i am hitting the url http://localhost:8085/api/v1.0/responses and using get verb and sending no content.

@jtmelton

This comment has been minimized.

Show comment
Hide comment
@jtmelton

jtmelton Oct 26, 2015

Owner

Ok, I'm using the "Advanced Rest Client" chrome app, and here is my config/response:

image

Owner

jtmelton commented Oct 26, 2015

Ok, I'm using the "Advanced Rest Client" chrome app, and here is my config/response:

image

@jtmelton

This comment has been minimized.

Show comment
Hide comment
@jtmelton

jtmelton Oct 26, 2015

Owner

After looking, it appears the request header name and value in yours are quoted. Can you check that?

Owner

jtmelton commented Oct 26, 2015

After looking, it appears the request header name and value in yours are quoted. Can you check that?

@shreyasdn

This comment has been minimized.

Show comment
Hide comment
@shreyasdn

shreyasdn Oct 26, 2015

Yes that was the issue and just another question how do i add users to the server?

shreyasdn commented Oct 26, 2015

Yes that was the issue and just another question how do i add users to the server?

@shreyasdn shreyasdn closed this Oct 26, 2015

@jtmelton

This comment has been minimized.

Show comment
Hide comment
@jtmelton

jtmelton Oct 26, 2015

Owner

Add users to the server from what perspective? Do you mean users as in users that are causing events? If so, they are automatically tracked. If not, let me know what you mean.

Owner

jtmelton commented Oct 26, 2015

Add users to the server from what perspective? Do you mean users as in users that are causing events? If so, they are automatically tracked. If not, let me know what you mean.

@shreyasdn

This comment has been minimized.

Show comment
Hide comment
@shreyasdn

shreyasdn Oct 26, 2015

Yes let us say to report an event i use username bob should i add some config to the server config file to allow this?

shreyasdn commented Oct 26, 2015

Yes let us say to report an event i use username bob should i add some config to the server config file to allow this?

@jtmelton

This comment has been minimized.

Show comment
Hide comment
@jtmelton

jtmelton Oct 26, 2015

Owner

No, that'll be picked up automatically. What you'd have to add config for are "client applications", ie. the application "name" that is sending you events. So, the application named "myclientapp" is sending an event that "bob" triggered (while using "myclientapp").

If you want to use another client app, you'd need to configure that, so that appsensor knows what client applications to allow requests from.

Owner

jtmelton commented Oct 26, 2015

No, that'll be picked up automatically. What you'd have to add config for are "client applications", ie. the application "name" that is sending you events. So, the application named "myclientapp" is sending an event that "bob" triggered (while using "myclientapp").

If you want to use another client app, you'd need to configure that, so that appsensor knows what client applications to allow requests from.

@shreyasdn

This comment has been minimized.

Show comment
Hide comment
@shreyasdn

shreyasdn Oct 26, 2015

Ok thanks so much for the amazing responses from you.

shreyasdn commented Oct 26, 2015

Ok thanks so much for the amazing responses from you.

@jtmelton

This comment has been minimized.

Show comment
Hide comment
@jtmelton

jtmelton Oct 26, 2015

Owner

Absolutely - thank you for helping us track down a bug.

Owner

jtmelton commented Oct 26, 2015

Absolutely - thank you for helping us track down a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment