PTCInc / thingworx-gitbackup-extension

[Unofficial/Not supported] ThingWorx GitBackup Extension for storing your ThingWorx application code in a Git repository
MIT License
25 stars 11 forks source link

push error #17

Closed danielvoilaLEGO closed 3 years ago

danielvoilaLEGO commented 3 years ago

Hello guys,

I manged to set up my Git Thing but on push I receive the below error. On pull everything works great. I tried also with different git repositories but none of them works. PS: the token has rights to do it.

java.lang.ClassCastException: com.thingworx.types.primitives.StringPrimitive cannot be cast to com.thingworx.types.primitives.BooleanPrimitive at gb.GitBackupTemplate.Push(GitBackupTemplate.java:221) at sun.reflect.GeneratedMethodAccessor140.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.thingworx.common.processors.ReflectionProcessor.processService(ReflectionProcessor.java:230) at com.thingworx.handlers.ReflectionServiceHandler.processService(ReflectionServiceHandler.java:50) at com.thingworx.handlers.ServiceHandlerBase.processServiceWithMetrics(ServiceHandlerBase.java:48) at com.thingworx.things.Thing.processServiceRequestDirect(Thing.java:8151) at com.thingworx.things.Thing.processAPIServiceRequest(Thing.java:8088) at com.thingworx.webservices.BaseService.handleInvoke(BaseService.java:3304) 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:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at com.thingworx.security.contenttype.ContentTypeFilter.doFilter(ContentTypeFilter.java:138) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at com.thingworx.security.contenttype.ContentLengthFilter.doFilter(ContentLengthFilter.java:73) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at com.thingworx.security.filter.ValidationFilter.doFilter(ValidationFilter.java:22) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 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:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 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:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at com.thingworx.security.filter.ClickjackFilter.doFilter(ClickjackFilter.java:208) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at com.thingworx.security.filter.HttpResponseHeadersFilter.doFilter(HttpResponseHeadersFilter.java:172) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1589) 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:748)

cbadici commented 3 years ago

Hi, The push operation has been tested and it works. I would like to know more details about your scenario and how you configured your Git Backup Thing: -Are you trying to push some files to an empty Git repository or to a repository where you already have some files? If you already have some files in the repository, you first need to pull them in thingworx...add your additional/modified files and then push it. -What repository path are you using in your ThingWorx repository ? Try using a path like "/myproject" instead of the root path of the ThingWorx repository -Have you tested the Push operation in the Mashup or also by executing the service in the Git Backup Thing?

danielvoilaLEGO commented 3 years ago

Hi, The push operation has been tested and it works. I would like to know more details about your scenario and how you configured your Git Backup Thing: -Are you trying to push some files to an empty Git repository or to a repository where you already have some files? If you already have some files in the repository, you first need to pull them in thingworx...add your additional/modified files and then push it. -What repository path are you using in your ThingWorx repository ? Try using a path like "/myproject" instead of the root path of the ThingWorx repository -Have you tested the Push operation in the Mashup or also by executing the service in the Git Backup Thing?

  1. I already have some files on the git. I did the pull first, and the pull works fine.
  2. I am already using a path like /entities instead of root path
  3. I tested Push operation in the Mashup but also in the Git Backup Thing. - same error
cbadici commented 3 years ago

Thanks for sharing the information. One additional questions: are you using the latest Git extension on ThingWorx 9+ ? Please also share the version of the extension that you are using.

The error you provided can appear if the UserExtensions thing shape has not been initialized correctly. It is supposed to be initialized when you first open the Git Main Mashup. If you edit any user inside the Composer, can you let me know if it has the property "UseGitCommitUserValues" in the User Extensions?

danielvoilaLEGO commented 3 years ago

Thanks for sharing the information. One additional questions: are you using the latest Git extension on ThingWorx 9+ ? Please also share the version of the extension that you are using.

The error you provided can appear if the UserExtensions thing shape has not been initialized correctly. It is supposed to be initialized when you first open the Git Main Mashup. If you edit any user inside the Composer, can you let me know if it has the property "UseGitCommitUserValues" in the User Extensions?

  1. Yes, I am using the latest Git Extension, version 4.1.0.

  2. I am not that expert in TWX. Maybe you can give me more details how can I do this?

cbadici commented 3 years ago

In the ThingWorx Composer, click on Browse, click on Users and then select a User. Go to the UserExtensions tab and verify the list of properties displayed. There should be a property called "UseGitCommitUserValues" I have attached a screenshot.

Also, I will close this issue since it doesn't represent a bug and the push operation has been verified and works as expected. If you have further questions about how to use the Git extension, you can contact me by e-mail, which is displayed in my profile. image