jan.stefany Posted April 18, 2013 Share Posted April 18, 2013 Hello,I am using JasperServer comunity edition 5.0.0 and I am doing webservice call using jasperserver-ireport-plugin-4.2.0.jar in Java . All functionality and parameters works...except for JRParameter.REPORT_TIME_ZONE. My code structure looks like this: parameters.put(JRParameter.REPORT_TIME_ZONE, TimeZone.getDefault()); //yes it is java.util.TimeZone and yes I tested multiple timezonesparameters.put(JRParameter.REPORT_LOCALE, reportLocale); //here I set locale and it works when I comment out adding REPORT_TIME_ZONE parameterMap runReport = myJasperWebService.runReport(rd.getUriString(), parameters, serverParameters); //here I run report And I am getting java.lang.Exception: 1 - java.lang.String cannot be cast to java.util.TimeZone at com.jaspersoft.jasperserver.irplugin.wsclient.WSClient.runReport(WSClient.java:382) at main.MyJIClient.runReport(MyJIClient.java:96) at main.Run.main(Run.java:64)runReport method has only this... ResourceDescriptor rd = new ResourceDescriptor(); rd.setWsType(ResourceDescriptor.TYPE_REPORTUNIT); rd.setUriString(reportUri); return server.getWSClient().runReport(rd, parameters, serverParameters); Am I using it wrong, which I dont think so because every other parameter including Locale settings works nice and reports are created or is there possibly problem in implementation of ireport-plugin or JasperServer implementation? Thanks for any advice or hint Link to comment Share on other sites More sharing options...
k_tripura Posted April 19, 2013 Share Posted April 19, 2013 I am not sure if this answer helps but just adding my points(hope it help)In your iReport , go to Tools-> Options -> Compilation and execution -> Look for Reprot Time Zone,may be it is creating conflict with yours,do you need to override it or something Link to comment Share on other sites More sharing options...
jan.stefany Posted April 20, 2013 Author Share Posted April 20, 2013 Hi, thansks a lot for answer. Report has set Default timezone however when run on JAsperServer I need to pass him timezoen as parameter, which should be done by setting parameter REPORT_TIME_ZONE because I need to specify in which timezone dates and time should be shown in generated report. However when I pass this parameter I get java.lang.Exception: 1 - java.lang.String cannot be cast to java.util.TimeZone at com.jaspersoft.jasperserver.irplugin.wsclient.WSClient.runReport(WSClient.java:382) at main.MyJIClient.runReport(MyJIClient.java:96) at main.Run.main(Run.java:64) I need to override the timezone but so far withotu success. Link to comment Share on other sites More sharing options...
k_tripura Posted April 22, 2013 Share Posted April 22, 2013 You are trying to set a string value to TimeZone variable amma.If you want a TimeZone variable, check for TimeZone API and see how to pass string value to it.hope that helps. Link to comment Share on other sites More sharing options...
jan.stefany Posted April 23, 2013 Author Share Posted April 23, 2013 Hi, thanks again for answer however as I wrote in question... parameters.put(JRParameter.REPORT_TIME_ZONE, TimeZone.getDefault()); //yes it is java.util.TimeZone and yes I tested multiple timezones I am passing valid java.util.Timezone not any string and still I am getting this exception...that is the problem..by all manuals, tutorials and how-tos I am doing it in correct way and it is not working. Link to comment Share on other sites More sharing options...
jan.stefany Posted May 23, 2013 Author Share Posted May 23, 2013 Ok made some more research, still same problem, but looks like server doesn't recognize sun.util.calendar.ZoneInfo as as java.util.TimeZone. //adding timezone as parameterparameters.put(JRParameter.REPORT_TIME_ZONE, TimeZone.getDefault() ); in debug mode in eclipse I see that parameter is defined as REPORT_TIME_ZONE=sun.util.calendar.ZoneInfo[id="Europe/Berlin",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]]But this is default timezone definition in Java. Is there any workaround or anyone has idea how to solve this problem? 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