Category Archives: java

I want the last 2 hours back!

I just spent a few hours writing an Acegi filter to get a certificate from a form post, and put it into a modified User Detail principle. All well and good, except after a redirect back to / I got … Continue reading

Posted in java, Spring | Leave a comment

Spring and JNDI (Tomcat or Jetty)

Recently I had need to deploy some Spring webapps which required predeploy configuration. Being the first time I had to find a serious answer I looked to the mythical JNDI for an answer. This document is meant to complement other … Continue reading

Posted in java, Maven, Spring | 9 Comments

Maven classpath issues at compile time

Here’s a very weird Maven/Java issue. The error message (below) occurs in my build phase where JaxB is called to produce some Java objects from XML. JaxB calls HyperJaxB, and on some systems it crashes. [ERROR] XJC while compiling schema(s): … Continue reading

Posted in Archer, java, Maven | 2 Comments

ManyToOne reference loading with JPA/Hibernate

In this example an InvestigationType has many SampleType’s. If I load an InvestigationType via em (entity manager) find it also loads the samples. 1. InvestigationType inv2 = (InvestigationType) em.find( 2. InvestigationType.class, inv.getId()); 3. System.out.println(“Inv2 ID=”+inv2.getId()); 4. System.out.println(“Inv2 Title=”+inv2.getTitle()); 5. assertTrue(inv2.getSample().size() … Continue reading

Posted in Archer, java, JPA | 1 Comment

Hibernate, spring, and different jars

The situation is this. I had a working application which used Hibernate annotated classes, and JTA for data bindings, within a spring framework. Then I moved the annotated classes into a Jar file, and the application stopped working. Hibernate knew … Continue reading

Posted in java, programming, Spring | Leave a comment

Spring 2.0.6 and ACEGI

Because ACEGI depends on spring 1.2.6, we need to override a few dependencies if we want to use spring 2.0.6. To do this, we use the following exclusions: <dependency> <groupId>org.acegisecurity</groupId> <artifactId>acegi-security</artifactId> <version>1.0.5</version> <exclusions> <exclusion> <artifactId>spring-aop</artifactId> <groupId>org.springframework</groupId> </exclusion> <exclusion> <artifactId>spring-beans</artifactId> <groupId>org.springframework</groupId> … Continue reading

Posted in java | 1 Comment

Setting up Tomcat behind Apache 2.2 in a hierarchical path

The situation I want to deal with is this: Public Web Root  |-plone  \-portals     |-portal1 (server A)     \-portal2 (server B) In apache 2.2 they (the writers of the Apache docs) seem to prefer the use of mod_proxy_ajp, which is an … Continue reading

Posted in java | Leave a comment

Maven-Ant hybrid

Some brief background. Ant is the stock standard Java build system, much as Make is for C/C++. Maven is a newer Java build system which tried to, amongst other things, solver the Jar dependency hell problem, as well as make … Continue reading

Posted in java, programming, technology | Leave a comment

Four things which would make my Linux wonderful

1. Presentation controller for my bluetooth phone In fact this already exists, in many forms apparently. The trick for me was to get it working. If I was to derive it from scratch I would have made a simple, mappable … Continue reading

Posted in bluetooth, java, linux, technology | 6 Comments

Java HTML Table parser

I put together this class for scraping HTML tables. It supports nested tables. At some stage I’ll put this up in SVN along with it’s test cases. import; import; import java.util.ArrayList; import java.util.Stack;import javax.swing.text.MutableAttributeSet; import javax.swing.text.html.HTML; import javax.swing.text.html.HTMLEditorKit; … Continue reading

Posted in java | 3 Comments