Problema: Generar Jasper Report con Javascript y FTL

cancel
Showing results for 
Search instead for 
Did you mean: 
mas106
Member II

Problema: Generar Jasper Report con Javascript y FTL

Buenas,

Estoy intentando generar un reporte en alfresco 3.2 con Jasper Report, basándome para ello en el ejemplo que hay en http://code.google.com/p/alfresco-generate-reports-with-jasperreports/ (Server-side javascript service to generate Jasper report from XML data-source which is generated by FTL¶)

Sin modiifcar nada e intentando correr el ejemplo que viene ahí estoy teniendo el siguiente error:

2012-01-03 19:36:03,365 INFO  [STDOUT] 19:36:03,364 User:admin ERROR [ui.common.Utils] Failed to run Actions due to error: 00030014 Failed to execute script 'workspace://SpacesStore/8b3b3130-1800-4746-acd7-fa731b48ed69': 00030013 org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
org.alfresco.scripts.ScriptException: 00030014 Failed to execute script 'workspace://SpacesStore/8b3b3130-1800-4746-acd7-fa731b48ed69': 00030013 org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
   at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:228)
   at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:187)
   at sun.reflect.GeneratedMethodAccessor1204.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:40)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.alfresco.repo.audit.AuditComponentImpl.auditImpl(AuditComponentImpl.java:301)
   at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:229)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy257.executeScript(Unknown Source)
   at org.alfresco.repo.action.executer.ScriptActionExecuter.executeImpl(ScriptActionExecuter.java:170)
   at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:127)
   at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:711)
   at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:648)
   at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:510)
   at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:498)
   at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:719)
   at sun.reflect.GeneratedMethodAccessor1201.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:40)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.alfresco.repo.audit.AuditComponentImpl.auditImpl(AuditComponentImpl.java:301)
   at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:229)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy80.executeAction(Unknown Source)
   at org.alfresco.web.bean.actions.RunActionWizard.finishImpl(RunActionWizard.java:101)
   at org.alfresco.web.bean.dialog.BaseDialogBean$1.execute(BaseDialogBean.java:124)
   at org.alfresco.web.bean.dialog.BaseDialogBean$1.execute(BaseDialogBean.java:121)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:326)
   at org.alfresco.web.bean.dialog.BaseDialogBean.finish(BaseDialogBean.java:130)
   at org.alfresco.web.bean.wizard.WizardManager.finish(WizardManager.java:599)
   at sun.reflect.GeneratedMethodAccessor1253.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:132)
   at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:61)
   at javax.faces.component.UICommand.broadcast(UICommand.java:109)
   at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
   at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
   at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
   at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
   at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:110)
   at sun.reflect.GeneratedMethodAccessor546.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:122)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy244.doFilter(Unknown Source)
   at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:88)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.java:74)
   at sun.reflect.GeneratedMethodAccessor546.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:122)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy244.doFilter(Unknown Source)
   at org.alfresco.repo.web.filte
2012-01-03 19:36:03,366 INFO  [STDOUT] r.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:88)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
   at java.lang.Thread.run(Thread.java:662)
Caused by: org.alfresco.error.AlfrescoRuntimeException: 00030013 org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
   at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:465)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:224)
   … 102 more
Caused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
   at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:272)
   at org.codehaus.groovy.control.CompilationUnit$5.call(CompilationUnit.java:564)
   at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:822)
   at org.codehaus.groovy.control.CompilationUnit.classgen(CompilationUnit.java:525)
   at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:432)
   at net.sf.jasperreports.compilers.JRGroovyCompiler.compileUnits(JRGroovyCompiler.java:97)
   at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:188)
   at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:215)
   at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:201)
   at hr.chus.jasperreports.javascript.extenstions.JasperReportsHelper.generateXMLDataSourceReport(JasperReportsHelper.java:55)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161)
   at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:247)
   at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:86)
   at org.mozilla.javascript.gen.c27._c0(workspace://SpacesStore/8b3b3130-1800-4746-acd7-fa731b48ed69:40)
   at org.mozilla.javascript.gen.c27.call(workspace://SpacesStore/8b3b3130-1800-4746-acd7-fa731b48ed69)
   at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
   at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
   at org.mozilla.javascript.gen.c27.call(workspace://SpacesStore/8b3b3130-1800-4746-acd7-fa731b48ed69)
   at org.mozilla.javascript.gen.c27.exec(workspace://SpacesStore/8b3b3130-1800-4746-acd7-fa731b48ed69)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:449)
   … 103 more

El problema lo está teniendo en la línea que intenta generar el archivo:
var generatedReportNodeRef= jasperReportsHelper.generateXMLDataSourceReport( xmlDataSourceString, query, jrxml.nodeRef, reports.nodeRef, "pdf");

He tirado algunos logs de las variables que le pasa al método de la clase JasperReportsHelper y estos son los valores:


query:           "/items/*"
jrxml.nodeRef:   "workspace://SpacesStore/10ed9ac3-c12e-431f-b71b-f1fb2daada11"
reports.nodeRef: "workspace://SpacesStore/d5e5a3ad-4240-4639-b6e6-62c52dbe7dc4Reporte"
xmlDataSourceString:
"<items>
   <item>
       <name>Email Actions</name>
       <creator>System</creator>
       <created>10-12-2011 13:04</created>
       <description>Email Actions</description>
       <docs>0</docs>
   </item>
   <item>
       <name>Email Templates</name>
       <creator>System</creator>
       <created>10-12-2011 13:02</created>
       <description>Email templates</description>
       <docs>3</docs>
   </item>
   <item>
       <name>Imap Configs</name>
       <creator>System</creator>
       <created>10-12-2011 13:04</created>
       <description>Imap Configs</description>
       <docs>2</docs>
   </item>
   <item>
       <name>Messages</name>
       <creator>System</creator>
       <created>10-12-2011 13:03</created>
       <description>Customized Messages</description>
       <docs>0</docs>
   </item>
   <item>
       <name>Models</name>
       <creator>admin</creator>
       <created>06-09-2007 06:00</created>
       <description>Customized Models</description>
       <docs>0</docs>
   </item>
   <item>
       <name>Presentation Templates</name>
       <creator>System</creator>
       <created>10-12-2011 13:02</created>
       <description>Presentation templates</description>
       <docs>13</docs>
   </item>
   <item>
       <name>RSS Templates</name>
       <creator>System</creator>
       <created>10-12-2011 13:02</created>
       <description>RSS templates</description>
       <docs>1</docs>
   </item>
   <item>
       <name>Saved Searches</name>
       <creator>System</creator>
       <created>10-12-2011 13:02</created>
       <description>Saved Searches</description>
       <docs>0</docs>
   </item>
   <item>
       <name>Scripts</name>
       <creator>System</creator>
       <created>10-12-2011 13:02</created>
       <description>JavaScript files</description>
       <docs>15</docs>
   </item>
   <item>
       <name>Space Templates</name>
       <creator>System</creator>
       <created>10-12-2011 13:02</created>
       <description>Space folder templates</description>
       <docs>1</docs>
   </item>
   <item>
       <name>Web Client Extension</name>
       <creator>System</creator>
       <created>10-12-2011 13:03</created>
       <description>Customized Web Client</description>
       <docs>0</docs>
   </item>
   <item>
       <name>Web Forms</name>
       <creator>System</creator>
       <created>10-12-2011 13:06</created>
       <description>Web Content Forms</description>
       <docs>0</docs>
   </item>
   <item>
       <name>Web Scripts</name>
       <creator>System</creator>
       <created>10-12-2011 13:03</created>
       <description>URL addressable Web Services</description>
       <docs>22</docs>
   </item>
   <item>
       <name>Web Scripts Extensions</name>
       <creator>System</creator>
       <created>10-12-2011 13:03</created>
       <description>Customized Web Scripts</description>
       <docs>1</docs>
   </item>
   <item>
       <name>Workflow Definitions</name>
       <creator>admin</creator>
       <created>11-09-2007 12:45</created>
       <description>Customized Workflow Process Definitions</description>
       <docs>4</docs>
   </item>
</items>"


Desde ya muchaas gracias.
Saludos.
4 Replies
mas106
Member II

Re: Problema: Generar Jasper Report con Javascript y FTL

  Please correct the errors below then click Finish. •Failed to run Actions due to error: 00030016 Failed to execute script 'workspace://SpacesStore/8b3b3130-1800-4746-acd7-fa731b48ed69': 00030015 org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V

Les paso el msj que me da en la pantalla de alfresco al ejecutar el script.

Cualquier ayuda se los agradecería.
Saludos.
mas106
Member II

Re: Problema: Generar Jasper Report con Javascript y FTL

Buenas,

Os comento que he borrado el jar cglib-nodep-2.2_beta1.jar y he agregado el asm.jar y no me ha tirado mas el error ante-dicho.

Ahora bien, cuando intento ejecutar ahora el reporte me genera un pdf en la carpeta TestAlfrescoJasperReport con un pdf que menciona lo siguiente:

The node's content is missing: 
   node: workspace://SpacesStore/2fcbb8a9-2ee4-4da3-b280-ba80644304bf
   reader: null 
Please contact your system administrator.

Estoy usando la version 3.2 de alfresco.
cualquier ayuda será de utilidad.

un saludo,

mas106
mas106
Member II

Re: Problema: Generar Jasper Report con Javascript y FTL

Buenas,
Les comento que finalmente me anduvo el ejemplo.
Funcionó el alfresco 4.0b en linux simplemente quitando la librería groovy-1.7.5.jar que venía en la carpeta de tomcat y poniendo entre todas las librerias requeridas por el proyecto alfresco jasper el jar groovy-all-1.7.5.jar
Saludos.
gabri124
Member II

Re: Problema: Generar Jasper Report con Javascript y FTL

Hola yo estoy intentando ejecutar el mismo ejemplo y me sale el siguiente error en el navegador una vez que lo confeccioné en hacerlo por webscript

<message>02160002 Wrapped Exception (with status template): 02160040 Failed to execute script '/generateReport.get.js (in repository store workspace://SpacesStore/Espacio de empresa/Diccionario de datos/Extensiones de Web Scripts)': 02160039 Error E-S durante el procesamiento de la plantilla '<#macro countDocs node depth>


Ya he probado de todo, lo estoy probando en un alfresco 3.4 enterprise o incluso en el 3.4 c de la community.

Alguien ha conseguido hacer funcionar el ejemplo que no sea en la 4.0 claro Smiley Happy