benu Posted September 23, 2014 Share Posted September 23, 2014 We've just launched a copy of JRS via the AWS offering (ami-0e0fff66), and the basic operations work fine, i.e. report execute from the UI with no problems. However, when we try to render them using visualize.js, we get nothing except a cryptic error from the browser debugger:Uncaught TypeError: Cannot read property '2' of nullThere's a little more error context, which I will include if anyone responds to this post.The web page & script look like this:<!DOCTYPE html><html><head><script src="http://my.server.org/jasperserver-pro/client/visualize.js?logLevel=debug"></script><title>My Report</title></head><body><script>visualize({auth: {name: "reporting",password: "somepassword"}}, function (v) {var report = v.report({resource: "/public/Samples/Reports/9.CustomerDetailReport",container: "#container"});});</script><div id="container"></div></body></html> Pretty straightforward. We get nothing in the catalina.out nor jasperserver.log logs. We really don't have a clue why there's no response from the server. We do get the visualize.js page returned if we call it in the browser directly, i.e. http://my.server.org/jasperserver-pro/client/visualize.js, so I know it's accessible. And, as I mentioned, the reports run fine from the web UI.Would someone point us in the right direction, please - even if just to tell us how to gather more information about the problem?Thanks, Ben Link to comment Share on other sites More sharing options...
benu Posted September 23, 2014 Author Share Posted September 23, 2014 Please ignore the span tags that this forum wrapped around my HTML page code...thanks. Link to comment Share on other sites More sharing options...
benu Posted September 23, 2014 Author Share Posted September 23, 2014 Finally, when my test page renders in Firefox, I get this in the browser debugger: "16:09:36.761" "[EasyXDM]" "[DEBUG] -" ": easyXDM present on 'file:/LOCAL_PATH_TO_MY_TEST_HTML_FILE/POC_visualize.html" visualize.js:63 "16:09:36.766" "[easyXDM.Rpc]" "[DEBUG] -" "constructor" visualize.js:63 "16:09:36.766" "[EasyXDM.{Private}]" "[DEBUG] -" "preparing transport stack" visualize.js:63 TypeError: t is null visualize.js:63 "16:09:36.766" "[EasyXDM.{Private}]" "[DEBUG] -" "resolved url 'http://MY.SERVER.org/jasperserver-pro/xdm.html?logEnabled=true&logLevel=debug'" visualize.js:63 Link to comment Share on other sites More sharing options...
bwang Posted September 24, 2014 Share Posted September 24, 2014 The code works for me on my localhost. I am wondering if your password and username are not correct. Also, if you has a few organizations on JRS, he needs to add the organization id. <span style="font-size:12px;"><!DOCTYPE html><html><head><script src="http://localhost:8080/jasperserver-pro/client/visualize.js?logLevel=debug"></script><title>My Report</title></head><body><script>visualize({auth: {name: "jasperadmin", password: "jasperadmin", organization: "organization_1"}}, function (v) {var report = v.report({resource: "/public/Samples/Reports/9.CustomerDetailReport",container: "#container"});});</script><div id="container"></div></body></html></span> Link to comment Share on other sites More sharing options...
swood_1 Posted September 24, 2014 Share Posted September 24, 2014 The problem seems to be in the 2 basic iFrames that are used in visualize.js to deal with cross scripting issues.How are you running the HTML page that has the visualize.js calls? Because of the iFrames, your page has to run in a web server and cannot be on your local file system. Sherman Link to comment Share on other sites More sharing options...
garnold Posted September 25, 2014 Share Posted September 25, 2014 I would agree with the top two suggestions. I'm running your exact code against a 5.6.1 system and it works perfect. Here is a link to a fiddle that does work. You can change the visualize location to test against your system if you wish.http://jsfiddle.net/guzuro6h/ Link to comment Share on other sites More sharing options...
benu Posted September 25, 2014 Author Share Posted September 25, 2014 Thanks for your suggestions; unfortunately, these did not work. I'm making the assumption that if any of these parameters were actually incorrect, or missing, the API would have returned an explicit error message (or, it *should* have done, anyway!). -Ben Link to comment Share on other sites More sharing options...
benu Posted September 25, 2014 Author Share Posted September 25, 2014 Sherman - astute observation: yes, this simple HTML page was just on my file system and I was opening it locally in my browser. Executing it in JSFiddle worked great. There must have been another issue integrating visualize.js into our Java web app, so we'll dig back into that - knowing that a proper test can't be done via the local file system. Thanks very much for your suggestion! -Ben Link to comment Share on other sites More sharing options...
benu Posted September 25, 2014 Author Share Posted September 25, 2014 Hi Gene, Thanks very much for the corroboration and JSFiddle - working great, now. On to implementing in our Liferay app. Thanks, and regards, Ben Link to comment Share on other sites More sharing options...
akthar.itzme Posted September 30, 2014 Share Posted September 30, 2014 ya, I also faced same issue & now tried it by running in a web server page. But instead of Uncaught TypeError: Cannot read property '2' of null error. I am getting new error Uncaught TypeError: Cannot read property 'Fn' of undefined in xdm.remote.js Can some one help me out??? Link to comment Share on other sites More sharing options...
benu Posted September 30, 2014 Author Share Posted September 30, 2014 Can you provide a little more context, i.e. the script that you're using to call up your report? -Ben Link to comment Share on other sites More sharing options...
akthar.itzme Posted October 1, 2014 Share Posted October 1, 2014 script i am using is correct. I was using localhost in the visualize.js & server urls. i.e. http://localhost:8181/jasperserver-pro/client/visualize.js , http://localhost:8181/jasperserver-pro Instead, now i changed the localhost with my IP. Now i am able to render the report. Link to comment Share on other sites More sharing options...
gowthamsenmca Posted October 13, 2014 Share Posted October 13, 2014 I too faced same issue. When I used localhost, if I place the files in the server, then only it worked.But its working well when using JSFiddle. Why its not working in a different machine fi we create a nromal html file?Any info please?ThanksGowtham Link to comment Share on other sites More sharing options...
benu Posted October 13, 2014 Author Share Posted October 13, 2014 Hi Gowtham. While I can't explain the reasons why, I can confirm that integrating the visualize.js Javascript with our web server did solve the problem. The explanation that Sherman provided above re: iFrams and cross scripting seems to be the fundamental issue. Good luck! -Ben Link to comment Share on other sites More sharing options...
jajab Posted May 20, 2015 Share Posted May 20, 2015 You may use the blank.htm file that comes out of the box with JapserServer. It will run on Tomcat. You may find it here : jasperreports-server-6.0.1apache-tomcatwebappsjasperserver-pro (windows).Here is my code :<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <meta http-equiv="content-type" content="text/html; charset=windows-1250"> <meta name="generator" content="PSPad editor, www.pspad.com"> <title></title> </head> <body><scripttype="text/javascript"src="http://localhost:8080/jasperserver-pro/client/visualize.js?_opt=false&logLevel=debug"></script><!-- Provide the URL to visualize.js --> Jade <div id="container"></div><!-- Provide a container for the report --><script >visualize({auth: {name: "jasperadmin", password: "jasperadmin", organization: "organization_1"}}, function (v) {var report = v.report({resource: "/public/Samples/Reports/9.CustomerDetailReport",container: "#container"});});</script> </body></html>[/code] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now