Archive for the ‘java’ Category
« Older Entries Newer Entries »Solving the eclipselink (former toplink) issue with HSQLDB
Tuesday, August 12th, 2008
Posted in: J2EE, JPA, eclipselink, java.
When using the great hypersonic java database (hsql) with eclipselink 1.0, i stumbled upon a schema generation (ddl generation) issue. It appears as though eclipselink generates “CREATE TABLE…” statements containing UNIQUE keywords which are incompatible with HSQLDB.
As it turned out, there already is an issue filed for the problem (240618).
The resulting exceptions look like this:
[EL Warning]: 2008.08.12 11:01:13.134--ServerSession(28607378)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 1.0 (Build 1.0 - 20080707)): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Unexpected token: UNIQUE in statement [CREATE TABLE ... (ID INTEGER UNIQUE]
Error Code: -11
Read the rest of “Solving the eclipselink (former toplink) issue with HSQLDB”
Configuring Eclipse Ganymede with subversion in Ubuntu 8.04
Sunday, July 13th, 2008
Posted in: J2EE, SCM, System engineering, eclipse, java, subclipse, subversion, subversive, ubuntu.
After installing the all-new Eclipse ganymede (by downloading it from the eclipse site) under ubuntu 8.04 i ran into some trouble after installing version 1.4.1 of the subclipse subversion plugin.
Long story short, subclipse requires subversion 1.5, but ubuntu 8.04 provides 1.4.x.
If you still want to use subclipse with ganymede in ubuntu, there are only two ways two achieve this – both of which i cannot recommend because they are hacks or bad compromises.
Read the rest of “Configuring Eclipse Ganymede with subversion in Ubuntu 8.04″
Howto use acegi-security and the @Secured annotation for method interception
Friday, July 4th, 2008
Posted in: J2EE, System architecture, acegi, java, spring.
Acegi-security (now spring-security) provides a @Secured (org.acegisecurity.annotation.Secured) annotation.
Classes using this annotation can be processed by a suitable BeanPostProcessor, which will proxy the class so that calls to @Secured methods are intercepted and the required authentication is validated against the acegi security context. Note that the following is a configuration for acegi-security, things might be different with spring-security.
2008-07-12: Comment: It is indeed a lot simpler using spring-security, as Craig Walls demonstrates in this posting in his blog “Spring-Loaded”).
In order to activate the post processing for the @Secured annotations, a spring configuration such as the following is required:
Read the rest of “Howto use acegi-security and the @Secured annotation for method interception”
Checkstyle error: Uncommented main method found…
Wednesday, May 14th, 2008
Posted in: fun with code, java.
Just for the record: The checkstyle error Uncommented main method found does NOT mean the main method lacks a javadoc comment, but that the main method is not commented out. Checkstyle regards main methods as useless “debugging” leftovers.
//CHECKSTYLE:OFF and //CHECKSTYLE:ON helped me out. And yes, i think this particular check is really, really, really useless. I think someone using arbitrary main methods in sourcecode for debugging purposes is hardly going to know of checkstyle’s existence anyway…
Why it’s better to integrate XML schema files into the classpath
Saturday, May 10th, 2008
Posted in: J2EE, System architecture, java, spring.
When using schema files in your XML configuration, it’s might happen that your XML parser will attempt to actually download the schema file using the configured schema URI.
This is the case when there is no mechanism for resolving the schema URI to a local schema file (as, for example the bean handler registration in spring) or when such a mechanism fails.
Read the rest of “Why it’s better to integrate XML schema files into the classpath”
OutOfMemoryError using findbugs & continuum – and how to fix it.
Monday, April 21st, 2008
Posted in: continuum, java, maven 2.
When using findbugs through the findbugs maven plugin, one is very likely to see the maven build in continuum fail with an OutOfMemory-Exception like this:
Read the rest of “OutOfMemoryError using findbugs & continuum – and how to fix it.”
ContinuumBuildCancelledException in continuum
Monday, April 21st, 2008
Posted in: continuum, java, maven 2.
Users of continuum might see their builds fail with the following exception when running a little more voluminous build:
org.apache.maven.continuum.execution.ContinuumBuildCancelledException: The build was cancelled
Read the rest of "ContinuumBuildCancelledException in continuum"
Configuring custom username for maven’s scm with subversion and ssh
Monday, April 21st, 2008
Posted in: System engineering, continuum, java, maven 2, subversion.
I just stumbled over a nice little problem: When using the maven 2 changelog plugin, it automatically uses the configured <scm> settings and attempts to fetch the change history with them.
Unfortunately, such a setting usually does not contain a username, since this has to be provided by the actual team member connecting to version control.
Neither did i have any intention to configure a placeholder into the scm section, forcing the developers to mess with the maven settings.xml in order to provide their own username.
Luckily, after searching a while, i found a proper solution.
SSH allows an optional per-host specific username setting to be placed in a file called “config” located in the user’s .ssh directory, for example
File: ~/.ssh/config
Host my.host.name
User myusername
Thanks to Chad Humphries for posting the Solution on programming is hard.
It really wasn’t…
OutOfMemoryException (PermGenSpace) with Eclipse JEE
Sunday, April 13th, 2008
Posted in: J2EE, eclipse, java.
The Eclipse JEE distribution Europa Winter appears to have a memory issue with the default JVM memory settings, causing an OutOfMemoryException of the PermGenSpace which makes the IDE hang up and / or exit.
This issue appears to be subject of several bug reports and discussions (see for example this discussion at EclipseZone) .
In general, the fix or workaround for the problem is assigning more memory to the PermGenSpace while increasing the amount of heapspace.
The following entries in the eclipse.ini (located in the eclipse installation root folder) did it for me:
-Xms40m
-Xmx512m
-XX:MaxPermSize=96m
Not that this workaround will only work with sun’s Java distribution (which is the most common), but not with IBM’s, since the latter does not support setting the maxPermSize with -XX:MaxPermSize.
No CommentsInternationalisierung mit Spring
Friday, March 28th, 2008
Das spring framework bietet eine Reihe mächtiger, aber einfach zu verwendenden Mechanismen für Internationalisierung.
In diesem Blog wird eine recht gute Einführung mit Codebeispielen gegeben.
