Custom Visualization Component with community version faild

0

hi, guys, I have successfully run the Custom Visualization Component in the jasperserver-pro(localhost:8080/jasperserver-pro), which is commercial version. but faild in the community version(localhost:8080/jasperserver). so I want to know the reason is the difference between the two version or something I have donw wrong. I do this cause I want to integrate with D3.js

any suggestions would be appreciated 

 

follow up , there is no error message , and when I view the report in jasperserver, the page will continue loading all the time. and the server will create temp file like svg and html file in temp folder. and these file works perfectly , so why jasperserver not show these thing ?

this is the link I followed, worked on pro version : http://community.jaspersoft.com/wiki/custom-visualization-component-v60x

the community version I use:

jasperreports-server-cp-6.0.1-bin

jars:htmlcomponent.jar, jasperreports-customvisualization-6.0.1.jar, mysql-connector-java-5.1.25-bin.jar, phantomjs works

and my jasperreports.properties:

com.jaspersoft.jasperreports.components.customvisualization.require.js=file:///usr/local/Cellar/tomcat7/7.0.59/libexec/webapps/jasperserver/optimized-scripts/bower_components/requirejs/require.js
net.sf.jasperreports.web.resource.pattern.customvisualization.scripts=com/jaspersoft/jasperreports/customvisualization/resources/require
com.jaspersoft.jasperreports.components.customvisualization.phantomjs.executable.path=file:///usr/bin/phantomjs
 
net.sf.jasperreports.query.executer.factory.sql=com.jaspersoft.jasperserver.api.engine.jasperreports.util.JRTimezoneJdbcQueryExecuterFactory
net.sf.jasperreports.query.executer.factory.HiveQL=com.jaspersoft.hadoop.hive.HiveQueryExecuterFactory
 
#limit the crosstab bucket/measure count to prevent out of memory errors
net.sf.jasperreports.crosstab.bucket.measure.limit=100000
 
#suppress page and column footers and all but the first page and column headers when exporting to XLS
net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.1=pageHeader
net.sf.jasperreports.export.xls.exclude.origin.band.2=pageFooter
net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.3=columnHeader
net.sf.jasperreports.export.xls.exclude.origin.band.4=columnFooter
 
# report exporter hints override export parameters
net.sf.jasperreports.export.parameters.override.report.hints=false
 
# use the workaround for the Sun JDK Glyph synchronization bug
net.sf.jasperreports.text.measurer.factory=net.sf.jasperreports.engine.util.JdkGlyphFixTextMeasurerFactory
 
# the fast/single line text measurer factory
net.sf.jasperreports.text.measurer.factory.single.line=com.jaspersoft.jasperserver.api.engine.jasperreports.util.SingleLineTextMeasurerFactory
 
# the default chart theme to use
#net.sf.jasperreports.chart.theme=eye.candy.sixties
 
# override the JR MDX query executer
net.sf.jasperreports.query.executer.factory.mdx=com.jaspersoft.jasperserver.api.engine.jasperreports.util.JSMdxQueryExecuterFactory
net.sf.jasperreports.query.executer.factory.MDX=com.jaspersoft.jasperserver.api.engine.jasperreports.util.JSMdxQueryExecuterFactory
 
# save line break positions at fill time
net.sf.jasperreports.text.save.line.breaks=true
 
# nested tables can cause column misalignments
net.sf.jasperreports.export.html.frames.as.nested.tables=false
#net.sf.jasperreports.export.html.border.collapse=separate
 
# ignore missing fonts in reports
net.sf.jasperreports.awt.ignore.missing.font=true
 
# allow element negative width
net.sf.jasperreports.allow.element.negative.width=true
 
# switch between new XHTML to the former HTML exporter
com.jaspersoft.jasperreports.export.html.type=html2
#com.jaspersoft.jasperreports.export.html.type=xhtml
#com.jaspersoft.jasperreports.export.html.type=html
 
# date patterns for JR interactive components
#net.sf.jasperreports.components.date.pattern.key=date.format
#net.sf.jasperreports.components.calendar.date.pattern.key=calendar.date.format
 
net.sf.jasperreports.web.report.resources.path=/reportresource/reportresource
net.sf.jasperreports.web.request.parameter.resource.uri=resource
 
net.sf.jasperreports.print.transfer.jrs.export=com.jaspersoft.jrs.export
#com.jaspersoft.jrs.export.csv.paginated=true
#com.jaspersoft.jrs.export.xls.paginated=true
#com.jaspersoft.jrs.export.pdf.paginated=false
#com.jaspersoft.jrs.export.docx.paginated=false
#com.jaspersoft.jrs.export.rtf.paginated=false
#com.jaspersoft.jrs.export.odt.paginated=false
chenyang.feng.cn's picture
Joined: Mar 16 2015 - 3:53pm
Last seen: 2 years 3 months ago

4 Answers:

1

hi, the problem is still not solved. and I want to post my tutorial on how to integrate jasperserver and studio with D3.js in case someone need this.

and this tutorial is just for someguy's enviroment same like me, mac, haha. 

 

jasper server integrate with d3.js



1,install the tomcat:

in terminal type:

brew search tomcat


and type:

brew install tomcat7


so, tomcat7 will installed in your /usr/local/Cellar


2,install jasper server-ce


download the jasper server source code, link: http://community.jaspersoft.com/project/jasperreports-server/releases


download jasperreports-server-cp-6.0.1-src.zip


unzip the zip file and then folllow the TIBCO jasperreporats server source build guide to install jasper server in your tomcat


steps are :


copy config file you need from the sample config file and rename it, like if you want to run jasper server on mysql and tomcat, run these command in your terminal:

cd <PATH>/JasperReports-Server-cp-6.0.1-src/jasperserver/buildomatic

cp sample_conf/mysql_master.properties default_master.properties


and change the data in it :


dbUsername = root

dbPassword = password

maven = /home/devuser/apache-maven-3.0.4/bin/mvn

js-path = /home/<user>/JasperReports-Server-6.0-src/jasperserver

repo-path = /home/<user>/JasperReports-Server-6.0-src/jasperserver-repo

js-pro-path = /home/<user>

(no idea why it need this, just give some location you like, any one works, but if you comment this line, it will get error when you install)

maven.home = /usr/local/apache-maven/apache-maven-3.2.3

(this is optional, in case jasper can not have your maven home)


make sure you have start your database and stop your tomcat , then follow these command in your terminal to build the source code:


cd <PATH>/JasperReports-Server-cp-6.0.1-src/jasperserver/buildomatic

./js-ant clean-config

./js-ant gen-config

./js-ant add-jdbc-driver

./js-ant build-ce

./js-ant create-load-js-db-ce

./js-ant deploy-webapp-ce


(if you failed when on one step, and the error message mentioned something like request address is already used.. you can search the result from google and get the solution, but easy way to fix this is turn off your wifi)



now, the jasper server has been deployed to your tomcat, so go to tomcat and start the server:

cd /usr/local/Cellar/tomcat7/7.0.59/libexec/bin

bash startup.sh


then go to http://localhost:8080/jasperserver

(if you can not see the welcome page, and a hug 404 come into your eye, an easy way to fix this is to turn off your wifi, and restart your server)


you will see the welcome page, then use account:jasperadmin, password:jasperadmin to login



3,install jasper studio


download page is

https://community.jaspersoft.com/project/jaspersoft-studio/releases



4,Custom Visualization Component

official link :

http://community.jaspersoft.com/wiki/custom-visualization-component-v60x


the only thing jasper studio need is phantoms, the other things are for jasper server:


1,install phantomjs


you will need phantom js

download it from its website:

http://phantomjs.org/

if your system is yosemity or later , you may want this version of this phantom:

https://github.com/eugene1g/phantomjs/releases

other wise it will not work


after download, unzip the file, and add it to your PATH, and it is ready to use.

to find which PATH you use, just type

echo $PATH

terminal will give you all the PATH you are using, move phantomjs to any of them

you can run phantomjs —version in your command to make sure phantomjs works


if you are running linux, please follow the link bellow to install the source code,

very sorry for the 30 minutes you will take:

http://phantomjs.org/build.html




2,add require.js

go to :

/apache-tomcat/webapps/jasperserver/WEB-INF/classes/jasperreports.properties


add these two line in jasperreports.properties:

com.jaspersoft.jasperreports.components.customvisualization.require.js=file:///path/to/require.js

net.sf.jasperreports.web.resource.pattern.customvisualization.scripts=com/jaspersoft/jasperreports/customvisualization/resources/require


Replace /path/to/require.js with a proper absolute path to require.js



3,jars

the location of jasper server jars is :

~/jasperserver/WEB-INF/lib/


check if you have jasperreports-customvisualization-x.y.z.jar in your jasper server lib file,

if you do not have it , download it from website. this jar include D3.js and other stuff you will need to customize your jasper


find htmlcomponentX_X_X.jar in studio, this is shipped with studio, but not shipped with jasper server. so extract htmlcomponentX_X_X.jar, and get another htmlcomponent.jar, put it in server lib file. this file is used for html component in server side

(if you do not have this jar in server side, it will get your error when you deploy report from studio to server)



5,run the sample

before this, you may wan to see 3rd part in errors and solutions

this is official link tell you how to run the D3 samples;

http://community.jaspersoft.com/wiki/custom-visualization-component-v60x...

you can follow the tutorial. they use sample DB which is a postgre database created by studio. so if you want to make these samples viewed in jasper server, you will need to make a same database and connect with server


Or, you can create a simple D3.js by yourself, no database needed

1, click File-> new -> other ->jaspersoft Studio -> custom visualization component

2,



errors and solution:

1,start the server, and there is error like this:

2013-12-09 15:35:47,869 ERROR JNDIResourceProvider,localhost-startStop-1:75 - error closing context

javax.naming.OperationNotSupportedException: Context is read only

solution link: https://community.jaspersoft.com/questions/822153/error-closing-context


2,if you get an error from catalina.out said your java memory not enough, just increase it in tomcat setting:

add following two line to your <USER>/.bash_profile file:

export JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"

export JAVA_OPTS="$JAVA_OPTS -Xms1024m -Xmx2048m -XX:PermSize=512m”

and run

source ~/.bash_profile

in your terminal to restart the bash_profile


3,if you can not see the preview in jasperstudio in java format, you may try this :

http://localhost:8080/jasperserver-pro/flow.html?_flowId=searchFlow


4,when you add data source in jasper studio, and there is an error said you do not have XXX driver, you may click Driver Classpath and add your jars here.

and same thing when you run your project in studio, and you can add your jars in the project class path. by right click your project, and click Build Path -> Configure Build Path ->Libraries -> add extenal JARS



 

chenyang.feng.cn's picture
Joined: Mar 16 2015 - 3:53pm
Last seen: 2 years 3 months ago
0

hi, chenyang.feng.cn

Have you ever successfully run custom visualization component in Jasperserver CE?

Cause I have faced some problem when trying to deploy in server. It always says "Internal server error".

But if i remove cvc element in the report file, it deployed well.

I have follow your intruction above to add some line in jasperreports.properties and some jar too.

is it ever happen to you?

 

Thanks & Regards

newbie wan's picture
Joined: Nov 12 2014 - 10:20pm
Last seen: 6 months 2 weeks ago
0

Hi newbie wan

I think you may NOT add html component to the jasperserver, check that

d

chenyang.feng.cn's picture
Joined: Mar 16 2015 - 3:53pm
Last seen: 2 years 3 months ago
0

:D yeah you're right,

i removed that html component jar and its works well.

Thanks

newbie wan's picture
Joined: Nov 12 2014 - 10:20pm
Last seen: 6 months 2 weeks ago
Feedback