| Andrew Cooke | Contents | Latest | RSS | Twitter | Previous | Next

C[omp]ute

Welcome to my blog, which was once a mailing list of the same name and is still generated by mail. Please reply via the "comment" links.

Always interested in offers/projects/new ideas. Eclectic experience in fields like: numerical computing; Python web; Java enterprise; functional languages; GPGPU; SQL databases; etc. Based in Santiago, Chile; telecommute worldwide. CV; email.

Personal Projects

Lepl parser for Python.

Colorless Green.

Photography around Santiago.

SVG experiment.

Professional Portfolio

Calibration of seismometers.

Data access via web services.

Cache rewrite.

Extending OpenSSH.

Last 100 entries

I Want To Be A Redneck!; Reverse Racism; The Lost Art Of Nomography; IBM Data Center (Photo); Interesting Account Of Gamma Hack; The Most Interesting Audiophile In The World; How did the first world war actually end?; Ky - Restaurant Santiago; The Black Dork Lives!; The UN Requires Unaninmous Decisions; LPIR - Steganography in Practice; How I Am 6; Clear Explanation of Verizon / Level 3 / Netflix; Teenage Girls; Formalising NSA Attacks; Switching Brakes (Tektro Hydraulic); Naim NAP 100 (Power Amp); AKG 550 First Impressions; Facebook manipulates emotions (no really); Map Reduce "No Longer Used" At Google; Removing RAID metadata; New Bike (Good Bike Shop, Santiago Chile); Removing APE Tags in Linux; Compiling Python 3.0 With GCC 4.8; Maven is Amazing; Generating Docs from a GitHub Wiki; Modular Shelves; Bash Best Practices; Good Emergency Gasfiter (Santiago, Chile); Readings in Recent Architecture; Roger Casement; Integrated Information Theory (Or Not); Possibly undefined macro AC_ENABLE_SHARED; Update on Charges; Sunburst Visualisation; Spectral Embeddings (Distances -> Coordinates); Introduction to Causality; Filtering To Help Colour-Blindness; ASUS 1015E-DS02 Too; Ready Player One; Writing Clear, Fast Julia Code; List of LatAm Novels; Running (for women); Building a Jenkins Plugin and a Jar (for Command Line use); Headphone Test Recordings; Causal Consistency; The Quest for Randomness; Chat Wars; Real-life Financial Co Without ACID Database...; Flexible Muscle-Based Locomotion for Bipedal Creatures; SQL Performance Explained; The Little Manual of API Design; Multiple Word Sizes; CRC - Next Steps; FizzBuzz; Update on CRCs; Decent Links / Discussion Community; Automated Reasoning About LLVM Optimizations and Undefined Behavior; A Painless Guide To CRC Error Detection Algorithms; Tests in Julia; Dave Eggers: what's so funny about peace, love and Starship?; Cello - High Level C Programming; autoreconf needs tar; Will Self Goes To Heathrow; Top 5 BioInformatics Papers; Vasovagal Response; Good Food in Vina; Chilean Drug Criminals Use Subsitution Cipher; Adrenaline; Stiglitz on the Impact of Technology; Why Not; How I Am 5; Lenovo X240 OpenSuse 13.1; NSA and GCHQ - Psychological Trolls; Finite Fields in Julia (Defining Your Own Number Type); Julian Assange; Starting Qemu on OpenSuse; Noisy GAs/TMs; Venezuela; Reinstalling GRUB with EFI; Instructions For Disabling KDE Indexing; Evolving Speakers; Changing Salt Size in Simple Crypt 3.0.0; Logarithmic Map (Moved); More Info; Words Found in Voynich Manuscript; An Inventory Of 3D Space-Filling Curves; Foxes Using Magnetic Fields To Hunt; 5 Rounds RC5 No Rotation; JP Morgan and Madoff; Ori - Secure, Distributed File System; Physical Unclonable Functions (PUFs); Prejudice on Reddit; Recursion OK; Optimizing Julia Code; Cash Handouts in Brazil; Couple Nice Music Videos; It Also Works!; Adaptive Plaintext; It Works!; RC5 Without Rotation (2)

© 2006-2013 Andrew Cooke (site) / post authors (content).

Java XML dependencies, Deployment, Building etc

From: "andrew cooke" <andrew@...>

Date: Fri, 17 Mar 2006 12:33:33 -0400 (CLT)

[This from an email I just sent at work]

This is probably going to be a fairly common problem, and is something
that could affect deployment.

Java famously has a problem when different (and incompatible) versions of
jars exist on the classpath (google "Java Jar Hell").  This is
particularly true for XML libraries, which have to track rapidly evolving
standards.

For example, Java 1.5 includes Xerces 2.6.2 (same classes, renamed to
com.sun), but Apache Commmons Pool (which several 3rd party packages
depend on) depends on Xerces 2.0.2.  Having both Xerces jars in the same
classpath causes problems.

To work around this:
- we need to exclude certain dependncies in Maven
- we need to be aware fo possible problems during deployment

I have solved (I believe) my immediate problems by blocking Xerces
dependencies in Maven.  In the POM I define dependencies like:

    <dependency>
      <groupId>some.group</groupId>
      <artifactId>some.artifact</artifactId>
      <version>version</version>
      <exclusions>
        <exclusion>
          <groupId>xerces</groupId>
          <artifactId>xerces</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

For deployment this may be insufficient.  Xerces may already be present in
JBoss, for example.

Andrew

More Details: AbstractMethodError (Xerces 2.6.2 with 2.0.2)

From: "andrew cooke" <andrew@...>

Date: Fri, 17 Mar 2006 12:35:50 -0400 (CLT)

[From an email sent to the Xerces mailing list]

I have code with the line:
  element.setIdAttribute(ID, true);
where element is an instance of org.w3c.dom.NodeList and the base document
was created via javax.xml.parsers.DocumentBuilderFactory.newInstance() \
.newDocumentBuilder().newDocument()

This gives the error:
  java.lang.AbstractMethodError:
    org.apache.xerces.dom.ElementImpl.setIdAttribute(Ljava/lang/String;Z)V

I am using Java 1.5.0_04-b05 (JAXP 1.3; Xerces-J 2.6.2) on Suse 9.3.

After some investigation it seems that this only happens when Xerces 2.0.2
appears on the classpath.  This is true even if I explcitly include (in
addition to 2.0.2) Xerces 2.6.2 (rather than relying on JAXP) and use
  -Dorg.apache.xerces.xni.parser.XMLParserConfiguration=
    org.apache.xerces.parsers.StandardParserConfiguration

Questions:
- Is there any way to avoid this error *without* cleaning old versions of
Xerces out of the claspath?
- And is cleaning old versions of Xerces out of the classpath guaranteed
to fix this?

Doesn't Carry Across to Eclipse via mvn eclipse:eclipse

From: "andrew cooke" <andrew@...>

Date: Fri, 17 Mar 2006 13:36:43 -0400 (CLT)

Unfortunately this doesn't carry across to Eclipse.  When the test runs in
Eclipse it still fails with the same error.  This is because the
dependency comes via other projects in eclipse; Eclipse's dependency
handling doesn't "know about" Mule's exclusion.

To fix this, you need to delete Xerces from the projects on which the root
project depends within Eclipse.  To see the list, use "Configure Build
Path" in the root project.  Then use the same dialogue in each sub-project
to remove Xerces.  This probably has to be repeated after each run of mvn
eclipse:eclipse.

Specifying an External/Later Xerces/Xalan

From: "andrew cooke" <andrew@...>

Date: Sat, 18 Mar 2006 09:07:37 -0400 (CLT)

To specify a later, external release of Xerces/Xalan you need to follow
the instructions here:

http://xerces.apache.org/xerces2-j/faq-dom.html#faq-7
http://xml.apache.org/xalan-j/faq.html#jdk14
http://java.sun.com/j2se/1.4.2/docs/guide/standards/

Basically, you grab the xalan tarball and place the jars in jre/lib/endorsed.

Once that is done, Java uses those implementations by default.  You can
test this by writing code as described at
http://xml.apache.org/xalan-j/faq.html#faq-N10064

HOWEVER... while this works from the command line, or in Maven, it does
not work for code executed inside Eclipse.  At least, when running junit
tests in Eclipse 3.1.0 the diagnostics reported the internal JAXP (instead
of the endorsed libraries) in the following cases:

- with the libraries deployed as above
- as above plus a "vmarg" to eclipse defining the directory
- as above plus appearing in the build path for the project
- as above plus appearing in the Java VM libraries (as defined in Eclipse)

Simple works!

From: "andrew cooke" <andrew@...>

Date: Sun, 28 May 2006 11:05:21 -0400 (CLT)

Whoa.  Whatever I was doing earlier (above) was way too complex.

I don't know what happened, but I ended up with things broken again.  So I
cleaned out everything (Eclipse config, Maven pom, Java) and started from
zero.

All that was necessary was:

- exclude xerces from any dependnecy in the pom.  This stops 2.0 being
pulled in, which messes everything up.

- declare xercesImpl 2.6.2 as a dependency

That's it.  Everything just works.  Duh.

Comment on this post