Skip to main content
10-Marble
December 15, 2022
Solved

How to solve below two errors in thingworx ? Also if someone can explain root cause of it.

  • December 15, 2022
  • 2 replies
  • 3070 views
2022-12-15 06:38:09.470+0000 [L: ERROR] [O: E.c.q.l.c.Logger] [I: ] [U: dummyuser] [S: ] [P: ] [T: http-nio-8080-exec-94] Unable To Parse JSON Request com.thingworx.common.exceptions.InvalidRequestException: Unable To Parse JSON Request
at com.thingworx.webservices.BaseService.handleInvoke(BaseService.java:3261)
at com.thingworx.webservices.BaseService.service(BaseService.java:489)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at com.thingworx.security.contenttype.ContentTypeFilter.doFilter(ContentTypeFilter.java:138)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at com.thingworx.security.contenttype.ContentLengthFilter.doFilter(ContentLengthFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at com.thingworx.security.filter.ValidationFilter.doFilter(ValidationFilter.java:22)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at com.thingworx.security.authentication.AuthenticationFilter.propagateRequest(AuthenticationFilter.java:689)
at com.thingworx.security.authentication.AuthenticationFilter.doFilter(AuthenticationFilter.java:229)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:389)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at com.thingworx.security.filter.ClickjackFilter.doFilter(ClickjackFilter.java:208)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at com.thingworx.security.filter.HttpResponseHeadersFilter.doFilter(HttpResponseHeadersFilter.java:172)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:750)

2022-12-15 06:38:11.165+0000 [L: ERROR] [O: E.c.q.l.c.Logger] [I: ] [U: ???] [S: ] [P: ] [T: http-nio-8080-exec-61] Error executing API request message, sending error response to caller! com.thingworx.communications.server.security.NotAuthorizedException: Unable to lookup security context because ThingWorx Session ID [1067603427] is no longer valid!
at com.thingworx.communications.platform.security.ThingworxSessionCache.lookupSecurityContext(ThingworxSessionCache.java:111)
at com.thingworx.communications.platform.modules.DispatchingServerCommunicationModule.processAPIRequestMessage(DispatchingServerCommunicationModule.java:416)
at com.thingworx.communications.platform.modules.DispatchingServerCommunicationModule.process(DispatchingServerCommunicationModule.java:305)
at com.thingworx.communications.server.endpoints.DispatchingServerEndpoint.messageReceived(DispatchingServerEndpoint.java:103)
at com.thingworx.communications.server.connection.jsr356.AbstractServerConnection.onThingworxMessage(AbstractServerConnection.java:416)
at com.thingworx.communications.server.connection.jsr356.AbstractServerConnection.onMessage(AbstractServerConnection.java:342)
at sun.reflect.GeneratedMethodAccessor51.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tomcat.websocket.pojo.PojoMessageHandlerWholeBase.onMessage(PojoMessageHandlerWholeBase.java:80)
at org.apache.tomcat.websocket.WsFrameBase.sendMessageBinary(WsFrameBase.java:602)
at org.apache.tomcat.websocket.server.WsFrameServer.sendMessageBinary(WsFrameServer.java:141)
at org.apache.tomcat.websocket.WsFrameBase.processDataBinary(WsFrameBase.java:561)
at org.apache.tomcat.websocket.WsFrameBase.processData(WsFrameBase.java:307)
at org.apache.tomcat.websocket.WsFrameBase.processInputBuffer(WsFrameBase.java:133)
at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:85)
at org.apache.tomcat.websocket.server.WsFrameServer.doOnDataAvailable(WsFrameServer.java:183)
at org.apache.tomcat.websocket.server.WsFrameServer.notifyDataAvailable(WsFrameServer.java:162)
at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.upgradeDispatch(WsHttpUpgradeHandler.java:156)
at org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:60)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:59)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:750)
Best answer by nmutter

Hey,

 

for error 1: From the error messages it looks like the REST request you are sending to TWX cannot be interpreted by TWX, as the body does not contain valid json. The service is not called so adding logging to them won't help. To find the issue:

- First, the one who sends the request will get a 500 Internal server error as a response. So it should not be to hard to notice the call which fails I assume.

- Second option is to check tomcats access log and see which call creates 500 error. So you can pinpoint the service and hopefully find the one who calls it - with invalid parameters

 

Error 2: That may be the case. The browser will make requests with a "old" session - creating the error in TWX. I would say you can ignore the error, as sessions expire here and there and should not cause issues. Only for the user who uses the old session - he won't get new data until relogin.

 

Error 3: May be related to error 2. See https://www.ptc.com/en/support/article/CS364697 

2 replies

24-Ruby III
December 15, 2022

Please specify which version of the program are you using?

twxadmin10-MarbleAuthor
10-Marble
December 15, 2022

I am using Thingworx 9.1.5-b698. 

16-Pearl
December 15, 2022

The question is in which scenario does this error happen?

From the errors we know:

- A user 'dummyuser' tries to send some data to TWX, which is not valid json

- A twx-session has expired

 

To help we need more insights. What is "dummyuser" doing when the error is logged?

twxadmin10-MarbleAuthor
10-Marble
December 17, 2022

Thank you for help.

I am trying to solve error 'Error executing API request message, sending error response to caller!' in application log. While going through error logs I found above errors which might me cause this error. 

For Error 1: - We use Rest API calls which would return output in JSON format (or different format) and ThingWorx service might not be able to parse that. 'dummyuser' would be calling that service. Is there any quick way to find out that service ? or should I put loggers on all services used by 'dummy user' ?

 

For Error 2: Is it possible that Mashup is open on Screen for long time and session got expired due to which this error is coming? I tried terminating all sessions to give fresh start but still this error is present. How to stop this error logs ? browser closing and reopening is not an option for me.

 

I am seeing below error logging every second in security Log. Not sure what's causing this. 

Rejecting NonceKey [224602d1-b498-4a2e-8a56-abcd4b78ae9g] since it was not found in cache

nmutter16-PearlAnswer
16-Pearl
December 18, 2022

Hey,

 

for error 1: From the error messages it looks like the REST request you are sending to TWX cannot be interpreted by TWX, as the body does not contain valid json. The service is not called so adding logging to them won't help. To find the issue:

- First, the one who sends the request will get a 500 Internal server error as a response. So it should not be to hard to notice the call which fails I assume.

- Second option is to check tomcats access log and see which call creates 500 error. So you can pinpoint the service and hopefully find the one who calls it - with invalid parameters

 

Error 2: That may be the case. The browser will make requests with a "old" session - creating the error in TWX. I would say you can ignore the error, as sessions expire here and there and should not cause issues. Only for the user who uses the old session - he won't get new data until relogin.

 

Error 3: May be related to error 2. See https://www.ptc.com/en/support/article/CS364697