Menu

#588 WebClient classloading error

closed
nobody
None
5
2012-10-21
2008-04-04
Pavel Tonev
No

Hello All,

I use maven for my project with configuration

     <dependency>
    <groupId>htmlunit</groupId>
    <artifactId>htmlunit</artifactId>
    <version>1.13</version>
    <type>jar</type>
</dependency>
<dependency>
            <groupId>net.htmlparser.jericho</groupId>
    <artifactId>jericho-html</artifactId>
    <version>2.4</version>
    <type>jar</type>
</dependency>

On creation of WebClient I receive the stacktrace bellow, the situation is too simple to be described more.
I tried just this: Class.forName("org.mozilla.javascript.Context");

and it throws same exception the problem is here into the classloading but I cannot understand where the problem is.

Exception in thread "main" java.lang.VerifyError: (class: org/mozilla/javascript/optimizer/Codegen, method: getFunctionInitMethodName signature: (Lorg/mozilla/javascript/optimizer/OptFunctionNode;)Ljava/lang/String;) Incompatible argument to function
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.mozilla.javascript.Context.<clinit>(VCDO)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at com.gargoylesoftware.htmlunit.WebClient.createJavaScriptEngineIfPossible(WebClient.java:236)
at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:194)
at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:178)

Any Help is appreciated

Pavel Tonev

Discussion

  • Ahmed Ashour

    Ahmed Ashour - 2008-04-05

    Logged In: YES
    user_id=950730
    Originator: NO

    Dear Pavel,

    • Do you use Maven 1 or Maven 2?

    • Why don't you try HtmlUnit version 1.14?

     
  • Pavel Tonev

    Pavel Tonev - 2008-04-05

    Logged In: YES
    user_id=2054830
    Originator: YES

    Hello,

    I use maven2, htmlunit 1.14, jericho-html 2.5 in a project that has class which creates WebClient nothing more. Install the artifact into the maven repository. In another project just use it and this error occurs.
    The most interesting is that in the first project there is no problem using this WebClient while using installed artifact via maven repository makes the problem.

    Kind Regards,
    Pavel Tonev

     
  • Ahmed Ashour

    Ahmed Ashour - 2008-04-05

    Logged In: YES
    user_id=950730
    Originator: NO

    It worked perfectly for me, here are the steps used, please exactly specify yours in order to isolate the issue.

    1- Clear '.m2' from user directory.
    2- Maven2: Create a new project "mvn -up archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app"
    3- Add the follwing dependencies to pom.xml:
    <dependency>
    <groupId>htmlunit</groupId>
    <artifactId>htmlunit</artifactId>
    <version>1.14</version>
    <type>jar</type>
    </dependency>
    <dependency>
    <groupId>net.htmlparser.jericho</groupId>
    <artifactId>jericho-html</artifactId>
    <version>2.4</version>
    <type>jar</type>
    </dependency>
    4- In AppTest, update testApp():

    public void testApp() throws Exception {
        System.err.println("Hello");
        Class.forName("org.mozilla.javascript.Context");
        new com.gargoylesoftware.htmlunit.WebClient();
        assertTrue( true );
    }
    

    5- 'mvn test' creates no errors.

    Please retest and advise.

     
  • SourceForge Robot

    Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 30 days (the time period specified by
    the administrator of this Tracker).

     

Log in to post a comment.