cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

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

twxadmin
8-Gravel

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

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)
1 ACCEPTED SOLUTION

Accepted Solutions
nmutter
14-Alexandrite
(To:twxadmin)

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 

View solution in original post

8 REPLIES 8

Please specify which version of the program are you using?

I am using Thingworx 9.1.5-b698. 

nmutter
14-Alexandrite
(To:twxadmin)

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?

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

nmutter
14-Alexandrite
(To:twxadmin)

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 

Thank you @nmutter That was very helpful. 

One final error  I have now is below. It comes randomly and both together. I am feeling its when a Mashup is setup to use GetProperties service with Automatically update values when able a websocket is created between client browser and platform. If I use autorefresh instead of AutoUpdate it seems to work. But I wish to double confirm with you if you have any alternate approch.

 

2022-12-12 01:38:20.630+0000 [L: ERROR] [O: c.t.s.s.e.QueuedEvents] [I: ] [U: SuperUser] [S: ] [P: ] [T: WebSocket background processing] Failed to dispatch event. Invalid Thing In Event Type.Thing:Entity.PersistentSessionf33e9b56-8ea8-4f0b-bc68-19505cb05aa2:Event.DataChange:Property.isConnected:PersistentSessionf33e9b56-8ea8-4f0b-bc68-19505cb05aa2
2022-12-12 01:38:20.630+0000 [L: ERROR] [O: c.t.s.s.e.QueuedEvents] [I: ] [U: SuperUser] [S: ] [P: ] [T: WebSocket background processing] Failed to dispatch event. Invalid Thing In Event Type.Thing:Entity.PersistentSessionf33e9b56-8ea8-4f0b-bc68-19505cb05aa2:Event.AnyDataChange:PersistentSessionf33e9b56-8ea8-4f0b-bc68-19505cb05aa2

slangley
23-Emerald II
(To:twxadmin)

Hi @twxadmin.

 

Is it possible ThingWorx is failing for some reason and you're failing to restart the display?  That would cause the issue with the session.  If so, have you investigated why ThingWorx is failing?

 

Can you provide more details around what is happening to result in this issue? 

 

Regards.

 

--Sharon

nmutter
14-Alexandrite
(To:twxadmin)

It most likely is caused by the "Automatic update" like you mentioned. But I am not sure nor have I an idea how to prevent it.

 

Maybe it is also related to the "known issues": "Mashups using GetProperties with "Automatically update values when able" uses an invalid Session ID after an auto Reconnect is attempted via WebSocket. This result in the flooding of Application, Error, and Communication logs." - https://support.ptc.com/help/thingworx/platform/r9/en/index.html#page/ThingWorx/Help/Release_Notes/FixedIssues/Known_Issues_in_ThingWorx_Platform_9.3.6.html# (also is mentioned in other platform versions.)

But hard to find the cause for such errors - if everything is working like expected I would ignore them. Our logs are (unfortunately) full of errors which are not relevant and hide actual errors...

Top Tags