You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Rich <ri...@moremagic.com> on 2010/07/26 19:36:13 UTC

JasperReports / Chenillekit-reports documentation

Hi,

I have to integrate some Jasper reports into a Tapestry web app and I 
came across Chenillekit-reports, which seems like it might be a 
solution. I'm having a hard time finding any useful documentation 
related to it though. Are there any web resources available explaining 
implementation or should I just work my way through the source code? I'm 
assuming this is the best implementation of JasperReports into Tapestry 
at this point in time, but if there are other options I'm all ears.

Regards,
Rich

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: JasperReports / Chenillekit-reports documentation

Posted by Jim O'Callaghan <jc...@yahoo.co.uk>.
You've probably already checked, but in case not - have you had a look at the JasperReports pom?  Perhaps there are dependencies it references that need to be explicitly excluded in your pom to stop interfering with your other project dependencies?

Regards,
Jim.

-----Original Message-----
From: Rich [mailto:richard@moremagic.com] 
Sent: 30 July 2010 15:01
To: Tapestry users
Subject: Re: JasperReports / Chenillekit-reports documentation

Thiago H. de Paula Figueiredo wrote:
> On Wed, 28 Jul 2010 18:13:17 -0300, Rich <ri...@moremagic.com> wrote:
>
>> Hi,
>
> Hi!
>
>> java.lang.ClassNotFoundException 
>> org.apache.poi.hssf.usermodel.HSSFCellStyle
>
>> java.lang.NoClassDefFoundError: 
>> org/apache/commons/collections/map/LRUMap
>
> These are dependency problems, not Tapestry ones. The first one looks 
> like POI and the second one Apache Commons-Collections.
>
Sort of. The POI one is clearly a dependency problem and I stated as 
much, since it uses outdated versions of JasperReports. However, the 
second one regarding Apache Commons and LRUMap is something that is 
breaking in the Tapestry-Hibernate Module when all that's changed is the 
JasperReports dependency. I didn't fully explain this because it was 
fully detailed with the exception in an earlier e-mail in this thread I 
wrote.

Caused by: java.lang.RuntimeException: Error invoking service builder 
method 
org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger, 
List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for 
service 'HibernateSessionSource'): org/apache/commons/collections/map/LRUMap
    at 
org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:76)
    at 
org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)
    at 
org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)
    ... 134 more
Caused by: java.lang.NoClassDefFoundError: 
org/apache/commons/collections/map/LRUMap


So there seems to be some transitive breaking there, which I would say 
puts it beyond just a dependency problem. Anyway, after much trial and 
error it turns out that Apache POI 3.2 and JasperReports 3.5.0 will get 
XLS working. Older JasperReport versions call deprecated POI methods, 
newer JasperReport versions break the Hibernate module, older POI 
versions have bugs that break runtime execution, and newer POI versions 
also break!

Regards,
Rich

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: JasperReports / Chenillekit-reports documentation

Posted by Rich <ri...@moremagic.com>.
Thiago H. de Paula Figueiredo wrote:
> On Wed, 28 Jul 2010 18:13:17 -0300, Rich <ri...@moremagic.com> wrote:
>
>> Hi,
>
> Hi!
>
>> java.lang.ClassNotFoundException 
>> org.apache.poi.hssf.usermodel.HSSFCellStyle
>
>> java.lang.NoClassDefFoundError: 
>> org/apache/commons/collections/map/LRUMap
>
> These are dependency problems, not Tapestry ones. The first one looks 
> like POI and the second one Apache Commons-Collections.
>
Sort of. The POI one is clearly a dependency problem and I stated as 
much, since it uses outdated versions of JasperReports. However, the 
second one regarding Apache Commons and LRUMap is something that is 
breaking in the Tapestry-Hibernate Module when all that's changed is the 
JasperReports dependency. I didn't fully explain this because it was 
fully detailed with the exception in an earlier e-mail in this thread I 
wrote.

Caused by: java.lang.RuntimeException: Error invoking service builder 
method 
org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger, 
List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for 
service 'HibernateSessionSource'): org/apache/commons/collections/map/LRUMap
    at 
org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:76)
    at 
org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)
    at 
org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)
    ... 134 more
Caused by: java.lang.NoClassDefFoundError: 
org/apache/commons/collections/map/LRUMap


So there seems to be some transitive breaking there, which I would say 
puts it beyond just a dependency problem. Anyway, after much trial and 
error it turns out that Apache POI 3.2 and JasperReports 3.5.0 will get 
XLS working. Older JasperReport versions call deprecated POI methods, 
newer JasperReport versions break the Hibernate module, older POI 
versions have bugs that break runtime execution, and newer POI versions 
also break!

Regards,
Rich

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: JasperReports / Chenillekit-reports documentation

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, 28 Jul 2010 18:13:17 -0300, Rich <ri...@moremagic.com> wrote:

> Hi,

Hi!

> java.lang.ClassNotFoundException  
> org.apache.poi.hssf.usermodel.HSSFCellStyle

> java.lang.NoClassDefFoundError: org/apache/commons/collections/map/LRUMap

These are dependency problems, not Tapestry ones. The first one looks like  
POI and the second one Apache Commons-Collections.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: JasperReports / Chenillekit-reports documentation

Posted by Rich <ri...@moremagic.com>.
Hi,

thanks Josh, great advice! I had been looking over the Tapestry Wiki 
page about exporting a dynamic PDF document and they did implement a 
StreamResponse there, but I wasn't connecting the dots. Between the code 
I already had and the implementation there I was able to implement 
something that works with Jasper as I had intended.


The only remaining issue now is with XLS files:

java.lang.ClassNotFoundException org.apache.poi.hssf.usermodel.HSSFCellStyle 


This issue is complicated, this Class seems to be from newer versions of 
JasperReports. ChenilleKit-Reports runs on JasperReports 3.1.0 which is 
almost 2 years old. Version 3.1.0 up through 3.5.x all report this 
exception when generating XLS files. On the other hand, when I include 
JasperReports version 3.6.x - 3.7.4 (newest release) Tapestry-Hibernate 
is broken by the following:

java.lang.NoClassDefFoundError: org/apache/commons/collections/map/LRUMap


Does anyone have any insight into this matter. I'm not really sure what 
to do. I suppose XLS isn't 100% necessary, but I'd rather not have to 
explain to the higher ups that our older JSP-Based platform could handle 
it, while the "new and improved" Tapestry platform can't.

Thanks,
Rich



Josh Canfield wrote:
> Hi Rich.
>
> Caveat: I haven't used Chenillekit or JasperReports.
>
> You should probably not be trying to write to the OutputStream from
> the Response inside of Tapestry. Tapestry has some built-in methods
> for returning alternative types of data. For instance, you could
> implement a org.apache.tapestry5.StreamResponse object and return it
> from your onSuccess handler. Tapestry will then stream the data to the
> client using the content-type you provide.
>
> Josh
>
> On Wed, Jul 28, 2010 at 11:23 AM, Rich <ri...@moremagic.com> wrote:
>   
>> Continuing the soliloquy...
>>
>> I got past the Module exception by allowing the configuration map to be null
>> when building the JRProperties settings so it just uses default settings.
>>
>> I'm still having issues grasping the logic of getting the correct output.
>> Using the OutputStream as I mentioned before half works. HTML doesn't
>> display, CSV comes out good, PDF doesn't work and complains of document type
>> "text/plain", while XLS returns java.lang.ClassNotFoundException
>> org.apache.poi.hssf.usermodel.HSSFCellStyle (maybe this is related to the
>> same issues with the JasperReports jar dependency not working)
>>
>> So sort of progress, but not really. It doesn't seem like setting the
>> content-type of the OutputStream does anything worthwhile. Can someone help
>> explain? I get the feeling the OutputStream I'm using/or how I'm using isn't
>> right.
>>
>> @Inject private Response resp;
>>
>> private OutputStream os;
>>
>> @Property @Persist
>>
>>   private ExportFormat formMode;
>>
>>
>>   @Component
>>
>>   private Submit CSV;
>>
>>
>>   @Component
>>
>>   private Submit HTML;
>>
>>
>>   @Component
>>
>>   private Submit PDF;
>>
>>
>>   @Component
>>
>>   private Submit XLS;
>>
>>
>>   void onSelectedFromCSV(){
>>
>>       formMode = ExportFormat.CSV;
>>
>>       try {
>>
>>           os = resp.getOutputStream("text/comma-separated-values");
>>
>>           debug("OutputStream content-type="+"text/comma-separated-values");
>>
>>       } catch (IOException e) {
>>
>>           error(e.toString());
>>
>>           throw new TapestryException("Could not get CSV output stream", e);
>>
>>       }
>>
>>   }
>>
>>
>>   void onSelectedFromHTML(){
>>
>>       formMode= ExportFormat.HTML;
>>
>>       try {
>>
>>           os = resp.getOutputStream("text/html");
>>
>>           debug("OutputStream content-type="+"text/html");
>>
>>       } catch (IOException e) {
>>
>>           error(e.toString());
>>
>>           throw new TapestryException("Could not get HTML output stream",
>> e);
>>
>>       }
>>
>>   }
>>
>>
>>   void onSelectedFromPDF(){
>>
>>       formMode = ExportFormat.PDF;
>>
>>       try {
>>
>>           os = resp.getOutputStream("application/pdf");
>>
>>           debug("OutputStream content-type="+"application/pdf");
>>
>>       } catch (IOException e) {
>>
>>           error(e.toString());
>>
>>           throw new TapestryException("Could not get PDF output stream", e);
>>
>>       }
>>
>>   }
>>
>>
>>   void onSelectedFromXLS(){
>>
>>       formMode = ExportFormat.XLS;
>>
>>       try {
>>
>>           os = resp.getOutputStream("application/vnd.ms-excel");
>>
>>           debug("OutputStream content-type="+"application/vnd.ms-excel");
>>
>>       } catch (IOException e) {
>>
>>           error(e.toString());
>>
>>           throw new TapestryException("Could not get XLS output stream", e);
>>
>>       }
>>
>>   }
>>
>> Thanks,
>> Rich
>>
>> Rich wrote:
>>     
>>> Hi again,
>>>
>>> well it seems the source code wasn't that involved, just a nice wrapper
>>> mostly over the file formats. It doesn't seem to have built-in JDBC
>>> connection support, so I wrote a modified version that takes an Object for
>>> dataSource and then dictates the proper JasperFillManager.FillReport method
>>> depending on a JRDataSource or Connection object. That aside, I could use
>>> some advice into applying the FillAndExport method :
>>>
>>> /**
>>>     * export the report.
>>>     *
>>>     * @param inputResource the input resource (report template file
>>> ".jrxml")
>>>     * @param format        the output format
>>>     * @param parameterMap  the parameter map
>>>     * @param dataSource    the datasource. Either a JDBC SQL Connection or
>>> JRDataSource object
>>>     * @param outputStream  the output stream
>>>     */
>>>    public void fillAndExport(Resource inputResource, ExportFormat format,
>>> Map parameterMap, Object dataSource, OutputStream outputStream)
>>>    {
>>>        JasperPrint jasperPrint = fillReport(inputResource, parameterMap,
>>> dataSource);
>>>        export(jasperPrint, format, outputStream);
>>>    }
>>>
>>> In older code at my company (JSP-Servlet based), we typically build the
>>> parameterMap, hand load the inputResource in a File object, and then define
>>> the format/content-type in the HTTPResponse and connect the HTTPResponse's
>>> outputStream into the export method. At this point the intended results are
>>> displayed.
>>>
>>> To mirror this, I found the Response service in Tapestry, and use the
>>> getOutputStream(contentType) method, setting the appropriate content-type
>>> string in the call. Can I expect this to work as I intend
>>> (displaying/triggering the browser through this stream)?
>>>
>>>
>>> I'm calling the function like this:
>>>
>>> public void onSuccessFromRepForm(){
>>>
>>>       Map parameterMap = loadParameters(reportTitle);
>>>
>>>       Connection conn = null;
>>>
>>>       try{
>>>
>>>           conn = Report.getConnection();
>>>
>>>           rs.fillAndExport(new ContextResource(cimpl,reportTitle+".xml"),
>>> formMode, parameterMap, conn, os);
>>>
>>>       }catch (Exception e){
>>>
>>>           System.out.println("Caught exception while trying to execute the
>>> report fillAndExport service method.");
>>>
>>>           throw new TapestryException("Issue executing report", e);
>>>
>>>       } finally {
>>>
>>>           if(conn != null){
>>>
>>>               try {
>>>
>>>                   conn.close();
>>>
>>>               } catch (SQLException e) {
>>>
>>>                   System.out.println("Could not close the JDBC
>>> connection!!");
>>>
>>>               }
>>>
>>>           }
>>>
>>>       }
>>>
>>> }
>>>
>>>
>>> cimpl is an injection of the Tapestry Context service, formMode is a page
>>> property, and os is the loaded Response OutputStream. When I try to test
>>> this (this was before I made the JDBC Connection change) I get the following
>>> Exception from the ChenilleKitReportsModule (:
>>>
>>> Exception constructing service 'ReportsService': Error invoking service
>>> builder method
>>>
>>> org.chenillekit.reports.ChenilleKitReportsModule.buildReportsService(Logger,Map)
>>> (at ChenilleKitReportsModule.java:43) (for service 'ReportsService'):
>>> Parameter configuration was null.
>>>
>>> From the module:
>>>
>>> public static ReportsService buildReportService(Logger logger, Map<String,
>>> Resource> configuration)
>>>   {
>>>       return new ReportsServiceImpl(logger,
>>> configuration.get(ReportsService.CONFIG_RESOURCE_KEY));
>>>   }
>>>
>>>
>>> I'm assuming this is because I don't have a line in my AppModule where i
>>> add to the configuration a mapping for "jasperreports.properties"
>>> (resolution of ReportsService.CONFIG_RESOURCE_KEY), but I'm also not sure
>>> what this is supposed to be mapping to.
>>>
>>> Things break worse when I use my own extended version including JDBC
>>> Connections:
>>>
>>> Caused by: java.lang.RuntimeException: Exception constructing service
>>> 'ValueEncoderSource': Error invoking service builder method
>>> org.apache.tapestry5.services.TapestryModule.buildValueEncoderSource(Map,
>>> InvalidationEventHub) (at TapestryModule.java:1910) (for service
>>> 'ValueEncoderSource'): Error invoking service contribution method
>>> org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration,
>>> boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess,
>>> LoggerSource): Exception constructing service 'HibernateSessionSource':
>>> Error invoking service builder method
>>> org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger,
>>> List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service
>>> 'HibernateSessionSource'): org/apache/commons/collections/map/LRUMap
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:78)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:57)
>>>
>>>   at
>>> $ValueEncoderSource_12a14ccbea5.delegate($ValueEncoderSource_12a14ccbea5.java)
>>>
>>>   at
>>> $ValueEncoderSource_12a14ccbea5.getValueEncoder($ValueEncoderSource_12a14ccbea5.java)
>>>
>>>   at
>>> org.apache.tapestry5.internal.services.ComponentDefaultProviderImpl.defaultValueEncoder(ComponentDefaultProviderImpl.java:116)
>>>
>>>   at
>>> $ComponentDefaultProvider_12a14ccbe71.defaultValueEncoder($ComponentDefaultProvider_12a14ccbe71.java)
>>>
>>>   at
>>> org.apache.tapestry5.corelib.components.Loop.defaultEncoder(Loop.java:304)
>>>
>>>   at
>>> org.apache.tapestry5.corelib.components.Loop.containingPageDidLoad(Loop.java)
>>>
>>>   at
>>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$4.run(ComponentPageElementImpl.java:98)
>>>
>>>   at
>>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:933)
>>>
>>>   ... 55 more
>>>
>>> Caused by: java.lang.RuntimeException: Error invoking service builder
>>> method
>>> org.apache.tapestry5.services.TapestryModule.buildValueEncoderSource(Map,
>>> InvalidationEventHub) (at TapestryModule.java:1910) (for service
>>> 'ValueEncoderSource'): Error invoking service contribution method
>>> org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration,
>>> boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess,
>>> LoggerSource): Exception constructing service 'HibernateSessionSource':
>>> Error invoking service builder method
>>> org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger,
>>> List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service
>>> 'HibernateSessionSource'): org/apache/commons/collections/map/LRUMap
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:76)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:29)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:46)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.AdvisorStackBuilder.createObject(AdvisorStackBuilder.java:60)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.InterceptorStackBuilder.createObject(InterceptorStackBuilder.java:52)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:60)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:68)
>>>
>>>   ... 64 more
>>>
>>> Caused by: java.lang.RuntimeException: Error invoking service contribution
>>> method
>>> org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration,
>>> boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess,
>>> LoggerSource): Exception constructing service 'HibernateSessionSource':
>>> Error invoking service builder method
>>> org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger,
>>> List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service
>>> 'HibernateSessionSource'): org/apache/commons/collections/map/LRUMap
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.ContributionDefImpl.invokeMethod(ContributionDefImpl.java:122)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.ContributionDefImpl.contribute(ContributionDefImpl.java:71)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.RegistryImpl$4.run(RegistryImpl.java:470)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl$1.invoke(OperationTrackerImpl.java:52)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl$1.invoke(OperationTrackerImpl.java:50)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:48)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.run(PerThreadOperationTracker.java:56)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.RegistryImpl.addToMappedConfiguration(RegistryImpl.java:466)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.RegistryImpl.getMappedConfiguration(RegistryImpl.java:416)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.ServiceResourcesImpl$3.invoke(ServiceResourcesImpl.java:126)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.ServiceResourcesImpl$3.invoke(ServiceResourcesImpl.java:124)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.ServiceResourcesImpl.getMappedConfiguration(ServiceResourcesImpl.java:120)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.AbstractServiceCreator.getMappedConfiguration(AbstractServiceCreator.java:142)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.AbstractServiceCreator.access$300(AbstractServiceCreator.java:35)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.AbstractServiceCreator$1.findResource(AbstractServiceCreator.java:107)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.util.DelegatingInjectionResources.findResource(DelegatingInjectionResources.java:38)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateInjection(InternalUtils.java:201)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.util.InternalUtils.access$000(InternalUtils.java:43)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.util.InternalUtils$2.invoke(InternalUtils.java:256)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParameters(InternalUtils.java:260)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParametersForMethod(InternalUtils.java:217)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:56)
>>>
>>>   ... 80 more
>>>
>>> Caused by: java.lang.RuntimeException: Exception constructing service
>>> 'HibernateSessionSource': Error invoking service builder method
>>> org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger,
>>> List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service
>>> 'HibernateSessionSource'): org/apache/commons/collections/map/LRUMap
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:78)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:57)
>>>
>>>   at
>>> $HibernateSessionSource_12a14ccbe30.delegate($HibernateSessionSource_12a14ccbe30.java)
>>>
>>>   at
>>> $HibernateSessionSource_12a14ccbe30.getConfiguration($HibernateSessionSource_12a14ccbe30.java)
>>>
>>>   at
>>> org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(HibernateModule.java:89)
>>>
>>>   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.apache.tapestry5.ioc.internal.ContributionDefImpl.invokeMethod(ContributionDefImpl.java:110)
>>>
>>>   ... 108 more
>>>
>>> Caused by: org.apache.tapestry5.ioc.internal.OperationException: Error
>>> invoking service builder method
>>> org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger,
>>> List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service
>>> 'HibernateSessionSource'): org/apache/commons/collections/map/LRUMap
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:90)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:29)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:46)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.AdvisorStackBuilder.createObject(AdvisorStackBuilder.java:60)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.InterceptorStackBuilder.createObject(InterceptorStackBuilder.java:52)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:60)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:68)
>>>
>>>   ... 117 more
>>>
>>> Caused by: java.lang.RuntimeException: Error invoking service builder
>>> method
>>> org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger,
>>> List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service
>>> 'HibernateSessionSource'): org/apache/commons/collections/map/LRUMap
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:76)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)
>>>
>>>   at
>>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)
>>>
>>>   ... 131 more
>>>
>>> *Caused by: java.lang.NoClassDefFoundError:
>>> org/apache/commons/collections/map/LRUMap*
>>>
>>>   at org.hibernate.util.SimpleMRUCache.init(SimpleMRUCache.java:71)
>>>
>>>   at org.hibernate.util.SimpleMRUCache.<init>(SimpleMRUCache.java:55)
>>>
>>>   at org.hibernate.util.SimpleMRUCache.<init>(SimpleMRUCache.java:50)
>>>
>>>   at
>>> org.hibernate.engine.query.QueryPlanCache.<init>(QueryPlanCache.java:65)
>>>
>>>   at
>>> org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:182)
>>>
>>>   at
>>> org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
>>>
>>>   at
>>> org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
>>>
>>>   at
>>> org.apache.tapestry5.internal.hibernate.HibernateSessionSourceImpl.<init>(HibernateSessionSourceImpl.java:45)
>>>
>>>   at
>>> org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(HibernateCoreModule.java:123)
>>>
>>>   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.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:64)
>>>
>>>
>>> The part that stands out to me is:
>>>
>>> **Caused by: java.lang.NoClassDefFoundError:
>>> org/apache/commons/collections/map/LRUMap**
>>>
>>> My best guess is that this is a result of the JasperReports 3.7.4
>>> dependency, as I isolated this to only occur when code dependent on this
>>> library is in the application. When I use the Chenillekit-Reports dependency
>>> instead, this exception goes away. A bit interesting... this exception
>>> doesn't actually affect my application since I can use the
>>> Chenillekit-Reports jar, but it seemed worthwhile to mention the
>>> incompatibility.
>>>
>>> When I use the ChenilleKit-Reports dependency though, I get the same
>>> exception in my AppModule as ChenilleKitReportsModule from a null in the
>>> buildReportsService method.
>>>
>>> Regards,
>>> Rich
>>>
>>> Rich wrote:
>>>       
>>>> Hi,
>>>>
>>>> I have to integrate some Jasper reports into a Tapestry web app and I
>>>> came across Chenillekit-reports, which seems like it might be a solution.
>>>> I'm having a hard time finding any useful documentation related to it
>>>> though. Are there any web resources available explaining implementation or
>>>> should I just work my way through the source code? I'm assuming this is the
>>>> best implementation of JasperReports into Tapestry at this point in time,
>>>> but if there are other options I'm all ears.
>>>>
>>>> Regards,
>>>> Rich
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>         
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>     
>
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: JasperReports / Chenillekit-reports documentation

Posted by Josh Canfield <jo...@gmail.com>.
Hi Rich.

Caveat: I haven't used Chenillekit or JasperReports.

You should probably not be trying to write to the OutputStream from
the Response inside of Tapestry. Tapestry has some built-in methods
for returning alternative types of data. For instance, you could
implement a org.apache.tapestry5.StreamResponse object and return it
from your onSuccess handler. Tapestry will then stream the data to the
client using the content-type you provide.

Josh

On Wed, Jul 28, 2010 at 11:23 AM, Rich <ri...@moremagic.com> wrote:
> Continuing the soliloquy...
>
> I got past the Module exception by allowing the configuration map to be null
> when building the JRProperties settings so it just uses default settings.
>
> I'm still having issues grasping the logic of getting the correct output.
> Using the OutputStream as I mentioned before half works. HTML doesn't
> display, CSV comes out good, PDF doesn't work and complains of document type
> "text/plain", while XLS returns java.lang.ClassNotFoundException
> org.apache.poi.hssf.usermodel.HSSFCellStyle (maybe this is related to the
> same issues with the JasperReports jar dependency not working)
>
> So sort of progress, but not really. It doesn't seem like setting the
> content-type of the OutputStream does anything worthwhile. Can someone help
> explain? I get the feeling the OutputStream I'm using/or how I'm using isn't
> right.
>
> @Inject private Response resp;
>
> private OutputStream os;
>
> @Property @Persist
>
>   private ExportFormat formMode;
>
>
>   @Component
>
>   private Submit CSV;
>
>
>   @Component
>
>   private Submit HTML;
>
>
>   @Component
>
>   private Submit PDF;
>
>
>   @Component
>
>   private Submit XLS;
>
>
>   void onSelectedFromCSV(){
>
>       formMode = ExportFormat.CSV;
>
>       try {
>
>           os = resp.getOutputStream("text/comma-separated-values");
>
>           debug("OutputStream content-type="+"text/comma-separated-values");
>
>       } catch (IOException e) {
>
>           error(e.toString());
>
>           throw new TapestryException("Could not get CSV output stream", e);
>
>       }
>
>   }
>
>
>   void onSelectedFromHTML(){
>
>       formMode= ExportFormat.HTML;
>
>       try {
>
>           os = resp.getOutputStream("text/html");
>
>           debug("OutputStream content-type="+"text/html");
>
>       } catch (IOException e) {
>
>           error(e.toString());
>
>           throw new TapestryException("Could not get HTML output stream",
> e);
>
>       }
>
>   }
>
>
>   void onSelectedFromPDF(){
>
>       formMode = ExportFormat.PDF;
>
>       try {
>
>           os = resp.getOutputStream("application/pdf");
>
>           debug("OutputStream content-type="+"application/pdf");
>
>       } catch (IOException e) {
>
>           error(e.toString());
>
>           throw new TapestryException("Could not get PDF output stream", e);
>
>       }
>
>   }
>
>
>   void onSelectedFromXLS(){
>
>       formMode = ExportFormat.XLS;
>
>       try {
>
>           os = resp.getOutputStream("application/vnd.ms-excel");
>
>           debug("OutputStream content-type="+"application/vnd.ms-excel");
>
>       } catch (IOException e) {
>
>           error(e.toString());
>
>           throw new TapestryException("Could not get XLS output stream", e);
>
>       }
>
>   }
>
> Thanks,
> Rich
>
> Rich wrote:
>>
>> Hi again,
>>
>> well it seems the source code wasn't that involved, just a nice wrapper
>> mostly over the file formats. It doesn't seem to have built-in JDBC
>> connection support, so I wrote a modified version that takes an Object for
>> dataSource and then dictates the proper JasperFillManager.FillReport method
>> depending on a JRDataSource or Connection object. That aside, I could use
>> some advice into applying the FillAndExport method :
>>
>> /**
>>     * export the report.
>>     *
>>     * @param inputResource the input resource (report template file
>> ".jrxml")
>>     * @param format        the output format
>>     * @param parameterMap  the parameter map
>>     * @param dataSource    the datasource. Either a JDBC SQL Connection or
>> JRDataSource object
>>     * @param outputStream  the output stream
>>     */
>>    public void fillAndExport(Resource inputResource, ExportFormat format,
>> Map parameterMap, Object dataSource, OutputStream outputStream)
>>    {
>>        JasperPrint jasperPrint = fillReport(inputResource, parameterMap,
>> dataSource);
>>        export(jasperPrint, format, outputStream);
>>    }
>>
>> In older code at my company (JSP-Servlet based), we typically build the
>> parameterMap, hand load the inputResource in a File object, and then define
>> the format/content-type in the HTTPResponse and connect the HTTPResponse's
>> outputStream into the export method. At this point the intended results are
>> displayed.
>>
>> To mirror this, I found the Response service in Tapestry, and use the
>> getOutputStream(contentType) method, setting the appropriate content-type
>> string in the call. Can I expect this to work as I intend
>> (displaying/triggering the browser through this stream)?
>>
>>
>> I'm calling the function like this:
>>
>> public void onSuccessFromRepForm(){
>>
>>       Map parameterMap = loadParameters(reportTitle);
>>
>>       Connection conn = null;
>>
>>       try{
>>
>>           conn = Report.getConnection();
>>
>>           rs.fillAndExport(new ContextResource(cimpl,reportTitle+".xml"),
>> formMode, parameterMap, conn, os);
>>
>>       }catch (Exception e){
>>
>>           System.out.println("Caught exception while trying to execute the
>> report fillAndExport service method.");
>>
>>           throw new TapestryException("Issue executing report", e);
>>
>>       } finally {
>>
>>           if(conn != null){
>>
>>               try {
>>
>>                   conn.close();
>>
>>               } catch (SQLException e) {
>>
>>                   System.out.println("Could not close the JDBC
>> connection!!");
>>
>>               }
>>
>>           }
>>
>>       }
>>
>> }
>>
>>
>> cimpl is an injection of the Tapestry Context service, formMode is a page
>> property, and os is the loaded Response OutputStream. When I try to test
>> this (this was before I made the JDBC Connection change) I get the following
>> Exception from the ChenilleKitReportsModule (:
>>
>> Exception constructing service 'ReportsService': Error invoking service
>> builder method
>>
>> org.chenillekit.reports.ChenilleKitReportsModule.buildReportsService(Logger,Map)
>> (at ChenilleKitReportsModule.java:43) (for service 'ReportsService'):
>> Parameter configuration was null.
>>
>> From the module:
>>
>> public static ReportsService buildReportService(Logger logger, Map<String,
>> Resource> configuration)
>>   {
>>       return new ReportsServiceImpl(logger,
>> configuration.get(ReportsService.CONFIG_RESOURCE_KEY));
>>   }
>>
>>
>> I'm assuming this is because I don't have a line in my AppModule where i
>> add to the configuration a mapping for "jasperreports.properties"
>> (resolution of ReportsService.CONFIG_RESOURCE_KEY), but I'm also not sure
>> what this is supposed to be mapping to.
>>
>> Things break worse when I use my own extended version including JDBC
>> Connections:
>>
>> Caused by: java.lang.RuntimeException: Exception constructing service
>> 'ValueEncoderSource': Error invoking service builder method
>> org.apache.tapestry5.services.TapestryModule.buildValueEncoderSource(Map,
>> InvalidationEventHub) (at TapestryModule.java:1910) (for service
>> 'ValueEncoderSource'): Error invoking service contribution method
>> org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration,
>> boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess,
>> LoggerSource): Exception constructing service 'HibernateSessionSource':
>> Error invoking service builder method
>> org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger,
>> List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service
>> 'HibernateSessionSource'): org/apache/commons/collections/map/LRUMap
>>
>>   at
>> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:78)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:57)
>>
>>   at
>> $ValueEncoderSource_12a14ccbea5.delegate($ValueEncoderSource_12a14ccbea5.java)
>>
>>   at
>> $ValueEncoderSource_12a14ccbea5.getValueEncoder($ValueEncoderSource_12a14ccbea5.java)
>>
>>   at
>> org.apache.tapestry5.internal.services.ComponentDefaultProviderImpl.defaultValueEncoder(ComponentDefaultProviderImpl.java:116)
>>
>>   at
>> $ComponentDefaultProvider_12a14ccbe71.defaultValueEncoder($ComponentDefaultProvider_12a14ccbe71.java)
>>
>>   at
>> org.apache.tapestry5.corelib.components.Loop.defaultEncoder(Loop.java:304)
>>
>>   at
>> org.apache.tapestry5.corelib.components.Loop.containingPageDidLoad(Loop.java)
>>
>>   at
>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$4.run(ComponentPageElementImpl.java:98)
>>
>>   at
>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:933)
>>
>>   ... 55 more
>>
>> Caused by: java.lang.RuntimeException: Error invoking service builder
>> method
>> org.apache.tapestry5.services.TapestryModule.buildValueEncoderSource(Map,
>> InvalidationEventHub) (at TapestryModule.java:1910) (for service
>> 'ValueEncoderSource'): Error invoking service contribution method
>> org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration,
>> boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess,
>> LoggerSource): Exception constructing service 'HibernateSessionSource':
>> Error invoking service builder method
>> org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger,
>> List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service
>> 'HibernateSessionSource'): org/apache/commons/collections/map/LRUMap
>>
>>   at
>> org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:76)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:29)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:46)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.AdvisorStackBuilder.createObject(AdvisorStackBuilder.java:60)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.InterceptorStackBuilder.createObject(InterceptorStackBuilder.java:52)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:60)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:68)
>>
>>   ... 64 more
>>
>> Caused by: java.lang.RuntimeException: Error invoking service contribution
>> method
>> org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration,
>> boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess,
>> LoggerSource): Exception constructing service 'HibernateSessionSource':
>> Error invoking service builder method
>> org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger,
>> List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service
>> 'HibernateSessionSource'): org/apache/commons/collections/map/LRUMap
>>
>>   at
>> org.apache.tapestry5.ioc.internal.ContributionDefImpl.invokeMethod(ContributionDefImpl.java:122)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.ContributionDefImpl.contribute(ContributionDefImpl.java:71)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.RegistryImpl$4.run(RegistryImpl.java:470)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl$1.invoke(OperationTrackerImpl.java:52)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl$1.invoke(OperationTrackerImpl.java:50)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:48)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.run(PerThreadOperationTracker.java:56)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.RegistryImpl.addToMappedConfiguration(RegistryImpl.java:466)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.RegistryImpl.getMappedConfiguration(RegistryImpl.java:416)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.ServiceResourcesImpl$3.invoke(ServiceResourcesImpl.java:126)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.ServiceResourcesImpl$3.invoke(ServiceResourcesImpl.java:124)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.ServiceResourcesImpl.getMappedConfiguration(ServiceResourcesImpl.java:120)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.AbstractServiceCreator.getMappedConfiguration(AbstractServiceCreator.java:142)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.AbstractServiceCreator.access$300(AbstractServiceCreator.java:35)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.AbstractServiceCreator$1.findResource(AbstractServiceCreator.java:107)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.util.DelegatingInjectionResources.findResource(DelegatingInjectionResources.java:38)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateInjection(InternalUtils.java:201)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.util.InternalUtils.access$000(InternalUtils.java:43)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.util.InternalUtils$2.invoke(InternalUtils.java:256)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParameters(InternalUtils.java:260)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParametersForMethod(InternalUtils.java:217)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:56)
>>
>>   ... 80 more
>>
>> Caused by: java.lang.RuntimeException: Exception constructing service
>> 'HibernateSessionSource': Error invoking service builder method
>> org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger,
>> List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service
>> 'HibernateSessionSource'): org/apache/commons/collections/map/LRUMap
>>
>>   at
>> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:78)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:57)
>>
>>   at
>> $HibernateSessionSource_12a14ccbe30.delegate($HibernateSessionSource_12a14ccbe30.java)
>>
>>   at
>> $HibernateSessionSource_12a14ccbe30.getConfiguration($HibernateSessionSource_12a14ccbe30.java)
>>
>>   at
>> org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(HibernateModule.java:89)
>>
>>   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.apache.tapestry5.ioc.internal.ContributionDefImpl.invokeMethod(ContributionDefImpl.java:110)
>>
>>   ... 108 more
>>
>> Caused by: org.apache.tapestry5.ioc.internal.OperationException: Error
>> invoking service builder method
>> org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger,
>> List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service
>> 'HibernateSessionSource'): org/apache/commons/collections/map/LRUMap
>>
>>   at
>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:90)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:29)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:46)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.AdvisorStackBuilder.createObject(AdvisorStackBuilder.java:60)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.InterceptorStackBuilder.createObject(InterceptorStackBuilder.java:52)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:60)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:68)
>>
>>   ... 117 more
>>
>> Caused by: java.lang.RuntimeException: Error invoking service builder
>> method
>> org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger,
>> List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service
>> 'HibernateSessionSource'): org/apache/commons/collections/map/LRUMap
>>
>>   at
>> org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:76)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)
>>
>>   at
>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)
>>
>>   ... 131 more
>>
>> *Caused by: java.lang.NoClassDefFoundError:
>> org/apache/commons/collections/map/LRUMap*
>>
>>   at org.hibernate.util.SimpleMRUCache.init(SimpleMRUCache.java:71)
>>
>>   at org.hibernate.util.SimpleMRUCache.<init>(SimpleMRUCache.java:55)
>>
>>   at org.hibernate.util.SimpleMRUCache.<init>(SimpleMRUCache.java:50)
>>
>>   at
>> org.hibernate.engine.query.QueryPlanCache.<init>(QueryPlanCache.java:65)
>>
>>   at
>> org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:182)
>>
>>   at
>> org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
>>
>>   at
>> org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
>>
>>   at
>> org.apache.tapestry5.internal.hibernate.HibernateSessionSourceImpl.<init>(HibernateSessionSourceImpl.java:45)
>>
>>   at
>> org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(HibernateCoreModule.java:123)
>>
>>   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.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:64)
>>
>>
>> The part that stands out to me is:
>>
>> **Caused by: java.lang.NoClassDefFoundError:
>> org/apache/commons/collections/map/LRUMap**
>>
>> My best guess is that this is a result of the JasperReports 3.7.4
>> dependency, as I isolated this to only occur when code dependent on this
>> library is in the application. When I use the Chenillekit-Reports dependency
>> instead, this exception goes away. A bit interesting... this exception
>> doesn't actually affect my application since I can use the
>> Chenillekit-Reports jar, but it seemed worthwhile to mention the
>> incompatibility.
>>
>> When I use the ChenilleKit-Reports dependency though, I get the same
>> exception in my AppModule as ChenilleKitReportsModule from a null in the
>> buildReportsService method.
>>
>> Regards,
>> Rich
>>
>> Rich wrote:
>>>
>>> Hi,
>>>
>>> I have to integrate some Jasper reports into a Tapestry web app and I
>>> came across Chenillekit-reports, which seems like it might be a solution.
>>> I'm having a hard time finding any useful documentation related to it
>>> though. Are there any web resources available explaining implementation or
>>> should I just work my way through the source code? I'm assuming this is the
>>> best implementation of JasperReports into Tapestry at this point in time,
>>> but if there are other options I'm all ears.
>>>
>>> Regards,
>>> Rich
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
--
http://www.bodylabgym.com - a private, by appointment only, one-on-one
health and fitness facility.
--
http://www.ectransition.com - Quality Electronic Cigarettes at a
reasonable price!
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: JasperReports / Chenillekit-reports documentation

Posted by Rich <ri...@moremagic.com>.
Continuing the soliloquy...

I got past the Module exception by allowing the configuration map to be 
null when building the JRProperties settings so it just uses default 
settings.

I'm still having issues grasping the logic of getting the correct 
output. Using the OutputStream as I mentioned before half works. HTML 
doesn't display, CSV comes out good, PDF doesn't work and complains of 
document type "text/plain", while XLS returns 
java.lang.ClassNotFoundException 
org.apache.poi.hssf.usermodel.HSSFCellStyle (maybe this is related to 
the same issues with the JasperReports jar dependency not working)

So sort of progress, but not really. It doesn't seem like setting the 
content-type of the OutputStream does anything worthwhile. Can someone 
help explain? I get the feeling the OutputStream I'm using/or how I'm 
using isn't right.

@Inject private Response resp;

private OutputStream os;

@Property @Persist

    private ExportFormat formMode;

    

    @Component

    private Submit CSV;

    

    @Component

    private Submit HTML;

    

    @Component

    private Submit PDF;

    

    @Component

    private Submit XLS;

    

    void onSelectedFromCSV(){

        formMode = ExportFormat.CSV;

        try {

            os = resp.getOutputStream("text/comma-separated-values");

            debug("OutputStream content-type="+"text/comma-separated-values");

        } catch (IOException e) {

            error(e.toString());

            throw new TapestryException("Could not get CSV output stream", e);

        }

    }

    

    void onSelectedFromHTML(){

        formMode= ExportFormat.HTML;

        try {

            os = resp.getOutputStream("text/html");

            debug("OutputStream content-type="+"text/html");

        } catch (IOException e) {

            error(e.toString());

            throw new TapestryException("Could not get HTML output stream", e);

        }

    }

    

    void onSelectedFromPDF(){

        formMode = ExportFormat.PDF;

        try {

            os = resp.getOutputStream("application/pdf");

            debug("OutputStream content-type="+"application/pdf");

        } catch (IOException e) {

            error(e.toString());

            throw new TapestryException("Could not get PDF output stream", e);

        }

    }

    

    void onSelectedFromXLS(){

        formMode = ExportFormat.XLS;

        try {

            os = resp.getOutputStream("application/vnd.ms-excel");

            debug("OutputStream content-type="+"application/vnd.ms-excel");

        } catch (IOException e) {

            error(e.toString());

            throw new TapestryException("Could not get XLS output stream", e);

        }

    }

Thanks,
Rich

Rich wrote:
> Hi again,
>
> well it seems the source code wasn't that involved, just a nice 
> wrapper mostly over the file formats. It doesn't seem to have built-in 
> JDBC connection support, so I wrote a modified version that takes an 
> Object for dataSource and then dictates the proper 
> JasperFillManager.FillReport method depending on a JRDataSource or 
> Connection object. That aside, I could use some advice into applying 
> the FillAndExport method :
>
> /**
>      * export the report.
>      *
>      * @param inputResource the input resource (report template file 
> ".jrxml")
>      * @param format        the output format
>      * @param parameterMap  the parameter map
>      * @param dataSource    the datasource. Either a JDBC SQL 
> Connection or JRDataSource object
>      * @param outputStream  the output stream
>      */
>     public void fillAndExport(Resource inputResource, ExportFormat 
> format, Map parameterMap, Object dataSource, OutputStream outputStream)
>     {
>         JasperPrint jasperPrint = fillReport(inputResource, 
> parameterMap, dataSource);
>         export(jasperPrint, format, outputStream);
>     }
>
> In older code at my company (JSP-Servlet based), we typically build 
> the parameterMap, hand load the inputResource in a File object, and 
> then define the format/content-type in the HTTPResponse and connect 
> the HTTPResponse's outputStream into the export method. At this point 
> the intended results are displayed.
>
> To mirror this, I found the Response service in Tapestry, and use the 
> getOutputStream(contentType) method, setting the appropriate 
> content-type string in the call. Can I expect this to work as I intend 
> (displaying/triggering the browser through this stream)?
>
>
> I'm calling the function like this:
>
> public void onSuccessFromRepForm(){
>
>        Map parameterMap = loadParameters(reportTitle);
>
>        Connection conn = null;
>
>        try{
>
>            conn = Report.getConnection();
>
>            rs.fillAndExport(new 
> ContextResource(cimpl,reportTitle+".xml"), formMode, parameterMap, 
> conn, os);
>
>        }catch (Exception e){
>
>            System.out.println("Caught exception while trying to 
> execute the report fillAndExport service method.");
>
>            throw new TapestryException("Issue executing report", e);
>
>        } finally {
>
>            if(conn != null){
>
>                try {
>
>                    conn.close();
>
>                } catch (SQLException e) {
>
>                    System.out.println("Could not close the JDBC 
> connection!!");
>
>                }
>
>            }
>
>        }
>
> }
>
>
> cimpl is an injection of the Tapestry Context service, formMode is a 
> page property, and os is the loaded Response OutputStream. When I try 
> to test this (this was before I made the JDBC Connection change) I get 
> the following Exception from the ChenilleKitReportsModule (:
>
> Exception constructing service 'ReportsService': Error invoking 
> service builder method
> org.chenillekit.reports.ChenilleKitReportsModule.buildReportsService(Logger,Map) 
> (at ChenilleKitReportsModule.java:43) (for service 'ReportsService'): 
> Parameter configuration was null.
>
> From the module:
>
> public static ReportsService buildReportService(Logger logger, 
> Map<String, Resource> configuration)
>    {
>        return new ReportsServiceImpl(logger, 
> configuration.get(ReportsService.CONFIG_RESOURCE_KEY));
>    }
>
>
> I'm assuming this is because I don't have a line in my AppModule where 
> i add to the configuration a mapping for "jasperreports.properties" 
> (resolution of ReportsService.CONFIG_RESOURCE_KEY), but I'm also not 
> sure what this is supposed to be mapping to.
>
> Things break worse when I use my own extended version including JDBC 
> Connections:
>
> Caused by: java.lang.RuntimeException: Exception constructing service 
> 'ValueEncoderSource': Error invoking service builder method 
> org.apache.tapestry5.services.TapestryModule.buildValueEncoderSource(Map, 
> InvalidationEventHub) (at TapestryModule.java:1910) (for service 
> 'ValueEncoderSource'): Error invoking service contribution method 
> org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration, 
> boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess, 
> LoggerSource): Exception constructing service 
> 'HibernateSessionSource': Error invoking service builder method 
> org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger, 
> List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for 
> service 'HibernateSessionSource'): 
> org/apache/commons/collections/map/LRUMap
>
>    at 
> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:78) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:57) 
>
>
>    at 
> $ValueEncoderSource_12a14ccbea5.delegate($ValueEncoderSource_12a14ccbea5.java) 
>
>
>    at 
> $ValueEncoderSource_12a14ccbea5.getValueEncoder($ValueEncoderSource_12a14ccbea5.java) 
>
>
>    at 
> org.apache.tapestry5.internal.services.ComponentDefaultProviderImpl.defaultValueEncoder(ComponentDefaultProviderImpl.java:116) 
>
>
>    at 
> $ComponentDefaultProvider_12a14ccbe71.defaultValueEncoder($ComponentDefaultProvider_12a14ccbe71.java) 
>
>
>    at 
> org.apache.tapestry5.corelib.components.Loop.defaultEncoder(Loop.java:304) 
>
>
>    at 
> org.apache.tapestry5.corelib.components.Loop.containingPageDidLoad(Loop.java) 
>
>
>    at 
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$4.run(ComponentPageElementImpl.java:98) 
>
>
>    at 
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:933) 
>
>
>    ... 55 more
>
> Caused by: java.lang.RuntimeException: Error invoking service builder 
> method 
> org.apache.tapestry5.services.TapestryModule.buildValueEncoderSource(Map, 
> InvalidationEventHub) (at TapestryModule.java:1910) (for service 
> 'ValueEncoderSource'): Error invoking service contribution method 
> org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration, 
> boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess, 
> LoggerSource): Exception constructing service 
> 'HibernateSessionSource': Error invoking service builder method 
> org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger, 
> List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for 
> service 'HibernateSessionSource'): 
> org/apache/commons/collections/map/LRUMap
>
>    at 
> org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:76) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:29) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:46) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.AdvisorStackBuilder.createObject(AdvisorStackBuilder.java:60) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.InterceptorStackBuilder.createObject(InterceptorStackBuilder.java:52) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:60) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:68) 
>
>
>    ... 64 more
>
> Caused by: java.lang.RuntimeException: Error invoking service 
> contribution method 
> org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration, 
> boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess, 
> LoggerSource): Exception constructing service 
> 'HibernateSessionSource': Error invoking service builder method 
> org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger, 
> List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for 
> service 'HibernateSessionSource'): 
> org/apache/commons/collections/map/LRUMap
>
>    at 
> org.apache.tapestry5.ioc.internal.ContributionDefImpl.invokeMethod(ContributionDefImpl.java:122) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.ContributionDefImpl.contribute(ContributionDefImpl.java:71) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.RegistryImpl$4.run(RegistryImpl.java:470) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl$1.invoke(OperationTrackerImpl.java:52) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl$1.invoke(OperationTrackerImpl.java:50) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:48) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.run(PerThreadOperationTracker.java:56) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.RegistryImpl.addToMappedConfiguration(RegistryImpl.java:466) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.RegistryImpl.getMappedConfiguration(RegistryImpl.java:416) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.ServiceResourcesImpl$3.invoke(ServiceResourcesImpl.java:126) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.ServiceResourcesImpl$3.invoke(ServiceResourcesImpl.java:124) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.ServiceResourcesImpl.getMappedConfiguration(ServiceResourcesImpl.java:120) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.AbstractServiceCreator.getMappedConfiguration(AbstractServiceCreator.java:142) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.AbstractServiceCreator.access$300(AbstractServiceCreator.java:35) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.AbstractServiceCreator$1.findResource(AbstractServiceCreator.java:107) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.util.DelegatingInjectionResources.findResource(DelegatingInjectionResources.java:38) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateInjection(InternalUtils.java:201) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.util.InternalUtils.access$000(InternalUtils.java:43) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.util.InternalUtils$2.invoke(InternalUtils.java:256) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParameters(InternalUtils.java:260) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParametersForMethod(InternalUtils.java:217) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:56) 
>
>
>    ... 80 more
>
> Caused by: java.lang.RuntimeException: Exception constructing service 
> 'HibernateSessionSource': Error invoking service builder method 
> org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger, 
> List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for 
> service 'HibernateSessionSource'): 
> org/apache/commons/collections/map/LRUMap
>
>    at 
> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:78) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:57) 
>
>
>    at 
> $HibernateSessionSource_12a14ccbe30.delegate($HibernateSessionSource_12a14ccbe30.java) 
>
>
>    at 
> $HibernateSessionSource_12a14ccbe30.getConfiguration($HibernateSessionSource_12a14ccbe30.java) 
>
>
>    at 
> org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(HibernateModule.java:89) 
>
>
>    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.apache.tapestry5.ioc.internal.ContributionDefImpl.invokeMethod(ContributionDefImpl.java:110) 
>
>
>    ... 108 more
>
> Caused by: org.apache.tapestry5.ioc.internal.OperationException: Error 
> invoking service builder method 
> org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger, 
> List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for 
> service 'HibernateSessionSource'): 
> org/apache/commons/collections/map/LRUMap
>
>    at 
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:90) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:29) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:46) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.AdvisorStackBuilder.createObject(AdvisorStackBuilder.java:60) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.InterceptorStackBuilder.createObject(InterceptorStackBuilder.java:52) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:60) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:68) 
>
>
>    ... 117 more
>
> Caused by: java.lang.RuntimeException: Error invoking service builder 
> method 
> org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger, 
> List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for 
> service 'HibernateSessionSource'): 
> org/apache/commons/collections/map/LRUMap
>
>    at 
> org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:76) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45) 
>
>
>    at 
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68) 
>
>
>    ... 131 more
>
> *Caused by: java.lang.NoClassDefFoundError: 
> org/apache/commons/collections/map/LRUMap*
>
>    at org.hibernate.util.SimpleMRUCache.init(SimpleMRUCache.java:71)
>
>    at org.hibernate.util.SimpleMRUCache.<init>(SimpleMRUCache.java:55)
>
>    at org.hibernate.util.SimpleMRUCache.<init>(SimpleMRUCache.java:50)
>
>    at 
> org.hibernate.engine.query.QueryPlanCache.<init>(QueryPlanCache.java:65)
>
>    at 
> org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:182)
>
>    at 
> org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341) 
>
>
>    at 
> org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867) 
>
>
>    at 
> org.apache.tapestry5.internal.hibernate.HibernateSessionSourceImpl.<init>(HibernateSessionSourceImpl.java:45) 
>
>
>    at 
> org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(HibernateCoreModule.java:123) 
>
>
>    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.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:64) 
>
>
>
> The part that stands out to me is:
>
> **Caused by: java.lang.NoClassDefFoundError: 
> org/apache/commons/collections/map/LRUMap**
>
> My best guess is that this is a result of the JasperReports 3.7.4 
> dependency, as I isolated this to only occur when code dependent on 
> this library is in the application. When I use the Chenillekit-Reports 
> dependency instead, this exception goes away. A bit interesting... 
> this exception doesn't actually affect my application since I can use 
> the Chenillekit-Reports jar, but it seemed worthwhile to mention the 
> incompatibility.
>
> When I use the ChenilleKit-Reports dependency though, I get the same 
> exception in my AppModule as ChenilleKitReportsModule from a null in 
> the buildReportsService method.
>
> Regards,
> Rich
>
> Rich wrote:
>> Hi,
>>
>> I have to integrate some Jasper reports into a Tapestry web app and I 
>> came across Chenillekit-reports, which seems like it might be a 
>> solution. I'm having a hard time finding any useful documentation 
>> related to it though. Are there any web resources available 
>> explaining implementation or should I just work my way through the 
>> source code? I'm assuming this is the best implementation of 
>> JasperReports into Tapestry at this point in time, but if there are 
>> other options I'm all ears.
>>
>> Regards,
>> Rich
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: JasperReports / Chenillekit-reports documentation

Posted by Rich <ri...@moremagic.com>.
Hi again,

well it seems the source code wasn't that involved, just a nice wrapper 
mostly over the file formats. It doesn't seem to have built-in JDBC 
connection support, so I wrote a modified version that takes an Object 
for dataSource and then dictates the proper JasperFillManager.FillReport 
method depending on a JRDataSource or Connection object. That aside, I 
could use some advice into applying the FillAndExport method :

/**
	 * export the report.
	 *
	 * @param inputResource the input resource (report template file ".jrxml")
	 * @param format		the output format
	 * @param parameterMap  the parameter map
	 * @param dataSource	the datasource. Either a JDBC SQL Connection or JRDataSource object
	 * @param outputStream  the output stream
	 */
	public void fillAndExport(Resource inputResource, ExportFormat format, Map parameterMap, Object dataSource, OutputStream outputStream)
	{
		JasperPrint jasperPrint = fillReport(inputResource, parameterMap, dataSource);
		export(jasperPrint, format, outputStream);
	}

In older code at my company (JSP-Servlet based), we typically build the 
parameterMap, hand load the inputResource in a File object, and then 
define the format/content-type in the HTTPResponse and connect the 
HTTPResponse's outputStream into the export method. At this point the 
intended results are displayed.

To mirror this, I found the Response service in Tapestry, and use the 
getOutputStream(contentType) method, setting the appropriate 
content-type string in the call. Can I expect this to work as I intend 
(displaying/triggering the browser through this stream)?


I'm calling the function like this:

public void onSuccessFromRepForm(){

        Map parameterMap = loadParameters(reportTitle);

        Connection conn = null;

        try{

            conn = Report.getConnection();

            rs.fillAndExport(new ContextResource(cimpl,reportTitle+".xml"), formMode, parameterMap, conn, os);

        }catch (Exception e){

            System.out.println("Caught exception while trying to execute the report fillAndExport service method.");

            throw new TapestryException("Issue executing report", e);

        } finally {

            if(conn != null){

                try {

                    conn.close();

                } catch (SQLException e) {

                    System.out.println("Could not close the JDBC connection!!");

                }

            }

        }

}


cimpl is an injection of the Tapestry Context service, formMode is a 
page property, and os is the loaded Response OutputStream. When I try to 
test this (this was before I made the JDBC Connection change) I get the 
following Exception from the ChenilleKitReportsModule (:

Exception constructing service 'ReportsService': Error invoking service builder method
org.chenillekit.reports.ChenilleKitReportsModule.buildReportsService(Logger,Map) (at ChenilleKitReportsModule.java:43) 
(for service 'ReportsService'): Parameter configuration was null.

>From the module:

public static ReportsService buildReportService(Logger logger, Map<String, Resource> configuration)
    {
        return new ReportsServiceImpl(logger, configuration.get(ReportsService.CONFIG_RESOURCE_KEY));
    }


I'm assuming this is because I don't have a line in my AppModule where i 
add to the configuration a mapping for "jasperreports.properties" 
(resolution of ReportsService.CONFIG_RESOURCE_KEY), but I'm also not 
sure what this is supposed to be mapping to.

Things break worse when I use my own extended version including JDBC 
Connections:

Caused by: java.lang.RuntimeException: Exception constructing service 'ValueEncoderSource': Error invoking service builder method org.apache.tapestry5.services.TapestryModule.buildValueEncoderSource(Map, InvalidationEventHub) (at TapestryModule.java:1910) (for service 'ValueEncoderSource'): Error invoking service contribution method org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration, boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess, LoggerSource): Exception constructing service 'HibernateSessionSource': Error invoking service builder method org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger, List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service 'HibernateSessionSource'): org/apache/commons/collections/map/LRUMap

    at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:78)

    at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:57)

    at $ValueEncoderSource_12a14ccbea5.delegate($ValueEncoderSource_12a14ccbea5.java)

    at $ValueEncoderSource_12a14ccbea5.getValueEncoder($ValueEncoderSource_12a14ccbea5.java)

    at org.apache.tapestry5.internal.services.ComponentDefaultProviderImpl.defaultValueEncoder(ComponentDefaultProviderImpl.java:116)

    at $ComponentDefaultProvider_12a14ccbe71.defaultValueEncoder($ComponentDefaultProvider_12a14ccbe71.java)

    at org.apache.tapestry5.corelib.components.Loop.defaultEncoder(Loop.java:304)

    at org.apache.tapestry5.corelib.components.Loop.containingPageDidLoad(Loop.java)

    at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$4.run(ComponentPageElementImpl.java:98)

    at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:933)

    ... 55 more

Caused by: java.lang.RuntimeException: Error invoking service builder method org.apache.tapestry5.services.TapestryModule.buildValueEncoderSource(Map, InvalidationEventHub) (at TapestryModule.java:1910) (for service 'ValueEncoderSource'): Error invoking service contribution method org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration, boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess, LoggerSource): Exception constructing service 'HibernateSessionSource': Error invoking service builder method org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger, List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service 'HibernateSessionSource'): org/apache/commons/collections/map/LRUMap

    at org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:76)

    at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)

    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)

    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)

    at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)

    at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49)

    at org.apache.tapestry5.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:29)

    at org.apache.tapestry5.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:46)

    at org.apache.tapestry5.ioc.internal.AdvisorStackBuilder.createObject(AdvisorStackBuilder.java:60)

    at org.apache.tapestry5.ioc.internal.InterceptorStackBuilder.createObject(InterceptorStackBuilder.java:52)

    at org.apache.tapestry5.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:60)

    at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)

    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)

    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)

    at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)

    at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49)

    at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:68)

    ... 64 more

Caused by: java.lang.RuntimeException: Error invoking service contribution method org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration, boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess, LoggerSource): Exception constructing service 'HibernateSessionSource': Error invoking service builder method org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger, List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service 'HibernateSessionSource'): org/apache/commons/collections/map/LRUMap

    at org.apache.tapestry5.ioc.internal.ContributionDefImpl.invokeMethod(ContributionDefImpl.java:122)

    at org.apache.tapestry5.ioc.internal.ContributionDefImpl.contribute(ContributionDefImpl.java:71)

    at org.apache.tapestry5.ioc.internal.RegistryImpl$4.run(RegistryImpl.java:470)

    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl$1.invoke(OperationTrackerImpl.java:52)

    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl$1.invoke(OperationTrackerImpl.java:50)

    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)

    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:48)

    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.run(PerThreadOperationTracker.java:56)

    at org.apache.tapestry5.ioc.internal.RegistryImpl.addToMappedConfiguration(RegistryImpl.java:466)

    at org.apache.tapestry5.ioc.internal.RegistryImpl.getMappedConfiguration(RegistryImpl.java:416)

    at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl$3.invoke(ServiceResourcesImpl.java:126)

    at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl$3.invoke(ServiceResourcesImpl.java:124)

    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)

    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)

    at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)

    at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl.getMappedConfiguration(ServiceResourcesImpl.java:120)

    at org.apache.tapestry5.ioc.internal.AbstractServiceCreator.getMappedConfiguration(AbstractServiceCreator.java:142)

    at org.apache.tapestry5.ioc.internal.AbstractServiceCreator.access$300(AbstractServiceCreator.java:35)

    at org.apache.tapestry5.ioc.internal.AbstractServiceCreator$1.findResource(AbstractServiceCreator.java:107)

    at org.apache.tapestry5.ioc.internal.util.DelegatingInjectionResources.findResource(DelegatingInjectionResources.java:38)

    at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateInjection(InternalUtils.java:201)

    at org.apache.tapestry5.ioc.internal.util.InternalUtils.access$000(InternalUtils.java:43)

    at org.apache.tapestry5.ioc.internal.util.InternalUtils$2.invoke(InternalUtils.java:256)

    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)

    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)

    at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)

    at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParameters(InternalUtils.java:260)

    at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParametersForMethod(InternalUtils.java:217)

    at org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:56)

    ... 80 more

Caused by: java.lang.RuntimeException: Exception constructing service 'HibernateSessionSource': Error invoking service builder method org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger, List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service 'HibernateSessionSource'): org/apache/commons/collections/map/LRUMap

    at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:78)

    at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:57)

    at $HibernateSessionSource_12a14ccbe30.delegate($HibernateSessionSource_12a14ccbe30.java)

    at $HibernateSessionSource_12a14ccbe30.getConfiguration($HibernateSessionSource_12a14ccbe30.java)

    at org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(HibernateModule.java:89)

    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.apache.tapestry5.ioc.internal.ContributionDefImpl.invokeMethod(ContributionDefImpl.java:110)

    ... 108 more

Caused by: org.apache.tapestry5.ioc.internal.OperationException: Error invoking service builder method org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger, List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service 'HibernateSessionSource'): org/apache/commons/collections/map/LRUMap

    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:90)

    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)

    at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)

    at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49)

    at org.apache.tapestry5.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:29)

    at org.apache.tapestry5.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:46)

    at org.apache.tapestry5.ioc.internal.AdvisorStackBuilder.createObject(AdvisorStackBuilder.java:60)

    at org.apache.tapestry5.ioc.internal.InterceptorStackBuilder.createObject(InterceptorStackBuilder.java:52)

    at org.apache.tapestry5.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:60)

    at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)

    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)

    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)

    at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)

    at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49)

    at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:68)

    ... 117 more

Caused by: java.lang.RuntimeException: Error invoking service builder method org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger, List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service 'HibernateSessionSource'): org/apache/commons/collections/map/LRUMap

    at org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:76)

    at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)

    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)

    ... 131 more

*Caused by: java.lang.NoClassDefFoundError: org/apache/commons/collections/map/LRUMap*

    at org.hibernate.util.SimpleMRUCache.init(SimpleMRUCache.java:71)

    at org.hibernate.util.SimpleMRUCache.<init>(SimpleMRUCache.java:55)

    at org.hibernate.util.SimpleMRUCache.<init>(SimpleMRUCache.java:50)

    at org.hibernate.engine.query.QueryPlanCache.<init>(QueryPlanCache.java:65)

    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:182)

    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)

    at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)

    at org.apache.tapestry5.internal.hibernate.HibernateSessionSourceImpl.<init>(HibernateSessionSourceImpl.java:45)

    at org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(HibernateCoreModule.java:123)

    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.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:64)


The part that stands out to me is:

**Caused by: java.lang.NoClassDefFoundError: org/apache/commons/collections/map/LRUMap**

My best guess is that this is a result of the JasperReports 3.7.4 
dependency, as I isolated this to only occur when code dependent on this 
library is in the application. When I use the Chenillekit-Reports 
dependency instead, this exception goes away. A bit interesting... this 
exception doesn't actually affect my application since I can use the 
Chenillekit-Reports jar, but it seemed worthwhile to mention the 
incompatibility.

When I use the ChenilleKit-Reports dependency though, I get the same 
exception in my AppModule as ChenilleKitReportsModule from a null in the 
buildReportsService method.

Regards,
Rich

Rich wrote:
> Hi,
>
> I have to integrate some Jasper reports into a Tapestry web app and I 
> came across Chenillekit-reports, which seems like it might be a 
> solution. I'm having a hard time finding any useful documentation 
> related to it though. Are there any web resources available explaining 
> implementation or should I just work my way through the source code? 
> I'm assuming this is the best implementation of JasperReports into 
> Tapestry at this point in time, but if there are other options I'm all 
> ears.
>
> Regards,
> Rich
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org