[Geoserver-devel] AbstractMethodError due to xerces in REST Services example

Hello,

I’m a newbie developer. I’ve been following the REST Services example in the Geoserver docs (http://docs.geoserver.org/stable/en/developer/programming-guide/rest-services/implementing.html) but I’m getting an AbstractMethodError due to what I think is some kind of conflict between xercesImpl versions 2.7.1 and 2.4.0.

From what I can tell, the pom files in Geoserver only reference xercesImpl version 2.7.1. However, whenever I run ‘mvn test’, the test xml indicates that surefire.test.class.path and java.class.path includes a reference to xercesImpl 2.4.0 (as well as 2.7.1).

I realise that this sort of problem has occurred before from the archives. But I haven’t been able to work it out.

I am running Maven 2.2.1 on Windows 7 from the commmand line, with Java 1.6.037. I am using the master branch.

Any help/advice appreciated.

Thanks,

Neil

Neil,

when you use a pom file that declares dependencies on artifacts from 2.0-SNAPSHOT, your project will depend on the dependencies of that artifact as well (transitive dependencies). Maven will download those artifacts and their poms. The example you indicate refers to 2.0-SNAPSHOT, which was (then) trunk years ago. Did you modify these to refer to the current master 2.3-SNAPSHOT?

"mvn dependency:tree" is your friend. (Search the output for xerces and look for conflicts.)

Note also that Justin is currently removing all explicit xerces dependencies so we can use the copy of xerces 2.6 built into the JDK. This should happen in the next few weeks.

Kind regards,
Ben.

On 25/11/12 04:06, Neil vB wrote:

Hello,

I'm a newbie developer. I've been following the REST Services example in
the Geoserver docs
(http://docs.geoserver.org/stable/en/developer/programming-guide/rest-services/implementing.html) but
I'm getting an AbstractMethodError due to what I think is some kind of
conflict between xercesImpl versions 2.7.1 and 2.4.0.

From what I can tell, the pom files in Geoserver only reference
xercesImpl version 2.7.1. However, whenever I run 'mvn test', the test
xml indicates that surefire.test.class.path and java.class.path includes
a reference to xercesImpl 2.4.0 (as well as 2.7.1).

I realise that this sort of problem has occurred before from the
archives. But I haven't been able to work it out.

I am running Maven 2.2.1 on Windows 7 from the commmand line, with Java
1.6.037. I am using the master branch.

Any help/advice appreciated.

Thanks,

Neil

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

Hello,

Thanks for the reply.

I was using the 2.3-SNAPSHOT artifacts. When I ran mvn dependency:tree I received the output (condensed) below, in case it is useful:

[INFO] [dependency:tree {execution: default-cli}]
[INFO] org.geoserver:hello_rest:jar:1.0-SNAPSHOT
[INFO] ± org.geoserver:rest:jar:2.3-SNAPSHOT:compile
[INFO] | ± org.geoserver:main:jar:2.3-SNAPSHOT:compile
[INFO] | | ± org.geoserver:ows:jar:2.3-SNAPSHOT:compile
[INFO] | | | ± org.geotools.xsd:gt-xsd-core:jar:9-SNAPSHOT:compile
[INFO] | | | | ± xml-apis:xml-apis-xerces:jar:2.7.1:compile

[INFO] | ± org.geotools:gt-api:jar:9-SNAPSHOT:compile
[INFO] | | ± com.vividsolutions:jts:jar:1.12:compile
[INFO] | | | - xerces:xercesImpl:jar:2.4.0:compile

Cheers

Neil

On Mon, Nov 26, 2012 at 4:33 AM, Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com> wrote:

Neil,

when you use a pom file that declares dependencies on artifacts from 2.0-SNAPSHOT, your project will depend on the dependencies of that artifact as well (transitive dependencies). Maven will download those artifacts and their poms. The example you indicate refers to 2.0-SNAPSHOT, which was (then) trunk years ago. Did you modify these to refer to the current master 2.3-SNAPSHOT?

“mvn dependency:tree” is your friend. (Search the output for xerces and look for conflicts.)

Note also that Justin is currently removing all explicit xerces dependencies so we can use the copy of xerces 2.6 built into the JDK. This should happen in the next few weeks.

Kind regards,
Ben.

On 25/11/12 04:06, Neil vB wrote:

Hello,

I’m a newbie developer. I’ve been following the REST Services example in
the Geoserver docs
(http://docs.geoserver.org/stable/en/developer/programming-guide/rest-services/implementing.html) but
I’m getting an AbstractMethodError due to what I think is some kind of
conflict between xercesImpl versions 2.7.1 and 2.4.0.

From what I can tell, the pom files in Geoserver only reference
xercesImpl version 2.7.1. However, whenever I run ‘mvn test’, the test
xml indicates that surefire.test.class.path and java.class.path includes
a reference to xercesImpl 2.4.0 (as well as 2.7.1).

I realise that this sort of problem has occurred before from the
archives. But I haven’t been able to work it out.

I am running Maven 2.2.1 on Windows 7 from the commmand line, with Java
1.6.037. I am using the master branch.

Any help/advice appreciated.

Thanks,

Neil


Ben Caradoc-Davies Ben.Caradoc-Davies@anonymised.com
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

Niel,

when I look at GeoServer main I see gt-api without any transitive dependencies:

[INFO] +- org.geotools:gt-api:jar:9-SNAPSHOT:compile

When I look at GeoTools gt-api I see Maven handling the conflict gracefully:

[INFO] org.geotools:gt-api:jar:9-SNAPSHOT
[INFO] +- com.vividsolutions:jts:jar:1.12:compile
[INFO] | \- xerces:xercesImpl:jar:2.7.1:compile (version managed from 2.4.0)

I am using Maven 3.0.4, which has many improvements in the handling of dependencies. Are you able to try Maven 3.0.4 to see if it behaves differently?

Kind regards,
Ben.

On 28/11/12 04:14, Neil vB wrote:

Hello,

Thanks for the reply.

I was using the 2.3-SNAPSHOT artifacts. When I ran mvn dependency:tree I
received the output (condensed) below, in case it is useful:

[INFO] [dependency:tree {execution: default-cli}]
[INFO] org.geoserver:hello_rest:jar:1.0-SNAPSHOT
[INFO] +- org.geoserver:rest:jar:2.3-SNAPSHOT:compile
[INFO] | +- org.geoserver:main:jar:2.3-SNAPSHOT:compile
[INFO] | | +- org.geoserver:ows:jar:2.3-SNAPSHOT:compile
[INFO] | | | +- org.geotools.xsd:gt-xsd-core:jar:9-SNAPSHOT:compile
[INFO] | | | | +- xml-apis:xml-apis-xerces:jar:2.7.1:compile
...
[INFO] | +- org.geotools:gt-api:jar:9-SNAPSHOT:compile
[INFO] | | +- com.vividsolutions:jts:jar:1.12:compile
[INFO] | | | \- xerces:xercesImpl:jar:2.4.0:compile

Cheers

Neil

On Mon, Nov 26, 2012 at 4:33 AM, Ben Caradoc-Davies
<Ben.Caradoc-Davies@anonymised.com <mailto:Ben.Caradoc-Davies@anonymised.com>> wrote:

    Neil,

    when you use a pom file that declares dependencies on artifacts from
    2.0-SNAPSHOT, your project will depend on the dependencies of that
    artifact as well (transitive dependencies). Maven will download
    those artifacts and their poms. The example you indicate refers to
    2.0-SNAPSHOT, which was (then) trunk years ago. Did you modify these
    to refer to the current master 2.3-SNAPSHOT?

    "mvn dependency:tree" is your friend. (Search the output for xerces
    and look for conflicts.)

    Note also that Justin is currently removing all explicit xerces
    dependencies so we can use the copy of xerces 2.6 built into the
    JDK. This should happen in the next few weeks.

    Kind regards,
    Ben.

    On 25/11/12 04:06, Neil vB wrote:

        Hello,

        I'm a newbie developer. I've been following the REST Services
        example in
        the Geoserver docs
        (http://docs.geoserver.org/__stable/en/developer/__programming-guide/rest-__services/implementing.html
        <http://docs.geoserver.org/stable/en/developer/programming-guide/rest-services/implementing.html&gt;\)
        but
        I'm getting an AbstractMethodError due to what I think is some
        kind of
        conflict between xercesImpl versions 2.7.1 and 2.4.0.

          From what I can tell, the pom files in Geoserver only reference
        xercesImpl version 2.7.1. However, whenever I run 'mvn test',
        the test
        xml indicates that surefire.test.class.path and java.class.path
        includes
        a reference to xercesImpl 2.4.0 (as well as 2.7.1).

        I realise that this sort of problem has occurred before from the
        archives. But I haven't been able to work it out.

        I am running Maven 2.2.1 on Windows 7 from the commmand line,
        with Java
        1.6.037. I am using the master branch.

        Any help/advice appreciated.

        Thanks,

        Neil

    --
    Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com>
    Software Engineer
    CSIRO Earth Science and Resource Engineering
    Australian Resources Research Centre

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

Hi,

I am now using Maven 3.0.4.

When I ran the tree command on the hello_rest example the dependency on xercesimpl remained (at version 2.4.0 with no ‘managed from’ message). There was no such dependency when I looked at main.

After reading a thread about this (http://jira.codehaus.org/browse/GEOT-3942) I removed the dependency by adding the following to my hello rest pom:

org.geotools gt-main 9-SNAPSHOT xercesImpl xerces

The test now runs without complaining about an AbstractMessageError.

I may as well note here that the test only passed for me when I appended a new line character to the end of the expected string in the assert, like so:

public void test() throws Exception {
assertEquals(“Hello World\n”, getAsString(“/rest/hello.txt”));
}

Cheers,

Neil

On Wed, Nov 28, 2012 at 3:57 AM, Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com> wrote:

Niel,

when I look at GeoServer main I see gt-api without any transitive dependencies:

[INFO] ± org.geotools:gt-api:jar:9-SNAPSHOT:compile

When I look at GeoTools gt-api I see Maven handling the conflict gracefully:

[INFO] org.geotools:gt-api:jar:9-SNAPSHOT

[INFO] ± com.vividsolutions:jts:jar:1.12:compile

[INFO] | - xerces:xercesImpl:jar:2.7.1:compile (version managed from 2.4.0)

I am using Maven 3.0.4, which has many improvements in the handling of dependencies. Are you able to try Maven 3.0.4 to see if it behaves differently?

Kind regards,
Ben.

On 28/11/12 04:14, Neil vB wrote:

Hello,

Thanks for the reply.

I was using the 2.3-SNAPSHOT artifacts. When I ran mvn dependency:tree I
received the output (condensed) below, in case it is useful:

[INFO] [dependency:tree {execution: default-cli}]
[INFO] org.geoserver:hello_rest:jar:1.0-SNAPSHOT
[INFO] ± org.geoserver:rest:jar:2.3-SNAPSHOT:compile
[INFO] | ± org.geoserver:main:jar:2.3-SNAPSHOT:compile
[INFO] | | ± org.geoserver:ows:jar:2.3-SNAPSHOT:compile
[INFO] | | | ± org.geotools.xsd:gt-xsd-core:jar:9-SNAPSHOT:compile
[INFO] | | | | ± xml-apis:xml-apis-xerces:jar:2.7.1:compile

[INFO] | ± org.geotools:gt-api:jar:9-SNAPSHOT:compile
[INFO] | | ± com.vividsolutions:jts:jar:1.12:compile
[INFO] | | | - xerces:xercesImpl:jar:2.4.0:compile

Cheers

Neil

On Mon, Nov 26, 2012 at 4:33 AM, Ben Caradoc-Davies

<Ben.Caradoc-Davies@anonymised.com mailto:[Ben.Caradoc-Davies@csiro.au](mailto:Ben.Caradoc-Davies@anonymised.com)> wrote:

Neil,

when you use a pom file that declares dependencies on artifacts from
2.0-SNAPSHOT, your project will depend on the dependencies of that
artifact as well (transitive dependencies). Maven will download
those artifacts and their poms. The example you indicate refers to
2.0-SNAPSHOT, which was (then) trunk years ago. Did you modify these
to refer to the current master 2.3-SNAPSHOT?

“mvn dependency:tree” is your friend. (Search the output for xerces
and look for conflicts.)

Note also that Justin is currently removing all explicit xerces
dependencies so we can use the copy of xerces 2.6 built into the
JDK. This should happen in the next few weeks.

Kind regards,
Ben.

On 25/11/12 04:06, Neil vB wrote:

Hello,

I’m a newbie developer. I’ve been following the REST Services
example in
the Geoserver docs

(http://docs.geoserver.org/__stable/en/developer/__programming-guide/rest-__services/implementing.html
<http://docs.geoserver.org/stable/en/developer/programming-guide/rest-services/implementing.html>)

but
I’m getting an AbstractMethodError due to what I think is some
kind of
conflict between xercesImpl versions 2.7.1 and 2.4.0.

From what I can tell, the pom files in Geoserver only reference
xercesImpl version 2.7.1. However, whenever I run ‘mvn test’,
the test
xml indicates that surefire.test.class.path and java.class.path
includes
a reference to xercesImpl 2.4.0 (as well as 2.7.1).

I realise that this sort of problem has occurred before from the
archives. But I haven’t been able to work it out.

I am running Maven 2.2.1 on Windows 7 from the commmand line,
with Java
1.6.037. I am using the master branch.

Any help/advice appreciated.

Thanks,

Neil


Ben Caradoc-Davies Ben.Caradoc-Davies@anonymised.com
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre


Ben Caradoc-Davies Ben.Caradoc-Davies@anonymised.com
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre