0

我想在我的 UI 中显示 PDF 并收到以下错误:

May 25, 2012 11:29:11 AM com.vaadin.Application terminalError
SEVERE: Terminal error:
com.vaadin.event.ListenerMethod$MethodException
Cause: java.lang.AbstractMethodError: eu.livotov.tpt.gui.vdv.core.SinglePageDocumentRenderer.generateCell(Lcom/vaadin/ui/Table;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:532)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1219)
at com.vaadin.ui.Button.fireClick(Button.java:550)
at com.vaadin.ui.Button.changeVariables(Button.java:217)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.changeVariables(AbstractCommunicationManager.java:1445)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1393)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1312)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:763)
at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:296)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:538)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:478)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:517)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:937)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:871)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
at org.eclipse.jetty.server.Server.handle(Server.java:346)
at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:589)
at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1065)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:823)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:220)
at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:531)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.AbstractMethodError: eu.livotov.tpt.gui.vdv.core.SinglePageDocumentRenderer.generateCell(Lcom/vaadin/ui/Table;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
at com.vaadin.ui.Table.getVisibleCellsNoCache(Table.java:1691)
at com.vaadin.ui.Table.refreshRenderedCells(Table.java:1479)
at com.vaadin.ui.Table.attach(Table.java:3341)
at com.vaadin.ui.AbstractComponentContainer.attach(AbstractComponentContainer.java:97)
at com.vaadin.ui.AbstractComponentContainer.attach(AbstractComponentContainer.java:97)
at com.vaadin.ui.AbstractComponentContainer.attach(AbstractComponentContainer.java:97)
at com.vaadin.ui.AbstractComponentContainer.attach(AbstractComponentContainer.java:97)
at com.vaadin.ui.AbstractComponent.setParent(AbstractComponent.java:560)
at com.vaadin.ui.AbstractComponentContainer.addComponent(AbstractComponentContainer.java:211)
at com.vaadin.ui.TabSheet.addTab(TabSheet.java:294)
at com.vaadin.ui.TabSheet.addTab(TabSheet.java:332)
at com.vaadin.ui.TabSheet.addTab(TabSheet.java:311)
at com.complete.raspberry.webui.FileAdminView$SearchFormLayout$2.buttonClick(FileAdminView.java:166)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:512)
... 32 more

我的代码是这样的:

Button advanceSearchButton = new Button("Advance Search",
   new Button.ClickListener() {
    public void buttonClick(ClickEvent event) {

     DocumentViewer viewer = new DocumentViewer();
     viewer.loadDocument ( new PdfDocument ( new java.io.File ( "C:/handbook.pdf" ) ) );
     System.out.println("Pages pdf : " + viewer.getPagesCount());                           
     VerticalLayout myTabCoursPDF = new VerticalLayout();
     myTabCoursPDF.addComponent(viewer);  
     tabsheet.addTab(myTabCoursPDF);

我还在我的项目中包含了以下 JAR:

  • icepdf-core.jar
  • icepdf-pro.jar
  • icepdf-pro-intl.jar
  • tpt-core.jar

现在我的代码有什么问题......任何人都可以帮助我......

4

1 回答 1

0

根据您发布的堆栈跟踪,“eu.livotov.tpt.gui.vdv.core.SinglePageDocumentRenderer”类中未实现“generateCell”方法。添加新选项卡时会调用它。根据这个线程,TPT 库可能不适合与 Vaadin 一起使用。

点击监听器本身看起来不错。

Caused by: java.lang.AbstractMethodError: eu.livotov.tpt.gui.vdv.core.SinglePageDocumentRenderer.generateCell(Lcom/vaadin/ui/Table;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
at com.vaadin.ui.Table.getVisibleCellsNoCache(Table.java:1691)
at com.vaadin.ui.Table.refreshRenderedCells(Table.java:1479)
at com.vaadin.ui.Table.attach(Table.java:3341)
at com.vaadin.ui.AbstractComponentContainer.attach(AbstractComponentContainer.java:97)
at com.vaadin.ui.AbstractComponentContainer.attach(AbstractComponentContainer.java:97)
at com.vaadin.ui.AbstractComponentContainer.attach(AbstractComponentContainer.java:97)
at com.vaadin.ui.AbstractComponentContainer.attach(AbstractComponentContainer.java:97)
at com.vaadin.ui.AbstractComponent.setParent(AbstractComponent.java:560)
at com.vaadin.ui.AbstractComponentContainer.addComponent(AbstractComponentContainer.java:211)
at com.vaadin.ui.TabSheet.addTab(TabSheet.java:294)
于 2012-05-27T21:36:26.230 回答