My best guess is that the version of google collections you are using (google-collections-1.0-rc4.jar) is old and did not yet include the method (com.google.common.collect. ImmutableList.copyOf(Ljava/util/Collection;) ) that TableRow.getCells() tries to invoke (as you can see from the stack trace).
Upgrading your collections library (see http://code.google.com/p/guava-libraries/ , which supersedes google-collections) should fix it. If you can't do so, you may try recompiling the google-visualization-java<http://code.google.com/p/google-visualization-java/>sources against you're current google-collections jar. This might fail for other reasons (the visualization library depending on other classes/methods not present in your jar), but the specific exception you mention should go away because the overloaded use ImmutableList.copyOf() should resolve against ImmutableList.copyOf(Ljava/lang/Iterable;), which exists in your google-collections jar. -- R. On 13 October 2011 10:28, P G <[email protected]> wrote: > Hi, > > I am new to this google visualization api. I am trying to create > datatable from java backend and javascript will create chart for me > using google visualization javascript API. > Java code - > while (itr.hasNext()) { > DatamartPrice priceObj = > (DatamartPrice) itr.next(); > TableRow row = new TableRow(); > > row.addCell(priceObj.getValueDate().toString()); > row.addCell(priceObj.getValue()); > chartDataTable.addRow(row); > } > > Jar files in classpath are - visualization-datasource-1.1.1.jar and > google-collections-1.0-rc4.jar > > Exception is thorwn on line chartDataTable.addRow(row); > > java.lang.NoSuchMethodError: > com.google.common.collect.ImmutableList.copyOf(Ljava/util/ > Collection;)Lcom/google/common/collect/ImmutableList; > at > com.google.visualization.datasource.datatable.TableRow.getCells(Unknown > Source) > at > com.google.visualization.datasource.datatable.DataTable.addRow(Unknown > Source) > at > > com.jpmorgan.research.cfp.datamart.DatamartUtil.getDatamartPriceDataForGraph(DatamartUtil.java: > 49) > at > > com.jpmorgan.research.cfp.servlets.PerformanceChartServlet.doGet(PerformanceChartServlet.java: > 57) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) > at > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: > 290) > at > > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java: > 206) > at > > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: > 233) > at > > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java: > 191) > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java: > 127) > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java: > 102) > at > > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java: > 109) > at > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java: > 291) > at > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java: > 859) > at org.apache.coyote.http11.Http11Protocol > $Http11ConnectionHandler.process(Http11Protocol.java:602) > at > org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java: > 489) > at java.lang.Thread.run(Thread.java:619) > > > Can someone help me to resolve this issue? > > Thanks, > PG > > -- > You received this message because you are subscribed to the Google Groups > "Google Visualization API" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-visualization-api?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
