English 中文(简体)
在 vaadin 中显示 PDF
原标题:Displaying PDF in vaadin

我要在我的界面中显示 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);

我还在我的项目中包括了下列JARs:

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

我的代码里有什么问题...

最佳回答

根据您张贴的堆叠跟踪, “ generateCell” 方法没有在“ eu.livotov. tpt.gui.vdv.core. SinglePageDocumentRenderer” 类中实施。 添加新标签时会使用这个方法。 根据< a href=" https://vaadin. com/ forum/-/ message_boards/view_ message/1436559" rel=“ no follow”, 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)
问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签