PDA

View Full Version : JasperReportsMultiFormatView cascade exporterParameters?


Maulisho
Mar 23rd, 2005, 06:15 AM
Hi,

I started using Jasperreports with spring yesterday and I want to make a report available in different formats, hence my use for JasperReportsMultiFormatView. I want to use the exporterParameters, but the MultiFormatView does not set the exporterParameters on the views it creates as I expected. Am I missing a point here? Or is this just a missing feature?

Another minor problem I found (I must say I didnt look into it very deeply), but the getExporterParameters method is protected and I think that causes the below expection while filling the property through .properties file by for instance a ResourceBundleViewResolver. Using an XmlViewResolver fixes the problem (prolly cause that just feeds the Map all at once to the setter method without calling a getter method first?)

org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'testReport' defined in null: Err
or setting property values; nested exception is org.springframework.beans.NotWritablePropertyExcep tion: Invalid property
'exporterParameters.net.sf.jasperreports.engine.ex port.JRHtmlExporterParameter.IS_USING_IMAGES_TO_AL IGN' of bean class
[org.springframework.web.servlet.view.jasperreport s.JasperReportsMultiFormatView]: Nested property in path 'exporterPara
meters.net.sf.jasperreports.engine.export.JRHtmlEx porterParameter.IS_USING_IMAGES_TO_ALIGN' does not exist; nested excep
tion is org.springframework.beans.NotReadablePropertyExcep tion: Invalid property 'exporterParameters' of bean class [org
.springframework.web.servlet.view.jasperreports.Ja sperReportsMultiFormatView]: Bean property 'exporterParameters' is not
readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
org.springframework.beans.NotWritablePropertyExcep tion: Invalid property 'exporterParameters.net.sf.jasperreports.engine
.export.JRHtmlExporterParameter.IS_USING_IMAGES_TO _ALIGN' of bean class [org.springframework.web.servlet.view.jasperrep o
rts.JasperReportsMultiFormatView]: Nested property in path 'exporterParameters.net.sf.jasperreports.engine.ex port.JRHtml
ExporterParameter.IS_USING_IMAGES_TO_ALIGN' does not exist; nested exception is org.springframework.beans.NotReadablePro
pertyException: Invalid property 'exporterParameters' of bean class [org.springframework.web.servlet.view.jasperreport s.
JasperReportsMultiFormatView]: Bean property 'exporterParameters' is not readable or has an invalid getter method: Does
the return type of the getter match the parameter type of the setter?
org.springframework.beans.NotReadablePropertyExcep tion: Invalid property 'exporterParameters' of bean class [org.springf

ramework.web.servlet.view.jasperreports.JasperRepo rtsMultiFormatView]: Bean property 'exporterParameters' is not readabl
e or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
at org.springframework.beans.BeanWrapperImpl.getPrope rtyValue(BeanWrapperImpl.java:595)
at org.springframework.beans.BeanWrapperImpl.getNeste dBeanWrapper(BeanWrapperImpl.java:496)
at org.springframework.beans.BeanWrapperImpl.getBeanW rapperForPropertyPath(BeanWrapperImpl.java:474)
at org.springframework.beans.BeanWrapperImpl.setPrope rtyValue(BeanWrapperImpl.java:677)
at org.springframework.beans.BeanWrapperImpl.setPrope rtyValue(BeanWrapperImpl.java:826)
at org.springframework.beans.BeanWrapperImpl.setPrope rtyValues(BeanWrapperImpl.java:853)
at org.springframework.beans.BeanWrapperImpl.setPrope rtyValues(BeanWrapperImpl.java:842)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAuto
wireCapableBeanFactory.java:870)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCap
ableBeanFactory.java:688)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapab
leBeanFactory.java:325)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapab
leBeanFactory.java:260)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:221)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:145)
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListable
BeanFactory.java:291)
at org.springframework.web.servlet.view.ResourceBundl eViewResolver.initFactory(ResourceBundleViewResolv er.java:1
54)
at org.springframework.web.servlet.view.ResourceBundl eViewResolver.loadView(ResourceBundleViewResolver. java:125)

at org.springframework.web.servlet.view.AbstractCachi ngViewResolver.createView(AbstractCachingViewResol ver.java:
154)
at org.springframework.web.servlet.view.AbstractCachi ngViewResolver.prepareView(AbstractCachingViewReso lver.java
:133)
at org.springframework.web.servlet.view.AbstractCachi ngViewResolver.resolveViewName(AbstractCachingView Resolver.
java:78)
at org.springframework.web.servlet.DispatcherServlet. resolveViewName(DispatcherServlet.java:939)
at org.springframework.web.servlet.DispatcherServlet. render(DispatcherServlet.java:898)
at org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:696)
at org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:623)
at org.springframework.web.servlet.FrameworkServlet.s erviceWrapper(FrameworkServlet.java:384)
at org.springframework.web.servlet.FrameworkServlet.d oGet(FrameworkServlet.java:344)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invo keInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
at org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:535)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)

Any thoughts on these issues?

Thanx,

Maulisho

robh
Mar 23rd, 2005, 12:36 PM
Maulisho,

I'll raise an issue in JIRA for these bugs and try to get the fixes in for 1.2

Rob

Maulisho
Mar 24th, 2005, 06:48 AM
Rob,

Thanx.

I wrote some code to circumvent the exportparameters not cascading issue. Nothing fancy, but overriding the setExporterMappings() to not do the fancy map conversion, but just simply store the original Map and then calling setExporterMappings on the created views should be enough. I think this will also fix the other problem (cause then the getter returns the same kind of map the setter inserted). So you might wanna think about moving the map conversion to some other place.

Alot of the properties in AbstractJasperReportsView are private though (including exporterParameters). So you would have to fiddle with that a bit.

Maulisho

robh
Mar 29th, 2005, 08:07 AM
Fixes for both issues have been committed to CVS.

Rob

mraible
Jul 29th, 2005, 02:18 PM
I'm trying to turn off "is_using_images_to_align" as well, and I'm getting the same error as noted above (with Spring 1.2.3).

Here's what I have in my views.properties file.

reportView.exporterParameters.net.sf.jasperreports .engine.export.JRHtmlExporterParameter.IS_USING_IM AGES_TO_ALIGN=false

I've tried using the following as well, but no luck.

reportView.exporterParameters[net.sf.jasperreports.engine.export.JRHtmlExporterP arameter.IS_USING_IMAGES_TO_ALIGN]=false

What's the syntax for setting exporterParameters?

robh
Jul 31st, 2005, 06:28 PM
Matt,

I plead ignorance here - I haven't been configuring my JasperReports using the properties syntax. Rather I have been using BeanNameUrlResolver and configuring using XML syntax. Can you raise a JIRA issue for this and I'll figure out what the situation is with the properties syntax.

Rob

mraible
Jul 31st, 2005, 07:25 PM
I'm more than happy to enter an issue for this, but I'm not sure it's a bug. From looking at some tests, it seems like you should be able to set a maps keys and values using:

propertyName[keyName]=keyValue

If that's the property syntax, then it might be a bug - but I don't want to jump to that conclusion until I'm sure my syntax is correct.

robh
Jul 31st, 2005, 08:06 PM
I agree - I don't think this is a bug, because it works when using the <map>. However, I am not really certain of the properties syntax. I have a few issues related to Jasper for 1.3 anyway so I'll look into this at the same time.

Rob

robh
Aug 2nd, 2005, 05:39 PM
This is a bug - SPR-1198 (http://opensource.atlassian.com/projects/spring/browse/SPR-1198). I'll fix this for the 1.2.4 release.

Rob