Author Archives: Peter

[Updated] Using JUnits-@Rule for injecting EntityManagers during testing

Hi! Today I would like to show you, how to use a JUnit-Rule for setting up and injecting a EntityManager during testing. First we need at least JUnit version 4.10 and JEE6. I will use EclipseLink as a persistence provider, but you can choose whatever your preferred persistence provider is. The next step, after creating […]

 

0
Kudos
Don't
move!

Read more

Shell command to kill dead quick-search bar in chrome

I, unfortunately, facing the problem, that the quick-search / history bar in chrome hangs up randomly when using a NFS-mounted home directory. I figured out, that the process which dies, is the last chrome/chromium process which [code language=”bash”] ps ax | grep chrom [/code] displays. So I wrote this little pipe to kill the died […]

 

0
Kudos
Don't
move!

Read more

@Resource.lookup – How to solve classpath problems when compiling or testing with gradle

I’ve started this week with Gradle and tried to convert one project from maven to Gradle. Besides of some, I think beginner mistakes, I faced with the following problem. With JEE6 the @Resource annotation was extented with the “lookup” attribute. This attribute links to any resource which uses a global JNDI name. Something like this: […]

 

1
Kudos
Don't
move!

Read more

Maven Quick-Tip: How to remove version number from created archive

Today I faced the “problem” that I need to remove the version number from the archive maven generates when building. The solution is as simple as it could be: Add to your pom.xml the configuration section of your build plugin the following [code language=”xml”] <typeName> ${project.artifactId} </typeName> [/code] In my case this looks like [code […]

 

0
Kudos
Don't
move!

Read more

Using hot-deploy with Netbeans and Glassfish

One of the nice features, when you were using Netbeans 7.x and Glassfish 3.x, is the hot-deploy feature. This means, when you change a class or web-page, after saving the file is compiled (if required) and directly deployed to the deploy-location of your project. This can save a lot of time, because you had not […]

 

5
Kudos
Don't
move!

Read more

CDI: SessionScoped-Bean must be passivation capable

Due to some questions about Session/ConversationScoped managed beans in CDI I answered during the last days I decided to wrote a little post about it. Another reason was that there seems to be no information about that issue (except of the origin specification 😉 ). Nearly every single question was around the error message “WELD-000072” […]

 

8
Kudos
Don't
move!

Read more

Tutorial: JUnit-Rule

Hi, as announced, here is the short tutorial for writing your own JUnit-Rule. JUnit provides with the @Rule and @ClassRule annotations a powerful way to reduce the boilerplate code for setting up structures / assumptions. It also removes, in the most cases, the requirement of using inheritance and replaces it with composition. Short overview A […]

 

2
Kudos
Don't
move!

Read more