Injecting better logging into a binary .class using Javassist

Have you ever been strucked by a completely useless exception message somewhere from the depth of a 3rd party application or library you had to use in your code? Have you ever wanted the bloody nameless programmer to have written a truly informative and helpful error message so that you wouldn't need to spend hours trying to figure out what was the problem that would have been easily discovered if only more context information available at the moment when the exception occured was included in its error message? Have you wondered how only you could inject the necessary logging into the spot? Read on to get the answer.

Continue reading →

Add method tracing (params, result) to existing application w/o modifying it

Have you ever needed to learn what's going on in a 3rd-party java application and yet didn't want to debug it and step through it? Were you wishing to be able to see what methods get called in what order together with their actual parameters and return values? There is a "simple" solution: AspectWerkz.

Quick start:


Continue reading →

The Ultimate Web UI Framework

Recently I have found myself in the need of a framework for creating rich, responsive and highly interactive web-based user interfaces that would ideally be easy to use and fast to learn. I was basically only interested in the view part of the presentation tier, that's the UI running in user's browser and interacting with him/her. I had no preferences regarding the 'M' and 'C' of MVC, in other words the server-side of the presentation-tier.

Continue reading →

Introducing Facelets

You might have already heard about Facelets (docs), a library for Java Server Faces (JSF), and wondered why it is popular and what it is good for. I've wondered too and now I want to share the answers with you.

Warning: I'm a novice to Facelets and some things may be not completely exact. 


Continue reading →

Truncating UTF String to the given number of bytes while preserving its validity [for DB insert]

Often you need to insert a String from Java into a database column with a fixed length specified in bytes. Using
string.substring(0, DB_FIELD_LENGTH);

Continue reading →

VMWare: Shrink image even though it’s a snapshot

I needed to shrink a vmware image to save space but it wasn't possible because it wasn't an independent disk but a snapshot (rhel3_ws_u4-000001.vmdk etc.) dependant upon the original disk (rhel3_ws_u4-s001.vmdk etc). The steps were:

Continue reading →

Dependency Finder 1.2.0 for Java

Dependency Finder for java can help you to find your way in unknown class files/library.

Usage:


Continue reading →

Troubleshooting Class/Resource Loading on an Application Server

If you need to find out where is a certain class loaded from or where a class has loaded a resource (typically a configuration file) from, you can use the JSP below - just put it to your web app and point a browser to it.



Continue reading →

WAS 6.0 ant tasks: Install an app with an external Ant

There are special ant taks to install/start/.. an application to a WebSphere App Server 6.0. It's easy to run them with WAS's ant script (<was>/bin/was_ant.bat) but not so trivial to get them working with an external ant, which may be necessary because WAS has an old version of ant. So lets see how to do it.



Continue reading →

RAD, WAS 6 Test Env and J2EE security: getting rid of “No received or invocation credential exist on the thread”

Recently I started a new J2EE project that required j2ee security. Unfortunately Rational app. Developer 6 seemed to have some problems running a WAS Test Environment in this way, at least with the default setup. I encountered 2 problems:

Continue reading →

RAD: Profiling a portlet

Recently I needed to profile a portlet to find its time performance bottlenecks. Since I developed it in RAD using its WebSphere 5.1 Test Environment, I thought I'd run the server in the Profiling mode and would get the results. The profiler worked very hard, but at the end no results were displayed.  I tried to profile a simple (non server) Java app. - again it seemed to do something but no results vere displayed. But finally I've found how to get the data using hprof:

Continue reading →

Kill a zombie database (not in the directory but can’t create it)

I tried to create a database but couldn't because of "SQL1005N  The database alias "W3IBMDB" already exists in either the local database directory or system database directory.
Continue reading →

RAD: Server Configurations in Rational Developer 6.0: copy, repair...

This article describes some tricks you can do with RAD's server configurations (mostly for WebSpehere App.Server/Portal Server).

Continue reading →

DB2: Find out current locks, long transactions etc. [snapshot]

To find out current locks in a DB and other information about its current state, you need to take a "snapshot":

Continue reading →

Ant/Maven: Add build date/revision to the generated JAR's Manifest

I'll explain how to get build time info and svn revision into the buildedjar/ear in Maven or Ant.

Continue reading →

Copyright © 2024 Jakub Holý
Powered by Cryogen
Theme by KingMob