Hi Community
I have created custom transformer which transforms file with "application/ply" mimetype to "application/sla". The context file which I have created is
<beans>
<bean id="transformer.worker.ply2stl"
class="org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerWorker">
<property name="mimetypeService">
<ref bean="mimetypeService" />
</property>
<property name="checkCommand">
<bean name="transformer.ply2stl.checkCommand" class="org.alfresco.util.exec.RuntimeExec">
<property name="commandsAndArguments">
<map>
<entry key="Linux.*">
<list>
<value>sh</value>
<value>-c</value>
<value>${ply2stl.root}/meshconv</value>
</list>
</entry>
<entry key="Windows.*">
<list>
<value>cmd</value>
<value>/C</value>
<value>${ply2stl.root}/meshconv C:\Users\vpatel\Desktop\airplane.ply -c stl -tri -o C:\Users\vpatel\Desktop\airplane</value>
</list>
</entry>
</map>
</property>
</bean>
</property>
<property name="transformCommand">
<bean name="transformer.ply2stl.Command" class="org.alfresco.util.exec.RuntimeExec">
<property name="commandsAndArguments">
<map>
<entry key="Linux.*">
<list>
<value>sh</value>
<value>-c</value>
<value>${ply2stl.root}/meshconv ${source} -c stl -tri -o ${target}</value>
</list>
</entry>
<entry key=".*">
<list>
<value>cmd</value>
<value>/C</value>
<value>${ply2stl.root}/meshconv ${source} -c stl -tri -o ${target}</value>
</list>
</entry>
</map>
</property>
<property name="waitForCompletion">
<value>true</value>
</property>
</bean>
</property>
</bean>
<bean id="transformer.ply2stl"
class="org.alfresco.repo.content.transform.ProxyContentTransformer"
parent="baseContentTransformer">
<property name="worker">
<ref bean="transformer.worker.ply2stl" />
</property>
</bean>
</beans>
I have also registered both "application/ply" , "application/sla" mime types.
And also defined following properties in alfresco-global.properties file
ply2stl.root = D:/3dConverter
content.transformer.ply2stl.priority=110
content.transformer.ply2stl.extensions.ply.stl.supported=true
content.transformer.ply2stl.extensions.ply.stl.priority=50
But on performing transformation of file with mime type "application/ply" to "application/sla", I am getting a following error
2017-01-09 15:05:54,410 ERROR [extensions.webscripts.AbstractRuntime] [http-apr-8080-exec-8] Exception from executeScript: 00090035 Transformation of (airplane.ply) has not taken place because the declared mimetype (application/ply) does not match the detected mimetype (text/plain).
org.alfresco.repo.content.transform.UnsupportedTransformationException: 00090035 Transformation of (airplane.ply) has not taken place because the declared mimetype (application/ply) does not match the detected mimetype (text/plain).
at org.alfresco.repo.content.transform.AbstractContentTransformer2.strictMimetypeCheck(AbstractContentTransformer2.java:457)
at org.alfresco.repo.content.transform.AbstractContentTransformer2.transform(AbstractContentTransformer2.java:255)
at org.alfresco.repo.content.ContentServiceImpl.transform(ContentServiceImpl.java:615)
at sun.reflect.GeneratedMethodAccessor634.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:80)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.model.ml.MLContentInterceptor.invoke(MLContentInterceptor.java:136)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:53)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:166)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy51.transform(Unknown Source)
at org.alfresco.repo.action.executer.TransformActionExecuter.doTransform(TransformActionExecuter.java:329)
at org.alfresco.repo.action.executer.TransformActionExecuter.executeImpl(TransformActionExecuter.java:296)
at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:274)
at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:846)
at org.alfresco.repo.action.executer.CompositeActionExecuter.executeImpl(CompositeActionExecuter.java:73)
at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:274)
at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:846)
at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:747)
at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:41)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:53)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:166)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy43.executeAction(Unknown Source)
at org.alfresco.repo.rule.RuleServiceImpl.executeAction(RuleServiceImpl.java:1278)
at org.alfresco.repo.rule.RuleServiceImpl.executeRule(RuleServiceImpl.java:1272)
at org.alfresco.repo.rule.RuleServiceImpl.executePendingRuleImpl(RuleServiceImpl.java:1218)
at org.alfresco.repo.rule.RuleServiceImpl.executePendingRule(RuleServiceImpl.java:1161)
at org.alfresco.repo.rule.RuleServiceImpl.executePendingRulesImpl(RuleServiceImpl.java:1127)
at org.alfresco.repo.rule.RuleServiceImpl.executePendingRules(RuleServiceImpl.java:1100)
at org.alfresco.repo.rule.RuleTransactionListener.beforeCommit(RuleTransactionListener.java:64)
at org.alfresco.util.transaction.TransactionSupportUtil$TransactionSynchronizationImpl.doBeforeCommit(TransactionSupportUtil.java:535)
at org.alfresco.util.transaction.TransactionSupportUtil$TransactionSynchronizationImpl.doBeforeCommit(TransactionSupportUtil.java:514)
at org.alfresco.util.transaction.TransactionSupportUtil$TransactionSynchronizationImpl.beforeCommit(TransactionSupportUtil.java:479)
at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerBeforeCommit(TransactionSynchronizationUtils.java:95)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:925)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:738)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:724)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:475)
at org.alfresco.util.transaction.SpringAwareUserTransaction.commit(SpringAwareUserTransaction.java:482)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:486)
at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:587)
at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:656)
at org.alfresco.repo.web.scripts.RepositoryContainer.executeScriptInternal(RepositoryContainer.java:428)
at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:308)
at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:399)
at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:210)
at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:132)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:209)
at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:244)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.alfresco.module.aosmodule.service.ContextRootFilter.doFilter(ContextRootFilter.java:93)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2466)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2455)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Any help would be appreciated.
Solved! Go to Solution.
Transformers do an extra validation on the actual content stream type against the declared mime-type.
In your particular case you may find useful the property transformer.strict.mimetype.check in repository.properties.
You can disable the strict checking by adding this property with the value false in alfresco-global properties.
Or as the comments around the transformer.strict.mimetype.check property state, you could try adding your pair of declared and detected mimetype (text/plain), to the whitelist in transformers.properties (can be changed via JMX as well).
Transformers do an extra validation on the actual content stream type against the declared mime-type.
In your particular case you may find useful the property transformer.strict.mimetype.check in repository.properties.
You can disable the strict checking by adding this property with the value false in alfresco-global properties.
Or as the comments around the transformer.strict.mimetype.check property state, you could try adding your pair of declared and detected mimetype (text/plain), to the whitelist in transformers.properties (can be changed via JMX as well).
Thank you Ancuta Morarasu,
It worked for me. I have an STL previewer which can preview the file with mime type "application/sla" in alfresco. So I want to render the file with the mime type "application/ply" as "application/sla". For this, I have created a rule on a folder with the following script
var renderingEngineName = 'reformat';
var renditionDefinitionName = 'cm:content.stl';
var renditionDef = renditionService.createRenditionDefinition(renditionDefinitionName, renderingEngineName);
renditionDef.parameters['mime-type'] = 'application/sla';
renditionService.render(document, renditionDef);
And I am also able to see rendition child in node browser as given in a below image
But still, I am not able to get a preview of the files with mime type "application/pla".
I would be great if you can help me with this also
I recommend turning on the debug for Transformations, to see what transformations are done for preview:
log4j.logger.org.alfresco.repo.content.transform.TransformerDebug=DEBUG log4j.logger.org.alfresco.repo.content.transform=DEBUG
Sample code for adding custom transformations custom-content-transformer-repo · GitHub, if you didn't follow it already .
It looks like the rendition is generated, but setting a custom previewer requires extra configurations and tweaking.
If you haven't done something similar, this blog details how to set a previewer in Share Custom Previews in Alfresco Share - Parashift.
If you have already set the previewer, please provide more info from the logs.
I hope this helps.
Ancuta
I assume that airplane.ply is a document in the repository. If this is the case, check what the mimetype is of that document as stored in the repository (you may need to use the node browser in admin tools to do this). Note please this is checking what Alfresco thinks it is and not what the document actually is. I suspect you will find its beleived to be text/plain not application/ply.
Check that you declared the file extensions as indicating the desired mimetypes (e.g .ply == application/ply, .sla == application/sla).
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.