srividya_sharma

FusionCharts Exporter Jars For Different Java Versions

Recommended Posts

Hi everybody,

The fusionchartsexporter.jar provided with the v3.1 download is for java6.

Many users are using java5 or the all-time favourite jdk1.4.2.

I thought it might be useful to post the fusioncharts exporter jar for these versions here.

Srividya

Share this post


Link to post
Share on other sites

SERVLET IMPLEMENTATION OF EXPORT HANDLERS

Hi everybody,

Until the last release of FusionCharts v3.1, there have been only JSP-based examples of using FusionCharts. However, with the onset of the export handlers, users seem to want the Servlet Implementation of the Export fetaure, and this is understandable, since complex java code  should ideally not be written in a JSP.

So here is the servlet implementation of the Export Handlers  ( that comes in the download package ).

The Servlet Implementation is formed by taking the code present in the JSP Export Handlers and putting them in one Servlet & 3 Support classes. Total 4 Classes.

The Servlet Implementation in turn uses the FusionCharts exporter jar.

So to get the Servlet Export feature working in your environment, you would need to just place two jars -

1. fcexporter.jar ( available in the download package or in this topic for other java versions)

2. fc_servlet_exporter_java5.jar ( attached with this post )

Shown below is the servlet description you might need to include in your application's web.xml:

 <servlet>
   <description></description>
   <display-name>FCExporter</display-name>
   <servlet-name>FCExporter</servlet-name>
   <servlet-class>com.fusioncharts.exporter.servlet.FCExporter</servlet-class>
  </servlet>
  <servlet-mapping>
   <servlet-name>FCExporter</servlet-name>
   <url-pattern>/FCExporter</url-pattern>
  </servlet-mapping>

In your chart xml, for the exportHandler attribute give the value 'FCExporter' - the name of the FCExporter servlet in your web.xml as defined above.

In the properties file ( fusioncharts_export.properties ), please ensure that the RESOURCEPATH has value as follows:

#Package name of the resource handlers, ending with dot

#DO NOT MODIFY THIS!!

RESOURCEPATH=com.fusioncharts.exporter.resources.

Hope this provides a clean way of using the server-side export feature in your Java Web Application. :)

Please inform me, in case you come across any issues with this jar.

PLEASE NOTE: THIS SERVLET HANDLER IS FOR JAVA 6. JAVA 5 VERSION IS PRESENT IN THE POST BELOW. ( http://www.fusioncharts.com/forum/FindPost17327.aspx )

regards,

Srividya

fc_servlet_exporter_java6.zip

Edited by Guest

Share this post


Link to post
Share on other sites

Although the file is called

fc_servlet_exporter_java5.zip
, I think it might be compiled for Java 6 rather than 5 - do you have a Java 5 version?

 

 

 

cheers

 

 

 

Chris

Share this post


Link to post
Share on other sites

Hi Chris,

Here is the FusionCharts servlet exporter jar for jdk1.4.2 and above.

I have corrected the jar.

I have renamed the jar in the earlier post http://www.fusioncharts.com/forum/FindPost15615.aspx to reflect Java6.

Please contact me in case of any issues.

regards,

Srividya

Ask and get more out of FusionCharts everyday!

fc_servlet_exporter_jdk1_4_2.zip

Edited by Guest

Share this post


Link to post
Share on other sites

Additional information:

In your chart xml, for the exportHandler attribute give the value 'FCExporter' - the name of the FCExporter servlet in your web.xml as defined above.

In the properties file ( fusioncharts_export.properties ), please ensure that the RESOURCEPATH has value as follows:

#Package name of the resource handlers, ending with dot

#DO NOT MODIFY THIS!!

RESOURCEPATH=com.fusioncharts.exporter.resources.

Srividya

Share this post


Link to post
Share on other sites

Hi Srividya,

 

I tried using above given Servlet Example but was getting exception while downloading the chart as jpeg , png and pdf but in every case i was getting .bad version exception.

 

 

 

I tried using uploaded servlet jar for 1.4 as well as 1.5.

 

 

 

Are you sure these are correct jar's.

 

 

 

I'm attaching my data.xml please see if correct me if i'm wrong.

 

 

 

My version of Java is 1.5.15.

 

 

 

Regards,

 

Sarvesh

chart_fusiontest.xml

Share this post


Link to post
Share on other sites

While using

 

a) fc_servlet_exporter_jdk1_4_2.jar

 

:) fcexporter_java5.jar

 

 

 

My Version of Java is jdk 1.5.15 weblogic version is 9.2 and jdk used by weblogic is 1.5.15.

 

 

 

I'm getting exception after implementing Servlet example shown above to export charts using server side code.

 

 

 

 

 

Error 500--Internal Server Error

 

javax.servlet.ServletException: [HTTP:101249][weblogic.servlet.internal.WebAppServletContext@126cdd1 - appName: '_appsdir_iris_app_dir', name: 'iris_app', context-path: '/iris_app']: Servlet class com.fusioncharts.exporter.servlet.FCExporter for servlet FCExporter could not be loaded because the requested class was not found in the classpath .

 

java.lang.UnsupportedClassVersionError: Bad version number in .class file.

 

at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:519)

 

at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:235)

 

at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)

 

at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)

 

at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:26)

 

at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)

 

at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3242)

 

at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)

 

at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)

 

at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2010)

 

at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1916)

 

at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1366)

 

at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)

 

at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)

 

 

 

 

 

 

 

 

 

Wanted to know the reason and what should i do to resolve this problem.

 

Any Help will be appriciated.

 

 

 

What are the exact jar's i need to import so that i can resolve this problem.

 

 

 

Regards,

 

Sarvesh Sharma

Share this post


Link to post
Share on other sites

Hi Vidya,

 

I appriciate your reply but that jar gives me same exception can you please recheck the same as can it be used with java version 1.5.15 this has been built in 1.4 rt?

 

 

 

Regrads,

 

Sarvesh Sharma

Share this post


Link to post
Share on other sites

Hi Vidya,

 

That servlet thing worked for in java version 1.5.15 but for PDF only.

 

What i did is used decompiler to create java files and compiled all the created java files in my java version but was not able to compile FCExporter_IMG.java as it was having some error. I am sending you the java file created using decompiler.

 

 

 

Can you please look at it and check what are these error.

 

 

 

Will wait for your response.

 

 

 

Regards,

 

Sarvesh

FCExporter_IMG.java.txt

Share this post


Link to post
Share on other sites

These are the errors while compiling the Source File. :

 

 

 

----------------------------------------------------------------------------------------------------------

 

 

 

[iajc] error at String meta_values = exportBean.getMetadataAsQueryString(null, true, isHTML);

 

[iajc]

 

[iajc] C:WKS_TRUNKNEWIrisAppsrccomfusionchartsexporterresourcesFCExporter_IMG.java:152:0::0 Duplicate local variable meta_values

 

[iajc] error at String meta_values = exportBean.getMetadataAsQueryString(null, true, isHTML);

 

[iajc]

 

[iajc] C:WKS_TRUNKNEWIrisAppsrccomfusionchartsexporterresourcesFCExporter_IMG.java:172:0::0 Duplicate local variable meta_values

 

[iajc] error at String meta_values = exportBean.getMetadataAsQueryString(null, true, isHTML);

 

[iajc]

 

[iajc] C:WKS_TRUNKNEWIrisAppsrccomfusionchartsexporterresourcesFCExporter_IMG.java:189:0::0 Duplicate local variable meta_values

 

[iajc] MessageHolder: (630 info) (3 error)

 

 

 

----------------------------------------------------------------------------------------------------------

 

 

 

 

 

If i replace these duplicate variables(meta_values) with original one then it throws :

 

 

 

--------------------------------------------------------------------------------------------------------------

 

 

 

[iajc] error at break MISSING_BLOCK_LABEL_1073;

 

[iajc] ^^^^^^^^^^^^^^^^^^

 

[iajc] C:WKS_TRUNKNEWIrisAppsrccomfusionchartsexporterresourcesFCExporter_IMG.java:125:0::0 The label MISSING_BLOCK_LABEL_1073 is missing

 

[iajc] error at os = response.getOutputStream();

 

[iajc] ^^^^^^^^^^^^^^^^^

 

[iajc] C:WKS_TRUNKNEWIrisAppsrccomfusionchartsexporterresourcesFCExporter_IMG.java:129:0::0 Unhandled exception type IOException

 

[iajc] error at break MISSING_BLOCK_LABEL_935;

 

[iajc] ^^^^^^^^^^^^^^^^^

 

[iajc] C:WKS_TRUNKNEWIrisAppsrccomfusionchartsexporterresourcesFCExporter_IMG.java:139:0::0 The label MISSING_BLOCK_LABEL_935 is missing

 

[iajc] error at break MISSING_BLOCK_LABEL_929;

 

[iajc] ^^^^^^^^^^^^^^^^^

 

[iajc] C:WKS_TRUNKNEWIrisAppsrccomfusionchartsexporterresourcesFCExporter_IMG.java:146:0::0 The label MISSING_BLOCK_LABEL_929 is missing

 

[iajc] error at PrintWriter out = response.getWriter();

 

[iajc] ^^^^^^^

 

[iajc] C:WKS_TRUNKNEWIrisAppsrccomfusionchartsexporterresourcesFCExporter_IMG.java:155:0::0 Unhandled exception type IOException

 

[iajc] error at chartImage = null;

 

[iajc] ^^^^^^^^^

 

[iajc] C:WKS_TRUNKNEWIrisAppsrccomfusionchartsexporterresourcesFCExporter_IMG.java:159:0::0 Unreachable code

 

 

 

------------------------------------------------------------------------------------------------------------------

 

 

 

Can you please have a look at that and send me the correct file which i can compile in version 1.5.

 

Will look forward to your mail.

 

 

 

Thanks and Regards,

 

Sarvesh Sharma

Share this post


Link to post
Share on other sites

Thanks Vidya,

 

It worked fine.

 

Problem was i suppose with the code which i decompiled from the .class file to java file using a decompiler it was adding some junk error codes which was not present i the original file.

 

 

 

Anyways finally it worked Thanks for your timely support.

 

 

 

Regards,

 

Sarvesh Sharma

Share this post


Link to post
Share on other sites
Guest Madhumita

Hello,

We are glad that we could help you. Happy FusionCharting. :)

To add to it....Srividya ROCKS!

Share this post


Link to post
Share on other sites

Hi all,

 

Please note that all these exporter code and jars are for FusionCharts v >= 3.1 and < 3.2

 

For v3.2, the exporter jar provided with the download package is for Java 5.

 

If you require exporter jars for other java versions for FusionCharts v >= 3.2, please post here.

 

regards,

Srividya Sharma

Share this post


Link to post
Share on other sites

Dear Srividya Sharma,

 

I am using FusionCharts v3.1, when compile it gave me unsupported class version error, only then I found out I am using JDK1.3.1_02.

Do you have exporter JAR for this JDK1.3.1_02? I can't switch to higher JDK because have to follow the production server JDK version.

Share this post


Link to post
Share on other sites

Hi,

 

This servlet can be used only for single chart export.

 

Srividya

 

 

Hello Srividya :)

 

If there any way to export more than one chart?? (sorry for my bad english first hehe) Here is my scenario: I have a page which includes two charts, and i have to take all the information in the page and paste it to an excel file (through Poi). In order to paste the charts i need to save them on the server and then load them in the excel file. I don't know if there other way to storage my charts into .jpg files on server-side

 

Thanks in advance!!

Eugenia

 

 

Share this post


Link to post
Share on other sites
SAVEPATH=./images/


 

 

I have fusioncharts_export.properties as above. We need to have HTTP_URL to be dynamic. Now I have localhost:8080 but later i need to have myapp.com. I need to make it to take my application URL automatically in fusionchart export. How can I do this? Please help me. Thanks.

Share this post


Link to post
Share on other sites
SAVEPATH=./images/


 

 

I have fusioncharts_export.properties as above. We need to have HTTP_URL to be dynamic. Can i ignore this property HTTP_URL as I cannot hardcode the ip and port . Will the SAVEPATH property be enough for export . I tried removing the property HTTP_URL and it stopped working , plz suggest a work around.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now