bhushan_makade Posted July 7, 2010 Share Posted July 7, 2010 Hi,I am using JasperSever 3.5 version and using webservices APIs to schedule the reports from my Application.Most of the time , it works fine and i get the Report in specific format as an Email Attachment.But, if for any unforseen reason , any exception occurs during the "report execution" of schduled job...still the email gets triggered and it contains the text file with error stack trace.My problem is, these reports are directly going to the clients, so i dont want exception file go to clients. So, please let me know if there is any feature/property in JasperServer where i can specify email address for receiving the errornous reports.or any workaround for redirecting the errornous reports to any other email id. or is this scenario unrealistic?Any help will be appreciated .....Thanks in advance... Link to comment Share on other sites More sharing options...
vtsukur Posted July 8, 2010 Share Posted July 8, 2010 Hi,Can you please post exception [stack trace] you receive in email notifications? Link to comment Share on other sites More sharing options...
bhushan_makade Posted July 8, 2010 Author Share Posted July 8, 2010 This is just one example where i am getting the error file as well as the report.but there may be other scenarios as well ..like... the generated file name already exists in the specific folder of scheduled reportsand i have not put "overwrite" option to true.....it will throw exception at run time after report generation.....so i will get that exception in file as attachement....can this be handled through code?...did anyone ever faced such issues?.....as far as code is concerned ..the API which i am using look pretty straightforward.....i am just building the "JobMailNotification " object and setting it in "Job" object ....This is a killer issue....Code:com.jaspersoft.jasperserver.api.JSExceptionWrapper: org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException: Object of class [com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.persistent.ContentRepoFileResource] with identifier [4557]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.persistent.ContentRepoFileResource#4557]Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.persistent.ContentRepoFileResource#4557] at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1714) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2357) at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2257) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2557) at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:92) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000) at org.springframework.orm.hibernate3.HibernateTemplate$27.doInHibernate(HibernateTemplate.java:806) at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367) at org.springframework.orm.hibernate3.HibernateTemplate.flush(HibernateTemplate.java:804) at com.jaspersoft.jasperserver.api.metadata.common.service.impl.HibernateDaoImpl.executeWriteCallback(HibernateDaoImpl.java:78) at com.jaspersoft.jasperserver.api.metadata.common.service.impl.HibernateDaoImpl.executeWriteCallback(HibernateDaoImpl.java:67) at com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.HibernateRepositoryServiceImpl.saveResource(HibernateRepositoryServiceImpl.java:330) at sun.reflect.GeneratedMethodAccessor1357.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:618) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154) at org.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:66) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210) at $Proxy18.saveResource(Unknown Source) at com.jaspersoft.jasperserver.multipleTenancy.PathTransformationRepositoryService.saveResource(PathTransformationRepositoryService.java:445) at sun.reflect.GeneratedMethodAccessor1357.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:618) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210) at $Proxy18.saveResource(Unknown Source) at com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJob.saveToRepository(ReportExecutionJob.java:862) at com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJob.saveToRepository(ReportExecutionJob.java:516) at com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJob.executeAndSendReport(ReportExecutionJob.java:383) at com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJob.execute(ReportExecutionJob.java:188) at org.quartz.core.JobRunShell.run(JobRunShell.java:195) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520) Link to comment Share on other sites More sharing options...
lucianc Posted July 8, 2010 Share Posted July 8, 2010 Regarding the error that you posted: Do you have multiple JS instances (such as nodes in a cluster) that connect to the same metadata database? There's a known bug that occurs when two different JS instances attempt to save the same resource at the same time - one of them might fail with HibernateOptimisticLockingFailureException. I don't think there is any workaround at the moment for the bug other than avoiding to define jobs that have the same output file.As about your original question, there's no configuration in JS to specify whether to include the exception in the mail, or to send those mails to someone other than the recipients defined in the job. If you're willing to customize JasperServer, look into the ReportExecutionJob class.Regards,Lucian Link to comment Share on other sites More sharing options...
bhushan_makade Posted July 11, 2010 Author Share Posted July 11, 2010 Hi Lucian,Thanks a lot for your suggestion. We have implemented the logic in "ReportExecutionJob " class such that ,in case of exception, it will read the "exception email address" from the properties file and send the error attachment fileto that email address instead actual "toAddress".But, we are still worried about the fact that our JasperServer application is deployed in clustered environment.And just you mentioned , we have two instances of jasperserver pointing to the same metadata database.So, its creating concurrency issues when multiple reports are scheduled at the same time.So we are looking for the workaround for this problem.We are thinking of implementing "FOR UPDATE SKIP LOCKED" property of oracle. Please let us know if this is the right direction. Also, if you have any suggestion in this regards, like which files in source codes need to be modified , it would be of great help..Thanks in advance..regards,bhushan Link to comment Share on other sites More sharing options...
lucianc Posted July 13, 2010 Share Posted July 13, 2010 You're right that the solution to the problem would use DB locking. But I don't think that would be easy to achieve. You can take a look at HibernateRepositoryServiceImpl which handles all resource repository access.Regards,Lucian Link to comment Share on other sites More sharing options...
soulpatrol_212 Posted August 12, 2011 Share Posted August 12, 2011 Hi Bhushan,I am having the same problem as yours. I am getting exception attachments in the mail. Can you provide the steps that you did to customize the 'ReportExecutionJob' to prevent exception in mail.I am having tough time finding the solution for this problem.Regards,SP Link to comment Share on other sites More sharing options...
bhushan_makade Posted August 12, 2011 Author Share Posted August 12, 2011 Hi,I am sorry but i don't have that file which I changed with me. But, I vaguely remember the steps.Its not that difficult. I hope you can make it work with this.Following are the step:1) There is one .properties(sorry..dont remember the file name) file in source code where we specify the "From Email address". Add one more entry therefor ex error.report.email.address=xxx@gmail.com2) There is one configuration XML(sorry..dont remember the file name) file where this key error.report.email.address is refered. This key is mapped with some string constant which in turn is being used in "ReportExecutionJob.java".3) So, once you get hold of the email address which you want to send the error reports in ReportExecutionJob.java ,you can write the if condition in code where they are attaching the report. Its hardly a two line of code that you need to add.If you do not want all these steps , off course you can hard code the email address in code itself but that wont be good practise.Let me know if you find this helpful. All the best.Regards,Bhushan Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now