Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Hi,
I tried to export a Thing, but it did not work. Then I found this error in ErrorLog
2019-04-17 11:50:31.113-0500 [L: ERROR] [O: E.c.t.w.BaseService] [I: ] [U: tranh] [S: ] [T: http-nio-192.168.230.127-443-exec-3] [context: com.thingworx.webservices.context.HttpExecutionContext@6fe900a3][message: No Context associated with current Thread (through reference chain: org.mozilla.javascript.NativeDate["prototype"]->org.mozilla.javascript.NativeDate["ids"])] java.lang.RuntimeException: No Context associated with current Thread Wrapped by: com.fasterxml.jackson.databind.JsonMappingException: No Context associated with current Thread (through reference chain: org.mozilla.javascript.NativeDate["prototype"]->org.mozilla.javascript.NativeDate["ids"]) at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:379) ~[jackson-databind-2.8.1.jar:2.8.1] at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:339) ~[jackson-databind-2.8.1.jar:2.8.1] at com.fasterxml.jackson.databind.ser.std.StdSerializer.wrapAndThrow(StdSerializer.java:343) ~[jackson-databind-2.8.1.jar:2.8.1] at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:698) ~[jackson-databind-2.8.1.jar:2.8.1] at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) ~[jackson-databind-2.8.1.jar:2.8.1] at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:693) ~[jackson-databind-2.8.1.jar:2.8.1] at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:690) ~[jackson-databind-2.8.1.jar:2.8.1] at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) ~[jackson-databind-2.8.1.jar:2.8.1] at com.fasterxml.jackson.databind.SerializerProvider.defaultSerializeValue(SerializerProvider.java:994) ~[jackson-databind-2.8.1.jar:2.8.1] at com.fasterxml.jackson.datatype.jsonorg.JSONObjectSerializer.serializeContents(JSONObjectSerializer.java:89) ~[thingworx-common-7.4.1-b62.jar:na] at com.fasterxml.jackson.datatype.jsonorg.JSONObjectSerializer.serialize(JSONObjectSerializer.java:30) ~[thingworx-common-7.4.1-b62.jar:na] at com.fasterxml.jackson.datatype.jsonorg.JSONObjectSerializer.serializeContents(JSONObjectSerializer.java:69) ~[thingworx-common-7.4.1-b62.jar:na] at com.fasterxml.jackson.datatype.jsonorg.JSONObjectSerializer.serialize(JSONObjectSerializer.java:30) ~[thingworx-common-7.4.1-b62.jar:na] at com.fasterxml.jackson.datatype.jsonorg.JSONObjectSerializer.serializeContents(JSONObjectSerializer.java:69) ~[thingworx-common-7.4.1-b62.jar:na] at com.fasterxml.jackson.datatype.jsonorg.JSONObjectSerializer.serialize(JSONObjectSerializer.java:30) ~[thingworx-common-7.4.1-b62.jar:na] at com.fasterxml.jackson.datatype.jsonorg.JSONObjectSerializer.serializeContents(JSONObjectSerializer.java:69) ~[thingworx-common-7.4.1-b62.jar:na] at com.fasterxml.jackson.datatype.jsonorg.JSONObjectSerializer.serialize(JSONObjectSerializer.java:30) ~[thingworx-common-7.4.1-b62.jar:na] at com.fasterxml.jackson.datatype.jsonorg.JSONObjectSerializer.serialize(JSONObjectSerializer.java:20) ~[thingworx-common-7.4.1-b62.jar:na] at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:292) ~[jackson-databind-2.8.1.jar:2.8.1] at com.fasterxml.jackson.databind.ObjectWriter$Prefetch.serialize(ObjectWriter.java:1419) ~[jackson-databind-2.8.1.jar:2.8.1] at com.fasterxml.jackson.databind.ObjectWriter._configAndWriteValue(ObjectWriter.java:1147) ~[jackson-databind-2.8.1.jar:2.8.1] at com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:993) ~[jackson-databind-2.8.1.jar:2.8.1] at com.thingworx.common.utils.JSONUtilities.writeJSON(JSONUtilities.java:182) ~[thingworx-common-7.4.1-b62.jar:na] at com.thingworx.webservices.BaseService.processJSONOutput(BaseService.java:3427) ~[thingworx-platform-common-7.4.1-b62.jar:na] at com.thingworx.webservices.BaseService.handleRead(BaseService.java:1052) ~[thingworx-platform-common-7.4.1-b62.jar:na] at com.thingworx.webservices.BaseService.service(BaseService.java:304) ~[thingworx-platform-common-7.4.1-b62.jar:na] at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) [servlet-api.jar:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292) [catalina.jar:8.0.44] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [catalina.jar:8.0.44] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-websocket.jar:8.0.44] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [catalina.jar:8.0.44] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [catalina.jar:8.0.44] at org.apache.catalina.filters.CorsFilter.handleNonCORS(CorsFilter.java:436) [catalina.jar:8.0.44] at org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:177) [catalina.jar:8.0.44] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [catalina.jar:8.0.44] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [catalina.jar:8.0.44] at com.thingworx.security.contenttype.ContentTypeFilter.doFilter(ContentTypeFilter.java:109) [thingworx-platform-common-7.4.1-b62.jar:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [catalina.jar:8.0.44] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [catalina.jar:8.0.44] at com.thingworx.security.filter.ValidationFilter.doFilter(ValidationFilter.java:22) [thingworx-platform-common-7.4.1-b62.jar:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [catalina.jar:8.0.44] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [catalina.jar:8.0.44] at com.thingworx.security.authentication.AuthenticationFilter.propagateRequest(AuthenticationFilter.java:436) [thingworx-platform-common-7.4.1-b62.jar:na] at com.thingworx.security.authentication.AuthenticationFilter.doFilter(AuthenticationFilter.java:164) [thingworx-platform-common-7.4.1-b62.jar:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [catalina.jar:8.0.44] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [catalina.jar:8.0.44] at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176) [urlrewritefilter-4.0.4.jar:4.0.4] at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) [urlrewritefilter-4.0.4.jar:4.0.4] at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) [urlrewritefilter-4.0.4.jar:4.0.4] at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:389) [urlrewritefilter-4.0.4.jar:4.0.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [catalina.jar:8.0.44] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [catalina.jar:8.0.44] at com.thingworx.security.filter.ClickjackFilter.doFilter(ClickjackFilter.java:188) [thingworx-platform-common-7.4.1-b62.jar:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [catalina.jar:8.0.44] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [catalina.jar:8.0.44] at com.thingworx.security.filter.ProhibitIfNotLeaderFilter.doFilter(ProhibitIfNotLeaderFilter.java:119) [thingworx-platform-common-7.4.1-b62.jar:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [catalina.jar:8.0.44] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [catalina.jar:8.0.44] at com.thingworx.security.filter.HttpResponseHeadersFilter.doFilter(HttpResponseHeadersFilter.java:52) [thingworx-platform-common-7.4.1-b62.jar:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [catalina.jar:8.0.44] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [catalina.jar:8.0.44] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) [catalina.jar:8.0.44] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94) [catalina.jar:8.0.44] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504) [catalina.jar:8.0.44] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) [catalina.jar:8.0.44] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [catalina.jar:8.0.44] at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620) [catalina.jar:8.0.44] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [catalina.jar:8.0.44] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502) [catalina.jar:8.0.44] at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132) [tomcat-coyote.jar:8.0.44] at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684) [tomcat-coyote.jar:8.0.44] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1533) [tomcat-coyote.jar:8.0.44] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1489) [tomcat-coyote.jar:8.0.44] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_171] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_171] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.0.44] at java.lang.Thread.run(Unknown Source) [na:1.8.0_171]
My Bests,
Hung Tran
Solved! Go to Solution.
Hi Sharon,
The problem is here. The Thing has a JSON property called State
"State":{"value":{"NextSend":{"className":"Date","empty":true,"sealed":false,"ids":[],"prototype":{"className":"Date","empty":true,"sealed":false
No Context associated with current Thread (through reference chain: org.mozilla.javascript.NativeDate["prototype"]->org.mozilla.javascript.NativeDate["ids"])
In a service, there is a code "me.State.NextSend = new Date()" => it should be stored as a JSON date value, but TW did not.
My Bests,
Hung Tran
Hi Sharon,
That version is 7.4.1-b62. The export function was working on the Thing until a scheduler is scheduled to call it every 5 minutes. I guess there is a public property called "ids" in the Entity that stopped the XML serialization process, this property should be hidden from the XML serializer.
Anyway, I could not access the link, may you send the example of platform-settings.json. We also have a Thingworx server running 8.4
My Bests,
Hung Tran
Hi @htran-21.
Here is an example of the platform-settings.json file for your ThingWorx 8.4 instance:
{
"PersistenceProviderPackageConfigs": {
"PostgresPersistenceProviderPackage": {
"ConnectionInformation": {
"jdbcUrl": "jdbc:postgresql://localhost:5432/thingworx",
"password": "twadmin",
"username": "twadmin"
}
}
},
"PlatformSettingsConfig": {
"ExtensionPackageImportPolicy": {
"importEnabled": true,
"allowJarResources": true,
"allowJavascriptResources": true,
"allowCSSResources": true,
"allowJSONResources": true,
"allowWebAppResources": true,
"allowEntities": true,
"allowExtensibleEntities": true
}
}
}
For the export issue on the 7.4.1 instance, is it just the one entity that fails to export?
Regards.
--Sharon
Hi Sharon,
Thank you for the example file.
Yes, it is the only entity "FileRepository" failed to export. It has worked after imported, and only failed to export when a Scheduler calls it. Remarks, the entity is still working, but unable to export.
My Bests,
Hung Tran
Hi @htran-21.
We realize you marked your last post as the Accepted Solution but are confused. You indicated that the problem was caused by ThingWorx not storing the JSON date value correctly. How were you hoping to store this value? String? Number?
What was the solution that you actually found? We want to be sure the community is understanding in case of further questions.
Regards.
--Sharon
Hi Sharon,
At this moment, JSON property would cause the issue if any DateTime value is stored, I changed to store an equivalent number "dateValue.getTime()" of DateTime value instead. In my case, that is
me.State.NextSend = nextSend.getTime()
My Bests,
Hung Tran
Hi @htran-21.
I'll have to research this one. Does it work if you try to export in a different format?
Regards.
--Sharon
Hi Sharon,
The problem is here. The Thing has a JSON property called State
"State":{"value":{"NextSend":{"className":"Date","empty":true,"sealed":false,"ids":[],"prototype":{"className":"Date","empty":true,"sealed":false
No Context associated with current Thread (through reference chain: org.mozilla.javascript.NativeDate["prototype"]->org.mozilla.javascript.NativeDate["ids"])
In a service, there is a code "me.State.NextSend = new Date()" => it should be stored as a JSON date value, but TW did not.
My Bests,
Hung Tran