為 Ubuntu 11.04 製作 Pentaho 報告

為 Ubuntu 11.04 製作 Pentaho 報告

目前我正在嘗試安裝OpenERP 的 Pentaho 報告。我已經在基於 Windows 的筆記型電腦上安裝了 Pentaho Reports,它們工作正常。目前我正在 Ubuntu 11.04 上嘗試,它給了我這個錯誤:

錯誤 build.xml:18:無法建立任務或類型。

以下是我執行的步驟:

  1. java-6-openjdk從儲存庫安裝

    apt-get install java-6-openjdk
    
  2. 然後我將安裝的Java JDK設定到java_home環境中

    nano /etc/environment
    

    使用此新行新增了環境:

    JAVA_HOME="/usr/lib/jvm/java-6-openjdk"
    
  3. 然後我從儲存庫安裝了 Apache ant

    apt-get install ant
    
  4. 接下來是設定環境

    nano /etc/environment
    

    使用此新行新增了環境:

    ANT_HOME="/usr/share/ant"
    
  5. 嘗試使用命令檢查安裝ant...我收到以下訊息:

    Buildfile: build.xml does not exist!
    Build failed
    
  6. 然後從下載Java伺服器OpenERP 的 Pentaho 報告然後複製到Ubuntu共享資料夾。然後從命令列,我進入提取的路徑,即共享資料夾。我提到並執行了命令ant war,但收到此錯誤訊息:

    BUILD FAILED
    /share/java_server/build.xml: 18: problem: failed to create task or
    type antlibrg:apacge.ivy.ant: retrieve
    cause: The name is undefined.
    Action: Check the spelling.
    Action: Check that any custom taks/types have been declared
    Action: Check that any <presetdef>/<macrodef>declarations have taken place.
    No types or taks have been defined in this namespace yet
    This appears to be an antlib declaration. 
    Action: Check that the implementing library exists in one of:
       - /usr/share/ant/lib
       -/root/.ant/lib
       - A directory added on the command line with the -lib argument
    
    Total time: 0 seconds
    

是否存在相容性問題?還是我錯過了一些步驟?

答案1

嘗試以下步驟(它們對我有用):

  • 更新 openjdk-6-jdk

  • 在/etc/environment中新增:

    JAVA_HOME="/usr/lib/jvm/java-6-openjdk"
    JRE_HOME="/usr/lib/jvm/java-6-openjdk/jre"
    ANT_HOME="/usr/share/ant/bin"
    PATH = ".....:$JAVA_HOME:$JRE_HOME:$ANT_HOME:/usr/share/ant/lib"
    
  • 重新啟動您的系統

  • 在java_server中輸入指令ant war。您應該收到此訊息:

    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher
    Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.launch.Launcher
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    Could not find the main class: org.apache.tools.ant.launch.Launcher. Program will exit.
    

答案2

這是由於建置系統找不到 ivy 庫造成的。你必須先安裝ivy:

apt-get install ivy

如果仍然抱怨相同的錯誤,請使用以下命令執行 ant 作業:

ant -lib /usr/share/java/ war

其中 /usr/share/java/ 是 ivy 安裝 .jar 檔案的路徑。

順便說一句:我不知道你到底從 git 克隆了什麼,但在你發送的連結上是第 27 行定義的 ivy 資源,而不是你說的第 18 行。

相關內容