Total Pageviews

Tuesday, December 05, 2006

JAMon to monitor performance of Java programs


I discovered a nice open source monitoring API called JAMon, which aggregates the monitoring results and performs the calculation in memory. It claims to do this in a very fast way, so you can use the tool even in production environment.

It comes with a very handy and useful web application for viewing and querying the statistics.

Combined with AspectJ anyone is able to insert performance monitoring code into an existing application without touching the existing code.

Sunday, November 26, 2006

Generic typesafe DAOs with Hibernate and Spring AOP


I am currently working on a JEE-5 project using Spring and EJB3/Hibernate. When it comes to encapsulate the access to a database the DAO pattern is used. But it has some drawbacks:

If you want to write a typesafe DAO you must repeat yourself over and over again, writing almost the same DAO code for each and every business object. Of course, you can make the DAO a generic one, but then you are loosing type safety. But there is a better way since JDK5 introduces generics.

At the W-JAX in Munich Adam Bien talked about a very good article on IBMs developer site called "Don't repeat the DAO". If you want to implement a generic and typesafe DAO using Spring and Hibernate you have to check it out at:

Another good example using plain Hibernate/EJB3 can be found on the Hibernate page under http://hibernate.org/328.html.

Sunday, November 19, 2006

Using Maven Embedder and logging almost drove me nuts


I was recently experimenting with the maven embedder component (Version 2.0.4) to embed Maven into IDEA using the embedder API.

Somehow I called the setLogger(...) method AFTER I called maven.start(). This almost drove me crazy, because I didn't get any output. The trick is, to call the setLogger(...) method before a call to maven.start(), e.g. just like this (as described in the maven docs, see http://maven.apache.org/guides/mini/guide-embedding-m2.html):


MavenEmbedder maven = new MavenEmbedder();
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
maven.setClassLoader( classLoader );
maven.setLogger( new MavenEmbedderConsoleLogger() );
maven.start();



It seems that it is currently (in Version 2.0.4) not possible to set the logger after the embedder was started.


Maybe this is helpful for others.

Tuesday, November 14, 2006

Tacx and the right contact pressure between tire and roller


Well, the summer season of cycling is over and I wanted to start practicing on my Tacx roller trainer again during the winter.

So I mounted my bike back on the trainer and started the virtual cycling. But comparing to my results of the last winter season something was totally wrong. My times were incredible slow and I had the feeling that I spent way too much power to drive as fast as the rides from last winter.

So I started digging the internet for the solution of my problem and found something interesting in a german cycling message board http://www.imagic-liga.de/n_forum/viewthread.php?boardid=4&thid=703

The pressure between the tire and the roller was incorrect! Here is what you have to do to determine the correct pressure:

  1. Start Catalyst
  2. Slope=0
  3. Accelerate to 40 km/h ~ 25 mp/h
  4. Let it roll out
  5. After approx. 10 seconds the velocity should be 0 km/h. In that case the contact pressure is correct
  6. If the tire is still rolling after 10 seconds the contact pressure is too low
  7. If the tire stops earlier the contact pressure is too high

Monday, November 13, 2006

Attended W-JAX in Munich

I attended the W-JAX in Munich from 2006-11-06 until 2006-11-09. Lots of great speakers with some very good sessions about JSF, EJB3, Application Architecture Management, Agile Development and more.

Sunday, November 12, 2006

Release of IntelliJ IDEA Maven-2 Integration plugin 1.1


This version is a feature and bugfix release. Please checkout the release notes below and also the updated documentation on http://quebbemann.kicks-ass.net/idea-maven-plugin/usage.html

Important note:

Before
version 1.1 of the plugin, Maven was called via the start script
provided with the normal Maven installation. In order to get better
access to the running Maven process Maven now is called directly by
starting a Java process. This for example allows terminating the
running Maven process by the user.

Change notes:

Bug

  • Sorting of goals should not move Phases node from top position
  • Spaces in pathname of POM file causes build failure

Improvement


New Feature
  • Add a "Cancel Build" button to the build output window
  • Add a "Close Output" button to build output window
  • Add a "Pause Output" button to build output window
  • Add a "Rerun Maven" button to build output window

Task

  • Remove references to non-public Maven repository

Thursday, November 09, 2006

Release of IntelliJ IDEA Maven-2 Integration plugin 1.0.1


Version 1.0.1 is a bugfix release:
Bug
  • Removed reference to parent POM
Improvement
  • Minor changes in build process with Maven
  • Java sources for corresponding XML schemas are generated during the build using the xmlbeans-maven-plugin
  • Updated documentation on http://quebbemann.kicks-ass.net/idea-maven-plugin
  • Added more screenshots

Wednesday, October 25, 2006

Release of IntelliJ IDEA Maven-2 Integration plugin


Today I released a Maven-2 Integration plugin for IntelliJ IDEA 5.x and 6.x. It's in a very early state but already usable. Please checkout the plugin homepage for more details and screenshots.

Friday, September 29, 2006

XMLException: Unexpected element: CDATA with XMLBeans 2.x - Read the API docs carefully


I recently got an exception while parsing a XML file with XMLBeans 2.x. During the parse of the file I received the exception:
XMLException: Unexpected element: CDATA with XMLBeans 2.x
I called the xxxDocument.Factory.parse(String xmlAsString) method with a string argument pointing to the path of the XML file to parse. Well, at that time, I expected to use the "xmlAsString" parameter as a string object pointing to the path of my XML file (should have read the API docs more carefully). That was totally wrong!
After realizing my mistake I tried the xxxDocument.Factory.parse(File file) method which I called with a File object of the XML document to parse and that did the trick!
Well, I learned my lesson: Read the API docs carefully :-)

Monday, September 25, 2006

Annotation processing with APT-Jelly


There's not much documentation about APT-Jelly out there, although the docs on the homepage are very good I decided to write a short tutorial. APT-Jelly seems to me a little bit underrated and maybe this blog entry helps it to gain more attention .

Tutorial

Given the case we want to generate local and remote interfaces for our EJB3 business class implementation. Java 5 introduces a cool tool called APT (Annotation Processing Tool) which helps the developer in generating Java source files from annotations. Unfortunately it is (just my opinion) some kind of hard work to generate those classes. You have to implement an annotation processor and walk through all of the relevant types and methods that are annotated to generate the source files. At the latest now file templates (for the Java source files) seem to be the right choice in combination with a powerful templating engine like Velocity or Freemarker.
This is the time when APT-Jelly steps in.
APT-Jelly is an engine for generating artifacts (e.g. source code,
config files) from Java source code. APT-Jelly provides a
template-oriented approach to artifact generation by providing an interface for Sun's
Annotation Processing Tool (APT) to a templating engine. Currently, APT-Jelly has direct support for both Jakarta
Commons Jelly
and Freemarker, and indirect support for Velocity
(through the merging capabilities of Jelly).
This tutorial focusses on writing Freemarker templates with APT-Jelly.
Two types of annotations are relevant for our approach: A Type annotation and a Method annotation. Let's start with writing the type annotation.
The type annotation declares, that our business class might expose its methods to either a remote or a local interface or maybe to both interfaces. It might also be helpful that the generated interface extends other interfaces. So here is the "BusinessInterface" annotation declaring the above mentioned elements:
Annotation source file: BusinessInterface.java
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.annotation.ElementType;

@Retention(value = RetentionPolicy.SOURCE)
@Target(value = ElementType.TYPE)
public @interface BusinessInterface {

String local() default ""; // FQCN of the local interface String localExtends() default ""; // FQCN of the interface the local interface should extend String remote() default ""; // FQCN of the remote interface String remoteExtends() default ""; // FQCN of the interface the remote interface should extend
}
The 2nd annotation we are going to implement is a method annotation. We would like to declare, whether the annotated method should be a member of the local or the remote interface or maybe both. So here is the "InterfaceMethod" annotation.
Annotation source file: InterfaceMethod.java
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.annotation.ElementType;

@Retention(value = RetentionPolicy.SOURCE)
@Target(value = ElementType.METHOD)
public @interface InterfaceMethod {

boolean viewTypeLocal() default true; boolean viewTypeRemote() default true;
}
Now let's create a Freemarker template in conjunction with APT-Jelly and get the whole thing running:

The template: BusinessInterface.fmt
<@forAllTypes devar="type">
<@ifHasAnnotation var="ann" annotation="BusinessInterface">
<#if (ann.remote?length > 0)>
<@javaSource name="${ann.remote}">
<#assign interfaceName = ann.remote?substring(ann.remote?last_index_of(".") + 1)>
package ${type.package};
@javax.ejb.Remote
public interface ${interfaceName} <#if (ann.remoteExtends?length > 0)>extends ${ann.remoteExtends} {

<@forAllMethods var="method" annotation="InterfaceMethod" annotationVar="annotatedMethod" returnTypeVar="returnType">
<#if (annotatedMethod.viewTypeRemote = true)>
${method.returnType} ${method.simpleName}(<@forAllParameters var="param" indexVar="paramIndex"><#if paramIndex = 0>${param.type} ${param.simpleName}<#else>, ${param.type} ${param.simpleName})<@forAllThrownTypes var="exception" indexVar="exceptionIndex"><#if exceptionIndex = 0> throws <#else>, ${exception};



}


<#if (ann.local?length > 0)>
<@javaSource name="${ann.local}">
<#assign interfaceName = ann.local?substring(ann.local?last_index_of(".") + 1)>
package ${type.package};
@javax.ejb.Local
public interface ${interfaceName} <#if (ann.localExtends?length > 0)>extends ${ann.localExtends} {

<@forAllMethods var="method" annotation="InterfaceMethod" annotationVar="annotatedMethod" returnTypeVar="returnType">
<#if (annotatedMethod.viewTypeLocal = true)>
${method.returnType} ${method.simpleName}(<@forAllParameters var="param" indexVar="paramIndex"><#if paramIndex = 0>${param.type} ${param.simpleName}<#else>, ${param.type} ${param.simpleName})<@forAllThrownTypes var="exception" indexVar="exceptionIndex"><#if exceptionIndex = 0> throws <#else>, ${exception};



}



If you are familiar with Freemarker most of the stuff should be easy to understand. The interesting stuff are the custom directives of APT-Jelly. Those directives start with a "@". The Freemarker built-in functions start with a "#".
The lines:
<@forAllTypes var="type">
<@ifHasAnnotation var="ann" annotation="BusinessInterface">

iterates through all types (classes) with a type annotation called "BusinessInterface" we have developed earlier in this tutorial.
<#if (ann.remote?length > 0)>
Now it's interesting to see, whether we have to generate local, remote or both interfaces. We start by looking up the remote element. If the element's value length is greater 0 we assume that we have the FQCN of the remote interface and we can start generating a Java source file with this name:
<@javaSource name="${ann.remote}">
I leave out the generation of the class header (interface xxx extends yyy, etc..) and go straight on to generating the methods:
<@forAllMethods var="method" annotation="InterfaceMethod" annotationVar="annotatedMethod" returnTypeVar="returnType">
We have to iterate through all methods that are annotated with the annotation "InterfaceMethod" we developed earlier. Now we have to construct the interface methods.
<#if (annotatedMethod.viewTypeRemote = true)>

${method.returnType} ${method.simpleName}(
<@forAllParameters
var="param" indexVar="paramIndex"><#if paramIndex =
0>${param.type} ${param.simpleName} <#else>, ${param.type}
${param.simpleName}
)
<@forAllThrownTypes
var="exception" indexVar="exceptionIndex"><#if exceptionIndex =
0> throws <#else>,
${exception}
;


This expression looks very confusing (especially unformatted in this blog entry), but it is pretty simple. We determine, if the annotated method's viewType is remote (referencing the "annotationVar" variable in the @forAllMethods directive) and in this case we insert all the relevant parameters with the APT-Jelly @forAllParameters directive.
The last thing to do is adding the throws clause in case the method throws an exception (@forAllThrownTypes).
The second part of the template repeats the generating stuff for the local interfaces. The solution is not perfect, but it works and shows some of the power of APT-Jelly.

The last thing to do now is execute APT and generate the sources. There are at least 4 jar archives which must be added to the classpath when calling apt:
  1. apt-jelly-core
  2. apt-jelly-freemarker
  3. freemarker
and the jar containing the annotations we have developed for generating the business interfaces (ejb3-annotations-1.0-SNAPSHOT.jar). Assuming all the jars live in the directory e:/temp and the sources of the ejb business implementation live under the directory "ejb/", we can generate the interfaces for the business implementations with the following apt call:
apt -cp e:/temp/apt-jelly-core-2.0.1.jar;e:/temp/apt-jelly-freemarker-2.0.1.jar;
e:/temp/freemarker-2.3.8.jar;e:/temp/ejb3-annotations-1.0-SNAPSHOT.jar -s target/gen -factory net.sf.jelly.apt.freemarker.FreemarkerProcessorFactory -Atemplate=BusinessInterface.fmt ejb/*.java

This will generate the business interfaces in the specified target directory (target/gen).
So let's have a look at some sample Java code using the above developed annotations. Assuming the following business class implementation:
package ejb;

import java.util.HashMap;

@BusinessInterface(remote = "ejb.InterfaceTestRemote",
remoteExtends = "ejb.InterfaceBase",
local = "ejb.InterfaceTestLocal")
public class InterfaceTestImplementation {
@InterfaceMethod
public void testDummy() throws Exception {

}

@InterfaceMethod
public String testDummy2(String dummyString) throws IllegalStateException, IllegalArgumentException {
return "";
}

@InterfaceMethod(viewTypeLocal = false)
public String testDummy3(String dummy2String, HashMap map) {
return "";
}

@InterfaceMethod(viewTypeLocal = false, viewTypeRemote = true)
public void testDummy4() {

}

@InterfaceMethod(viewTypeLocal = true, viewTypeRemote = true)
public void testDummy5() {
}

@InterfaceMethod(viewTypeLocal = false, viewTypeRemote = false)
public void testDummy6() {
}

public void testDummy7() {
}

@InterfaceMethod
public void testDummy8() {
}
}

We declare some of the methods as interface methods, some of it should appear in the remote and some of it should appear in the local interface. There are also methods which should not become a member of the generated interfaces (testDummy6 and testDummy7).
Running apt with the above mentioned command would generate the following two Java business interfaces:
InterfaceTestRemote.java
package ejb;

@Remote
public interface InterfaceTestRemote extends ejb.InterfaceBase {
void testDummy() throws java.lang.Exception;
java.lang.String testDummy2(java.lang.String dummyString) throws java.lang.IllegalStateException, java.lang.IllegalArgumentException;
java.lang.String testDummy3(java.lang.String dummy2String, java.util.HashMap map);
void testDummy4();
void testDummy5();
void testDummy8();
}

InterfaceTestLocal.java
package ejb;

@Local
public interface InterfaceTestLocal {
void testDummy() throws java.lang.Exception;
java.lang.String testDummy2(java.lang.String dummyString) throws java.lang.IllegalStateException, java.lang.IllegalArgumentException;
void testDummy5();
void testDummy8();
}

The generated remote interface extends an already existing base interface called ejb.InterfaceBase. In a next trail I will explain how to generate those base interface as well (as proposed in the book "Enterprise Java Beans") and how to use macros (some sort of methods) in a Freemarker template.
APT-Jelly really seems to simplify a lot!

Sunday, September 10, 2006

Refactorings with C# part II


Well, as Arvid pointed out in his comment about my first (very frustrating) experiences with refactorings in .NET IDEs (especially Visual Studio), there is a tool called ReSharper by JetBrains. This brings nearly most of the power of Intellij IDEA's refactoring methods to Visual Studio .NET. In fact, I can't really live without it anymore.
There is another tool which competes with ReSharper called CodeRush. It may be as powerful as ReSharper but I don't have the time to evaluate it. If you are interested in a comparison you should read this blog entry and this one.

Thursday, August 24, 2006

Frustrating refactoring options in .NET IDEs


I am currently in process of learning C#. I will not discuss here the pros and cons of C# compared to Java. I am mostly a Java programmer but it's always good to see what else is going on in the programming world ;-)
Well, after learning the core language features (keywords, differences to Java, etc...) I started my first C# program. And yes, it was this little HelloWorld example ...
Nothing really fancy and pretty straight forward. What really catches my eye was the complete abscence of any refactoring support in Visual Studio .Net
Digging a little bit further I discovered an IDE called ShardDevelop which claims to have refactoring support. The only refactoring operation it does provide is "Renaming" a class, method or variable.
There is another IDE called MonoDevelop which was started by the Mono Project. AFAIK it only runs under Linux and Mac OS X and I haven't found any documentation about refactoring support.
Almost desperate I tried MS Visual Studio 2005 and et voila, this IDE does provide at least more than one refactor command. Here is a list of available refactoring options:
  • Extract Method
  • Encapsulate Field
  • Extract Interface
  • Reorder Parameters
  • Remove Parameters
  • Rename
  • Promote local Variable to Parameter

Of course this is nothing compared to the rich refactoring support of IDEs like Intellij IDEA or Eclipse, but it is a starting point.
Now I have to find out, what the heck is the difference between Visual Studio .NET and Visual Studio 2005...
Ah, I found the solution: Visual Studio 2005 is the successor of Visual Studio .NET.

Saturday, August 05, 2006

Two tomcats in my rooms ...

I am now the proud owner of two male cats with the names of "Kalle" (short for Karlsson, the blue-grey one) and "Adonis" (the white one). Kalle is 2 years old (Birthday 2004-06-04) and Adonis is 18 weeks (Birthday 2006-03-16) .
Kalle is a little bit shy and the complete opposite of Adonis, who is curious and aggressive. Very nice combination though.

Sunday, July 30, 2006

Cyclassics 2006 in Hamburg

Today I made one of my greatest performances in cycling ever.
I won the 100 km VIP Race of the Hamburg Cyclassics. Unfortunately I didn't get a ticket for the "normal" 100 km race so I had to start in the VIP race.
My finishing time was 2h 25m 34s 62ms, that is a average speed of approx. 41,20 km/h.
Puh, I really felt exhausted after the finish.
Here is an excerpt of the result.
Platz   Name                        Zeit        Ø km/h
1       Quebbemann, Ralf (GER)      2:25:34,62  40.76
2       Speicher, Matthias (GER)    2:26:33,38  40.91
3       Toetzke, Christian (GER)    2:26:46,34  40.85
4       Neutzner, Christoph (GER)   2:26:52,78  40.84
5       Golly, Michael (GER)        2:28:04,45  40.52
6       Elsing, Ulrich (GER)        2:29:11,99  40.21
7       Sommer, Ken (GER)           2:29:21,87  40.17
8       Dr. Lennartz, Peter (GER)   2:36:23,68  38.36
9       Feyen, Jürgen (GER)         2:37:10,50  38.17
10      Bell, Markus (GER)          2:37:18,52  38,14

Tuesday, July 18, 2006

Using build numbers in Maven 2

Today I discovered a fine Maven 2 plugin which helps you getting a unique build number for each time you build your project.
It is called the Maven Build Number Plugin.
Sometimes one wants to place a unique build number into a manifest file of a jar archive, then you definitely should go an try out this plugin.

Saturday, July 15, 2006

Tires Michelin Pro2 Race

I installed a complete set of those tires on my racing bike yesterday and I am completely overwhelmed of the quality and the boost of speed with these tires. I raised my average speed about 0,6 km/h on a 40 km distance trip!
Go and check them out. Average price is about 50 - 60€ for a complete set.

Thursday, July 13, 2006

Walter Trout released new album

One of my favorite blues guitarists released a new album entitled "Full circle", featuring recording sessions with many different artists, e.g. Joe Bonamassa, Jeff Healey, Bernard Allison, Coco Montoya.
Check out Walter's website for more infos.
Moreover Walter is coming to Germany in November and December. Check out his tour dates page to get the newest infos. Maybe he is coming near to your area.


Monday, July 10, 2006

Show Review: Stevie Ray Vaughan - Rome Inn, Austin, TX, USA (1980-??-??)

This is one of my all time favorite early Stevie Ray Vaughan. So much power and emotion especially in the first 2 songs!

Friday, June 30, 2006

How to tie a Bandana

If you ever wanted to know how to tie a bandana then you have to check out this link. It's that simple.

Saturday, June 24, 2006

Garmin GPS Trainers (305 series)

The Garmin Edge 305, a GPS Trainer and cycle computer, seems to be a great choice for cyclers or triathletes. The corresponding model for runners, the Garmin Forerunner 305, can also be used for cycling.
The GPS signal is strong even under thick forests or narrow street canyons. Check out this article (sorry, only in german) to see, what the Forerunner 305 is all about.
English pages:
http://www.garmin.com/products/forerunner305/
http://www.garmin.com/products/edge305/


Thursday, June 22, 2006

Missing index.html when generating site with Maven2

For those of you who are using selected individual reports when generating the project site with Maven, there is a slight change in the behaviour of Maven since Maven Site plugin 2.0-beta-5:
You have to specify the index report if you would like to have the index.html files generated. This is necessary for those modules, who don't have a index page written in xdoc, or apt..
Make sure to update the project-info-report Plugin to version 2.0.1!
Here is a sample configuration:
 <plugin>   
 <groupId>org.apache.maven.plugins</groupId>   
 <artifactId>maven-project-info-reports-plugin</artifactId>   
  <reportSets>     
  <reportSet>      
  <reports>       
  <report>dependencies</report>       
  <report>project-team</report>        
  <report>mailing-list</report>        
  <report>cim</report>        
  <report>issue-tracking</report>        
  <report>license</report>        
  <report>scm</report>  
  <report>index</report>  
  </reports>     
  </reportSet>   
  </reportSets>  
  </plugin>  

Wednesday, June 21, 2006

Introducing groups in Maven2 Idea Plugin

I think there is a need that the Maven 2 Idea plugin supports groups of modules. A friend of mine patched the following two files of the maven-idea-plugin:
  1. IdeaMojo.java
  2. IdeaProjectMojo.java
I will try to convince him filing this issue into the Maven Jira system, so everybody can benefit from this great patch. Maybe some day this patch will be included into the next Idea plugin version.

Saturday, June 17, 2006

Maven2 and surefire plugin issues with TestNG test cases

I was facing problems executing my TestNG unit tests under Maven 2.0.4 with the maven-surefire-plugin 2.2. The tests were not started and I got the following result from the plugin:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running de.rquebbemann.jgig.util.SqlUtilsTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.047 sec
Running de.rquebbemann.jgig.entity.impl.EntityBaseImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec
Running de.rquebbemann.jgig.entity.music.impl.PerformanceImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.032 sec
Running de.rquebbemann.jgig.entity.person.artist.impl.MemberImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running de.rquebbemann.jgig.entity.music.impl.GigImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
Running de.rquebbemann.jgig.entity.music.impl.SongImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running de.rquebbemann.jgig.common.sql.DefaultSqlFormatterTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec
Running de.rquebbemann.jgig.util.ExceptionUtilsTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running de.rquebbemann.jgig.entity.music.impl.TrackImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
Running de.rquebbemann.jgig.common.sql.StatementFactoryTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
Running de.rquebbemann.jgig.util.DateUtilsTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running de.rquebbemann.jgig.entity.person.impl.PersonImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running de.rquebbemann.jgig.entity.impl.ModifiableEntityImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running de.rquebbemann.jgig.entity.person.impl.UserImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
Running de.rquebbemann.jgig.dao.customizing.HibernateCustomizingDaoTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running de.rquebbemann.jgig.test.TestUtils
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running de.rquebbemann.jgig.util.StringUtilsTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running de.rquebbemann.jgig.entity.customizing.impl.CustomizingImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running de.rquebbemann.jgig.entity.music.impl.RecordingImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
Running de.rquebbemann.jgig.entity.person.artist.impl.ArtistImplTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running de.rquebbemann.jgig.common.sql.DebuggableStatementTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec

Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

I did not specify a testng.xml file because the surefire plugin docs say it is not necessary. And exactly that is the problem! If I provide a testng.xml file my unit tests are executed! Hm, so I digged a little bit further and found
the Issue http://jira.codehaus.org/browse/MSUREFIRE-117 in Jira.



I tried the fix and it solves the problem. Now my TestNG unit tests are executed even if I do not specify a testng.xml file.
Maybe this will help others. I hope the bug will be fixed very soon (I voted for it).

Thursday, June 15, 2006

Moving towards JBoss 4.0.4.GA

I decided to upgrade my JBoss 4.0.3.SP1 to the newest version 4.0.4.GA. I am only interested in the EJB3 container so I have chosen to use the installer package to download.
The installation is quiet easy using the installer. Just simply choose the EJB3 container and everything gets installed. But the hardest part is still in front of us.
My client application fails with different exceptions communicating with the server. Argh!! Yes of course, I had to update my jboss client libraries. So here is the list of necessary libraries to update:
  • jboss-j2ee
  • jboss-ejb3x
  • jboss-ejb3
  • jboss-annotations-ejb3
  • jboss-aspect-library-jdk50
  • jbossall-client
  • jboss-aop-jdk50-client
After this I tried to deploy my application to the server, but it failed because of a missing class. I don't have the stacktrace anymore, sorry. But it stated something about a missing class with a package name like org.apache.commons.discovery, so I decided to put the commons-discovery in version 0.2 - which I had from my previous JBoss installation - and put it into the directory $jboss_home\server\default\deploy\ejb3.deployer. That was the trick. Now it's working!

Tuesday, June 13, 2006

Updating to Hibernate Core 3.2.0.cr2

After updating from Hibernate Core 3.1.2 and Hibernate Annotation 3.1beta8 to Hibernate Core 3.2.0.cr2 and Hibernate Annotations 3.2.0.cr1 I was facing two problems:
  1. Caused by: javax.persistence.PersistenceException:
    org.hibernate.cache.CacheException:
    Attempt to restart an already started EhCacheProvider.
    Use sessionFactory.close() between repeated calls to
    buildSessionFactory.
    Consider using net.sf.ehcache.hibernate.SingletonEhCacheProvider.
    Error from ehcache was: Cannot parseConfiguration
    CacheManager. Attempt to create a new instance of
    CacheManager using the diskStorePath "/tmp" which
    is already used by an existing CacheManager.

    Solution:

    Setting the hibernate property:

    hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider


    Setting the property to net.sf.ehcache.hibernate.SingletonEhCacheProvider may work as well,
    but I haven't test yet.
  2. org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class:...

    I had a property annotated with @OneToMany targeting an @Embedabble @MappedSuperclass.

    I found the solution in the Hibernate Forum:

    http://forum.hibernate.org/viewtopic.php?t=959542&highlight=onetomany+
    manytomany+targeting+unmapped+class

    To summarize:

    You should use @CollectionOfElements instead of @*ToMany, if your association is not pointing to an entity.

Wednesday, June 07, 2006

Problem with USB WLAN Adapter Netgear WG111t solved

This USB adapter was causing problems on my nearly fresh installed Windows XP SP2 Professional system. I am using the "Fritz Box WLAN7050" as Access Point.
After I had installed the latest drivers (Version 5.0.2102) the adapter disconnects itself after a short time (5-25 minutes). I was using the Netgear configuration utility to setup my WLAN connection.
After digging the internet for similar problems (I found a few hits) I decided to go back to my previous driver (originally supplied with the adapter) and deactivated the netgear WLAN configuration utility. I now use the Windows WLAN network configuration and it works perfectly.

Monday, June 05, 2006

Serendipity Installation Problem solved (MySQL Database Setup)

I was trying to install Serendipity 1.0-beta3 and was facing problems with my MySQL database setup. The installer complained about a missing database module.
On my Debian system the debian package of the PHP Mysql module "php4-mysql" was installed into the directory
/usr/lib/php4/20050606
My "php.ini" file had the "extension_dir" set to "./"
So the Mysql module could not be found.
Solution:
  1. I created a new directory /usr/local/share/php/extensions and switched into it.
  2. I linked the mysql.so to the original location using the command:
    1. ln -s /usr/lib/php4/20050606/mysql.so mysql.so
  3. I set the "extension_dir" variable in the file "php.ini" to "/usr/local/share/php/extensions"
  4. Restart of my Apache2 webserver.
Yep, it's working now

Yipeee, I started my Blog

Today, June 5th 2006
I started my blog hosted on my server located in my rooms
I had a few difficulties setting up Serendipity as described in another blog entry.