【问题标题】:'Class com.gargoylesoftware.htmlunit.WebClient not found' when installing WWW::HtmlUnit [closed]安装 WWW::HtmlUnit 时“找不到类 com.gargoylesoftware.htmlunit.WebClient”[关闭]
【发布时间】:2012-11-27 05:40:00
【问题描述】:

我正在尝试在 Ubuntu 12.04 64 位中为 perl 安装 WWW::HtmlUnit。我正在按照CPAN page 的指示进行操作。

但是我得到一个错误说明

Class com.gargoylesoftware.htmlunit.WebClient not found at /usr/local/lib/perl/5.14.2/Inline/Java.pm line 619.

我已将我的整个日志粘贴在下面。我已经看到其他一些对这个问题的回答,但都是针对 Windows 而不是 Linux。

cpanm (App::cpanminus) 1.5018 on perl 5.014002 built for x86_64-linux-gnu-thread-multi
Work directory is /home/user/.cpanm/work/1355076552.11533
You have make /usr/bin/make
You have LWP 6.03
You have /bin/tar: tar (GNU tar) 1.26
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
You have /usr/bin/unzip
Searching WWW::HtmlUnit on cpanmetadb ...
--> Working on WWW::HtmlUnit
Fetching http://www.cpan.org/authors/id/A/AW/AWWAIID/WWW-HtmlUnit-0.18.tar.gz
-> OK
Unpacking WWW-HtmlUnit-0.18.tar.gz
Entering WWW-HtmlUnit-0.18
Checking configure dependencies from META.yml
Checking if you have ExtUtils::MakeMaker 0 ... Yes (6.57_05)
Configuring WWW-HtmlUnit-0.18
Running Makefile.PL
Checking if your kit is complete...
Warning: the following files are missing in your kit:
    lib/WWW/HtmlUnit/jar/commons-codec-1.4.jar
    lib/WWW/HtmlUnit/jar/commons-io-2.0.1.jar
    lib/WWW/HtmlUnit/jar/commons-lang-2.6.jar
    lib/WWW/HtmlUnit/jar/cssparser-0.9.5.jar
    lib/WWW/HtmlUnit/jar/htmlunit-2.9.jar
    lib/WWW/HtmlUnit/jar/htmlunit-core-js-2.9.jar
    lib/WWW/HtmlUnit/jar/httpclient-4.1.2.jar
    lib/WWW/HtmlUnit/jar/httpcore-4.1.2.jar
    lib/WWW/HtmlUnit/jar/httpmime-4.1.2.jar
    lib/WWW/HtmlUnit/jar/nekohtml-1.9.15.jar
Please inform the author.
Writing Makefile for WWW::HtmlUnit
Writing MYMETA.yml
-> OK
Checking dependencies from MYMETA.yml ...
Checking if you have ExtUtils::MakeMaker 0 ... Yes (6.57_05)
Checking if you have Inline::Java 0.53 ... Yes (0.53)
Building and testing WWW-HtmlUnit-0.18
cp lib/WWW/HtmlUnit.pm blib/lib/WWW/HtmlUnit.pm
cp lib/WWW/HtmlUnit/jar/xml-apis-1.3.04.jar blib/lib/WWW/HtmlUnit/jar/xml-apis-1.3.04.jar
cp lib/WWW/HtmlUnit/jar/commons-collections-3.2.1.jar blib/lib/WWW/HtmlUnit/jar/commons-collections-3.2.1.jar
cp lib/WWW/HtmlUnit/jar/xalan-2.7.1.jar blib/lib/WWW/HtmlUnit/jar/xalan-2.7.1.jar
cp lib/WWW/HtmlUnit/jar/serializer-2.7.1.jar blib/lib/WWW/HtmlUnit/jar/serializer-2.7.1.jar
cp lib/WWW/HtmlUnit/jar/commons-logging-1.1.1.jar blib/lib/WWW/HtmlUnit/jar/commons-logging-1.1.1.jar
cp lib/WWW/HtmlUnit/jar/htmlunit-confirmhandler-2.8.jar blib/lib/WWW/HtmlUnit/jar/htmlunit-confirmhandler-2.8.jar
cp lib/WWW/HtmlUnit/jar/xercesImpl-2.9.1.jar blib/lib/WWW/HtmlUnit/jar/xercesImpl-2.9.1.jar
cp lib/WWW/HtmlUnit/Sweet.pm blib/lib/WWW/HtmlUnit/Sweet.pm
cp lib/WWW/HtmlUnit/jar/sac-1.3.jar blib/lib/WWW/HtmlUnit/jar/sac-1.3.jar
Manifying blib/man3/WWW::HtmlUnit.3pm
Manifying blib/man3/WWW::HtmlUnit::Sweet.3pm
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t

#   Failed test 'use WWW::HtmlUnit;'
#   at t/00_basic.t line 9.
#     Tried to use 'WWW::HtmlUnit'.
#     Error:  Class com.gargoylesoftware.htmlunit.WebClient not found at /usr/local/lib/perl/5.14.2/Inline/Java.pm line 619.
# BEGIN failed--compilation aborted at (eval 4) line 2, <GEN7> line 4.
# Looks like you failed 1 test of 1.
t/00_basic.t ......... 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests 
Class com.gargoylesoftware.htmlunit.WebClient not found at /usr/local/lib/perl/5.14.2/Inline/Java.pm line 619.
BEGIN failed--compilation aborted at t/01_hello.t line 4, <GEN7> line 4.
t/01_hello.t ......... 
Dubious, test returned 2 (wstat 512, 0x200)
No subtests run 
t/02_hello_sweet.t ... 
Dubious, test returned 2 (wstat 512, 0x200)
No subtests run 
Class com.gargoylesoftware.htmlunit.WebClient not found at /usr/local/lib/perl/5.14.2/Inline/Java.pm line 619.
BEGIN failed--compilation aborted at t/03_clickhandler.t line 6, <GEN7> line 4.
# Looks like your test exited with 2 before it could output anything.
t/03_clickhandler.t .. 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 8/8 subtests 

Test Summary Report
-------------------
t/00_basic.t       (Wstat: 256 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
t/01_hello.t       (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: No plan found in TAP output
t/02_hello_sweet.t (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: No plan found in TAP output
t/03_clickhandler.t (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 8 tests but ran 0.
Files=4, Tests=1,  1 wallclock secs ( 0.04 usr  0.01 sys +  0.58 cusr  0.10 csys =  0.73 CPU)
Result: FAIL
Failed 4/4 test programs. 1/1 subtests failed.
make: *** [test_dynamic] Error 2
-> FAIL Installing WWW::HtmlUnit failed. See /home/user/.cpanm/build.log for details.

【问题讨论】:

    标签: linux perl ubuntu htmlunit cpan


    【解决方案1】:

    但是,将其他答案留给后代,问题是作者破坏了最新版本。从您的消息中可以看出,他忘记包含几个关键文件。

    Warning: the following files are missing in your kit:
        lib/WWW/HtmlUnit/jar/commons-codec-1.4.jar
        lib/WWW/HtmlUnit/jar/commons-io-2.0.1.jar
        lib/WWW/HtmlUnit/jar/commons-lang-2.6.jar
        lib/WWW/HtmlUnit/jar/cssparser-0.9.5.jar
        lib/WWW/HtmlUnit/jar/htmlunit-2.9.jar
        lib/WWW/HtmlUnit/jar/htmlunit-core-js-2.9.jar
        lib/WWW/HtmlUnit/jar/httpclient-4.1.2.jar
        lib/WWW/HtmlUnit/jar/httpcore-4.1.2.jar
        lib/WWW/HtmlUnit/jar/httpmime-4.1.2.jar
        lib/WWW/HtmlUnit/jar/nekohtml-1.9.15.jar
    

    这值得一张错误票(实际上是两张,我在类路径代码中发现了一个错误)。

    在此期间,您可以尝试安装旧版本:

    cpanm http://cpan.metacpan.org/authors/id/A/AW/AWWAIID/WWW-HtmlUnit-0.16.tar.gz
    

    (根据需要使用sudoJAVA_HOME)。

    【讨论】:

      【解决方案2】:

      你关注installation instructions了吗? Inline::Java 似乎找不到您的 java 库。

      您可能需要检查您是否将JAVA_HOME 设置为正确的路径。我相信您可以通过运行以下命令来实现:

      update-alternatives --query java | perl -ne 'print if s/Value: //'
      

      对我来说,这给出了:

      /usr/lib/jvm/java-6-sun/jre/bin/java
      

      但你不想要 bin 部分,所以我会使用

      JAVA_HOME=/usr/lib/jvm/java-6-sun
      

      编辑:也不想要/jre

      【讨论】:

      • 按照安装说明,并做了你的建议,但仍然是同样的问题。将 JAVA_HOME 的 /etc/environment 设置为 /usr/lib/jvm/java-6-openjdk-amd64/jre 并重新运行安装,仍然是相同的错误消息。
      • CPANTesters 也遇到了麻烦。可能这个模块没有安装好。
      • 我正在尝试安装自己,我注意到我的 JAVA_HOME 也不正确,已编辑以反映
      猜你喜欢
      • 2011-06-22
      • 2014-12-22
      • 2017-05-05
      • 2012-05-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-25
      • 2020-07-04
      相关资源
      最近更新 更多