Server-managed datasources with Tomcat and WTP

If you need to configure a server-managed datasource for testing your webapp, and you happen to be using Eclipse WTP, this is what you need to do.

  1. Have your server definitions on the workspace.
  2. Deploy your app to the server.
  3. Open server.xml and find the application’s <Context>
  4. Nest your datasource definition inside the <Context>

If you need any other kind of <Resource> configured in your tomcat, you can proceed in the same way.

Buying books

I’ve just received my books from Amazon. Given the discount they make and the current exchange rate between dollars and euros, I find it more comfortable and cheaper (even including the shipment fees) to buy them online. There is also a very good bookstore in Madrid which usually has the books I’m looking for, but they are more expensive, so I rarely buy there unless I want the book “now”.

My new books, with the mac.

My new books!

I already own a copy of the previous editions of Spring in Action and Hibernate in Action (er… Java Persistence with Hibernate) so I’ll probably just keep them near for reference (although the chapters on JPA and WebFlow look promising).

Then there is Design Patterns… my all-time favorite book since I used it during my faculty years. It’s not only the excellent content. The book itself is elegantly designed and it is just nice to browse. I always wanted a copy of this book and now I have it.

I also bought a couple of books about J2EE architecture: The study guide for the sun certification exam and the Architect’s Handbook.

After going through the self-evaluation questions, I find sun’s certification quite easy to pass after more than four years trolling with Java and other technologies. But I think it would have been easy even without so much experience, because almost all of the subjects where covered during my last year at the Computer Science Faculty in the University of A Coruña (thanks to my teacher Fernando Bellas, who also mentored my final year dissertation… we even published a couple of papers, one of them on the ACM Proceedings of the Thirteenth International World Wide Web Conference 2004).

By the way… someone at FIC should explain the students the huge difference it makes studying there compared to other faculties. I’ve recently taught an introduction to J2EE development for web applications (nothing fancy, only the basics on html/css/javascript, JSP/JSTL/Struts and JDBC) for people who have just graduated on Computer Science, and I was surprised by the little background students have on these technologies or anything related (like .NET).

But I digress… back to the books.

The last one, J2EE Architect’s Handbook looks promising. It begins with an explanation of the different roles in software development which spans several pages. This is great because with my background working on a small startup (where roles are fuzzy in the best case) and now in a consulting firm where your role is mostly a function of what your salary is, and not of what you do, I have all those roles a bit mixed up. The author is also quite pragmatic, explaining both the Rational Unified Process and Agile Development… and making a choice somewhere in between.

That’s what I’ve got after quickly browsing the first chapter, but I’ll write back once I finish the book.

By the way, if you’re interesting on those books… here is a link to my library.

Eclipse 3.3 (Europa) for J2EE developers

The new release of Eclipse has been out for a couple of days. The changes included in the release look great!

However, the default install comes with an error in the configuration which will prevent the installation of new plug-ins through the update manager.

The message I’m seeing is:

Java Persistence API Tools (1.0.0.v200706250000-77–CYQCCz-CoRPCCCH) requires feature “org.eclipse.datatools.enablement.feature”.

To fix that, go to the update manager and grab from the Europa Discovery Site the features:

  • Database Development / Data Tools Platform Documentation
  • Database Development / Data Tools Platform Enablement

I’m clueless about why the documentation is needed to resolve this issue but…

Once these features are checked, the error message will disappear and you will be free to install whichever plugins you’d like.

I’m a bit surprised by the small number of results I’ve got when googling for the error message: two! Credit for the solution goes to Bradley Wagner and the great folks at Nabble.

Posted in eclipse, j2ee. Tags: . 4 Comments »

Transparent database encryption

Jasypt logoA co-worker and friend of mine recently released a new open-source project. It is called Jasypt (Java Simplified Encryption).

It is focused on simplying the most usual cryptographic tasks (like encryption and hashing) with a plus: it is designed with easy integration in mind.

If using Hibernate, you can declaratively configure encryption for your persistent entities, and it is also easy to manage through spring.

For more information, read the announcement on The Server Side or check the project site.

Don’t chat while coding J2EE, Microsoft says

Well, that was just in figurated sense…

Te real fact is that MSN Messenger likes to use port 1098 (for UDP), which are also used by the default JBoss Naming service. According to some other people, that port can also be used by Outlook or even Firefox (although I use Firefox everyday and it never gave me any problems).

I should mention that this is no one’s fault, as the ports above 1024 are free for all, so the first who claims it, gets it. This does not happen for ports below 1024, as these are standarized or reserved (and usually only a process with administrator rights can listen on them).

So, if you see errors while starting JBoss or just can’t locate your EJBs… check if you need to shut down your messenger. Once JBoss is running, you can start Messenger again. In the cases I know, it didn’t try to get over port 1098 again, so you can safely redeploy/restart/whatever your JBoss.

Another option is to reconfigure your server (change the port for the Naming Service), but I didn’t need that. Check the JBoss Forums for information on doing that.

Posted in j2ee. No Comments »