| 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

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); 8 Years...; Attack Against Encrypted Linux Disks; Pushing Back On NSA At IETF; Summary of Experimental Ethics; Very Good Talk On Security, Snowden; Locusts are Grasshoppers!; Vagrant (OpenSuse and IDEs); Interesting Take On Mandela's Context; Haskell Cabal O(n^2) / O(n) Fix; How I Am 4; Chilean Charity Supporting Women; Doing SSH right; Festival of Urban Intervention; Neat Idea - Wormholes Provide Entanglement; And a Link....; Simple Encryption for Python 2.7; OpenSuse 13.1 Is Better!; Little Gain...; More Details on Technofull Damage; Palmrest Cracked Too....; Tecnofull (Lenovo Support) Is Fucking Useless; The Neuroscientist Who Discovered He Was a Psychopath; Interpolating Polynomials; Bottlehead Crack as Pre-amp; Ooops K702!; Bottlehead Crack, AKG K701; Breaking RC5 Without Rotation; Great post thank you; Big Balls of Mud; Phabricator - Tools for working together; Amazing Julia RC5 Code Parameterized By Word Size; Chi-Square Can Be Two-Sided; Why Do Brits Accept Surveillance?; Statistics Done Wrong; Mesas Trape from Bravo; European Report on Crypto Primitives and Protocols; Interesting Omissions; Oryx And Crake (Margaret Atwood); Music and Theory; My Arduino Programs; Elliptic Curve Crypto; Re: Licensing Interpreted Code; Licensing Interpreted Code; ASUS 1015E-DS03 OpenSuse 12.3 SSD; translating lettuce feature files into stub steps files; Re: translating lettuce feature files into stub steps files; A Tale of Two Psychiatrists

© 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