class resolution conflict with Vaadin 7 (old Apache Httpclient)

I’m trying to run tests in my Maven-based project, which I’m converting from Vaadin 6 to 7.
I get this error:

java.lang.NoSuchMethodError: org.apache.http.impl.conn.DefaultClientConnectionOperator.
    <init>(Lorg/apache/http/conn/scheme/SchemeRegistry;Lorg/apache/http/conn/DnsResolver;)V
	at org.apache.http.impl.conn.PoolingClientConnectionManager.createConnectionOperator(PoolingClientConnectionManager.java:140)

my project depends on Apache Httpclient 4.2.
I see there are two copies of DefaultClientConnectionOperator class available in classpath: one in apache httpclient 4.2 and one more - inside vaadin-client-compiler-7.0.0.jar . the latter is old and does not have the required constructor with two parameters.

a quote from my pom.xml file:


        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-server</artifactId>
            <version>${vaadin.version}</version>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-client-compiled</artifactId>
            <version>${vaadin.version}</version>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-client-compiler</artifactId>
            <version>${vaadin.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-client</artifactId>
            <version>${vaadin.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-themes</artifactId>
            <version>${vaadin.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.4</version>
            <scope>provided</scope>
        </dependency>

the project can be compiled and packaged without any problems. but I do get errors when running tests.

environment: Maven 3.0.4. multi-module project.

what’s the recommended way to deal with such problems?

Hi,

Don’t use the vaadin-client-compiler module as your project dependency. It is added automatically by vaadin-maven-plugin during widgetset compilation.

cheers,
matti

unfortunately, I get a compilation error if I remove “vaadin-client-compiler” dependency from the pom.xml file:

[INFO]
 --- gwt-maven-plugin:2.5.0:compile (default) @ webui ---
[INFO]
 auto discovered modules [com.taskadapter.webui.widgetset.Vaadin1Widgetset]

[INFO]
 Loading inherited module 'com.taskadapter.webui.widgetset.Vaadin1Widgetset'
[INFO]
    Loading inherited module 'com.vaadin.DefaultWidgetSet'
[INFO]
       Loading inherited module 'com.vaadin.Vaadin'
[INFO]
          [ERROR]
 Unable to load class 'com.vaadin.server.widgetsetutils.AcceptCriteriaFactoryGenerator'
[INFO]
 java.lang.ClassNotFoundException: com.vaadin.server.widgetsetutils.AcceptCriteriaFactoryGenerator
....
....
[INFO]
  at com.google.gwt.dev.Compiler.main(Compiler.java:177)
[INFO]
    [ERROR]
 Line 6: Unexpected exception while processing element 'inherits'
[INFO]
 com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)

You need to use the Vaadin Maven plugin, not gwt-maven-plugin 2.5.0. The easiest way for you might be to check the pom.xml that the Vaadin archetype generates and compare it to your pom.xml. See https://vaadin.com/wiki/-/wiki/Main/Creating%20a%20Maven%20project for the command to create a project using the Vaadin archetype.

that worked, thanks!