Error reading app definition zip file (with accents chars)

cancel
Showing results for 
Search instead for 
Did you mean: 
oathmind
Active Member

Error reading app definition zip file (with accents chars)

Jump to solution

Hi,


I’m trying ti export and import an app with the casuistic that it has an accent on one or more file names (for example, the name of one process).


If I export and import the file directly there is no problem, but if I unzip the file and zip it again (because I need to modify some data from inside), then when I try to upload the file I get this error:

08:53:55,516 [http-nio-8080-exec-4] ERROR com.activiti.service.editor.AlfrescoAppDefinitionService - Error reading app definition zip file
java.lang.IllegalArgumentException: MALFORMED
at java.util.zip.ZipCoder.toString(ZipCoder.java:58)
at java.util.zip.ZipInputStream.readLOC(ZipInputStream.java:300)
at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:122)
at com.activiti.service.editor.AlfrescoAppDefinitionService.readZipFile(AlfrescoAppDefinitionService.java:1253)
at com.activiti.service.editor.AlfrescoAppDefinitionService.importAppDefinition(AlfrescoAppDefinitionService.java:573)
at com.activiti.service.editor.AlfrescoAppDefinitionService.importAppDefinition(AlfrescoAppDefinitionService.java:340)
at com.activiti.rest.editor.AppDefinitionResource.importAppDefinition(AppDefinitionResource.java:120)
at com.activiti.rest.editor.AppDefinitionResource$$FastClassBySpringCGLIB$$892c67d9.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:68)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at com.ryantenney.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java:48)
at com.ryantenney.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java:34)
at com.ryantenney.metrics.spring.AbstractMetricMethodInterceptor.invoke(AbstractMetricMethodInterceptor.java:59)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)
at com.activiti.rest.editor.AppDefinitionResource$$EnhancerBySpringCGLIB$$6ece7d46.importAppDefinition(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:97)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:149)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:168)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:205)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at com.activiti.security.CustomStatelessCSRFFilter.doFilterInternal(CustomStatelessCSRFFilter.java:68)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:670)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)


Steps to reproduce:
1) Create a process with accent in the name (like.. "Acción nueva")
2) Create an app and include the process
3) Export the app
4) Unzip the file
5) Zip it again
6) Try to import the app

Extra info: If I remove manually the accents of all filename the import works properly


Environment:
Windows 10
Apache tomcat (with -Dfile.encoding=UTF-8 JVM param)
Activiti 1.5.3 (and 1.5.2)
DB: H2 or PostgreSQL (UTF-8)

Thanks

1 Solution

Accepted Solutions
cjose
Senior Member II

Re: Error reading app definition zip file (with accents chars)

Jump to solution

Hi Joel,

Having read your other question at https://community.alfresco.com/message/805684-problem-with-character-encoding-when-uploading-an-app, this looks like a character encoding issue to me. Are you using the default windows zip function to create the zip archive?

Quite a lot of Activiti users follow this approach of saving the models from activiti-app in a source control like github, svn etc. I normally use maven-assembly-plugin to re-create the app.zip and this approach allows me to keep the java components(delegates, listeners etc) along with the process components (process, form, dmn, stencils etc) in one single project. I have created a sample project structure on github (activiti-examples/activiti-project-structure at master · cijujoseph/activiti-examples · GitHub ). "mvn clean package" (you can also use "-Dfile.encoding=UTF-8" option if any encoding issues) on this project creates two components (app.jar & app.zip) in the target folder. This approach would also allow you to integrate your project with a CI/CD framework and allow you to version and store the artifacts in an artifact repository such as Artifactory, Nexus etc. The app.zip can be deployed either using the deployment REST APIs or can be deployed manually via activiti-app/activiti-admin apps. The app.jar file can be deployed to the lib folder!

Checkout the pom.xml and assembly.xml for more details on project configuration. Hope this helps!

Regards,

Ciju

View solution in original post

10 Replies
thuynh
Established Member II

Re: Error reading app definition zip file (with accents chars)

Jump to solution

Hi Joel,

"Unzipping the export archive and zipping it back again" does not sound like a right approach to me. 

What is the change that you need to make to the archive that you can't do from the activiti-app tool? 

I would highly recommend to do all the settings of the app archive from the Apps tool within the activiti-app webapp. 

Thanks,

Thong Huynh

oathmind
Active Member

Re: Error reading app definition zip file (with accents chars)

Jump to solution

Hi Thong thanks for replying,


Actually we are starting to study making processes with activiti app. We are very happy with the solution but we didn't find a good way to teamwork because all related with java delegates/beans etc... it's easy, we create a maven project ant put it in GIT but we don't know how to make a good teamwork with all processes/forms/decsion tables... because we cannot put it in "code", we try eclipse designer but comparing with activiti-app doesn't have a lot of features, in addition activiti-app have forms.

For that reason we think to create proceses and forms with activiti-app and download all containet in app and put the content of this app in GIT. so people can download, deploy in his development envoiroment and later export again and commit. For that reaseon we need to unzip, to commit just the modified file, not all zip.

As i say, we are starting so if there is another way to make a good teamwork... I will be happy to hear.

thuynh
Established Member II

Re: Error reading app definition zip file (with accents chars)

Jump to solution

Hi Joel,

The archive to be imported back to activiti-app or activiti-admin needs to be properly formed. One way to ensure well-formed archive during the implementation phase is to use the export and import features.

From activiti-app or activiti-admin, you can download the app as instructed here Alfresco Activiti . This will give you the bpmn process xml to be used within your Eclipse Activiti designer. 

From Activiti designer (Eclipse plugin), you can export the project by right click on project and choose 'Create deployment artifacts'. This will create a BAR file such as myprocessapp.bar under directory 'deployment' within the workspace. Then you can use the BAR file to import back to activiti-app.

Let me know if this helps.

Thanks

Thong Huynh

bp3‌

cjose
Senior Member II

Re: Error reading app definition zip file (with accents chars)

Jump to solution

Hi Joel,

Having read your other question at https://community.alfresco.com/message/805684-problem-with-character-encoding-when-uploading-an-app, this looks like a character encoding issue to me. Are you using the default windows zip function to create the zip archive?

Quite a lot of Activiti users follow this approach of saving the models from activiti-app in a source control like github, svn etc. I normally use maven-assembly-plugin to re-create the app.zip and this approach allows me to keep the java components(delegates, listeners etc) along with the process components (process, form, dmn, stencils etc) in one single project. I have created a sample project structure on github (activiti-examples/activiti-project-structure at master · cijujoseph/activiti-examples · GitHub ). "mvn clean package" (you can also use "-Dfile.encoding=UTF-8" option if any encoding issues) on this project creates two components (app.jar & app.zip) in the target folder. This approach would also allow you to integrate your project with a CI/CD framework and allow you to version and store the artifacts in an artifact repository such as Artifactory, Nexus etc. The app.zip can be deployed either using the deployment REST APIs or can be deployed manually via activiti-app/activiti-admin apps. The app.jar file can be deployed to the lib folder!

Checkout the pom.xml and assembly.xml for more details on project configuration. Hope this helps!

Regards,

Ciju

thuynh
Established Member II

Re: Error reading app definition zip file (with accents chars)

Jump to solution

Hi Ciju,

Your answer to use maven-assembly-plugin is perfect. I think it would be great if it is documented in the official documentation. 

Thanks,

Thong Huynh

oathmind
Active Member

Re: Error reading app definition zip file (with accents chars)

Jump to solution

Thanks for this information is very useful. Smiley Happy

Now i will go to try it and as Thong says, this can be interesting to add to the documentation.

cjose
Senior Member II

Re: Error reading app definition zip file (with accents chars)

Jump to solution

Glad to know that this worked. Regarding the product documentation, I'll feed this request back to the product team. I am sure there are many ways of doing this and the above is just one of them!

Cheers,

Ciju

oathmind
Active Member

Re: Error reading app definition zip file (with accents chars)

Jump to solution

Hi again,
I was trying the structure you create and it’s Works good generating the jar and the zip.
But I see two problems:


First of all I continue having the issue uploading the zip if any of the files contains a accents on the name, I try to run maven with -Dfile.encoding=UTF-8 but nothing new.

And second, continuing with the discussion about how to work in team, if I need for example to modify some field of a form, I generate the zip, upload to an activiti, edit the form and download it again... the problem is the internal ID of the models change, for example if I do this with your example, I upload the zip and edit the process with filename: “activiti-project-structure-68”, When I download it again the name change to “activiti-project-structure-33032”.


So it difficult a lot the maintain of git. Also with this model is impossible to have two persons editing two different forms at the same time, because then will be very difficult to merge the changes.


Finally I cannot see where the eclipse designer plugin can help in all of this, because the plugin don’t support alfresco activiti forms, decision tables, etc… or maybe the eclipse plugin is just for activiti framework, not "alfresco activiti"?


Maybe we can open a new discussion to debate the best way to work, because is not the topic here

cjose
Senior Member II

Re: Error reading app definition zip file (with accents chars)

Jump to solution

Hi Joel,

Have you tried the encoding property which is currently commented out in the pom.xml at activiti-examples/pom.xml at master · cijujoseph/activiti-examples · GitHub  "<archiverConfig><encoding>UTF-8</encoding></archiverConfig>". That should do the trick!

Regarding your second point: I agree, there is no model edit support in eclipse. The eclipse plugin is purely to edit/view the bpmn xml. However bpmn xml in an app.zip is not really used when you do an import. It is there in the app.zip for you to write unit tests against it so that every time you do an export and save it to your git/svn, you can make sure that the change is not breaking any of your tests.

Regarding the manual file name changes and re-import, there are a few things to note:

When you import my model to your environment for the first time, the file name changes because "33032" is the new id that it created in your database. However if you re-import the model again on top of it, the number doesn't change. Second time onwards, it is smart enough to maintain the same number. However make sure that you are importing my going to "Apps"->"Your App Name"-> "Import App" instead of "Apps"->"Import App"

Regards,

Ciju