2013-01-25 68 views
8

我有一個打包源代碼的jar文件。在GWT中添加外部jar

我插在戰爭/ WEB-INF/lib下的jar/xxx.jar添加到構建路徑

但是當我運行該項目,我得到一個錯誤

編輯新增gwt.xml

<module rename-to='bookmanagementsystem'> 

    <inherits name='com.google.gwt.user.User'/> 
    <inherits name='com.google.gwt.user.theme.standard.Standard'/> 
    <inherits name='com.example.Book'></inherits> 
    <entry-point class='com.example.Book.client.Index'/> 

</module> 

編輯

我解決 插件未能在127.0.0.1:9997

連接到開發模式服務器現在,我有一個問題

Loading inherited module 'com.example.book' 
     [ERROR] Unable to find 'com/example/book.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source? 
     [ERROR] Line 6: Unexpected exception while processing element 'inherits' 
+0

可以請您發佈.gwt.xml文件代碼嗎? – Parvathy

+0

@Parvathy已添加gwt.xml – Bucks

+0

是否確定在com.example中有Book.gwt.xml文件?請告訴jar文件的包。 – Parvathy

回答

4

如果要包括外部罈子GWT然後確保你做了以下

  1. 檢查jar是否有.gwt.xml文件,它必須指定源文件。
  2. 它從訂單和出口添加到lib文件夾
  3. 配置構建路徑,添加罐子庫
  4. 選擇jar
  5. 繼承此模塊在.gwt.xml文件

EG。如果jar包中有一個名爲「sample.source」的包,並且jar中的.gwt.xml文件是「Source.gwt.xml」,並且這個「sample」文件夾中的.gwt.xml文件以及「source」中的類或實體文件夾

然後您的當前項目必須繼承它。也就是說,它必須具備以下標籤

<inherits name='sample.Source'/> 

如: Sorce.gwt.xml在jar文件

<module> 
<source path=""> 
<include name="**/MyEntity.java"/> 
</source> 
</module> 

參考:HTTP://jonathan.lalou.free.fr/ P = 1077

GWT不支持客戶端的序列化,所以嘗試使用RPC並在服務器中使用這些類從jar中複製jar包並將其添加到gwt項目的src中。

OR

我解決了這個jar文件必須具有Java源代碼的類文件或包的Java源代碼轉換成罐子和使用沿問題。

+0

@Bucks檢查此:http://jonathan.lalou.free.fr/?p=1077 – Parvathy

+0

檢查此:) http:// stackoverflow。com/questions/14251782/how-to-inherit-a-required-module-in-to-gwt-project – Dipak

+0

@Parvathy我試過有Java源代碼和類文件的jar,但仍然有同樣的問題 – Bucks