Holy on Dev
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.
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); isn't enough because it only cuts down the number of characters but in UTF-8 a single character may be represented by 1-4 bytes. But you cannot just turn the string into an array of bytes and use its first DB_FIELD_LENGTH elements because you could end up with an invalid UTF-8 character at the end (one that is represented by 2+ bytes
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:
Dependency Finder 1.2.0 for Java
Dependency Finder for java can help you to find your way in unknown class files/library.
- Import the class files - File > Extract; wait... Note: you may need to increase the JVM's memory.
- Store the extracted information about the imported classes - File > Save
- Select the programming elements to examine by selecting the proper checkboxes - by default it's set to packages, you may rather want classes or packages+classes.
- Display a dependency 'graph' - File > Dependency. The symbol --> means uses, <-- means is used by.
- You may want to limit the elements for which to show dependencies (the box Select programming elements) or their dependencies to show (the box Show dependencies (stop for closure)). The expressions use Perl regular expressions (RegExp): you specify 1 or more RegExp enclosed by '/' and '/' and separated by a comma. Example: classes containiny MyClass and (presumabely) packages starting with com.ibm: /MyClass/,/^com.ibm/
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.
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.
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: RAD wasn't able to connect to the server at all, throwing some security exceptions. The solution (or rather work-around) was to switch the "Server connection type.." in the server's configuration in RAD from RMI to SOAP. It seems that RMI d
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: Analyzing
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.". I knew I had once such a database, but I thought it existed no more. And indeed "list database directory" didn't list it. So it was there and it wasn't there.It seems that DB2 remembers
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). 1. Problem: Create a new server config based on an old one. The view "Servers" only permits to create a new server configuration (R mouse - New - Server). To create it based on an existing configuration (called further "source config"):Create a new server config, name it somehow. Exit RAD.Goto <WORKSPACE>/.metadata/.plugins/c
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":db2 "attach to user using "db2 "get snapshot for applications on " > mydatabase_snapshot.txtLook into the resulting mydatabase_snapshot.txt for "Application ID holding" (if there is a lock, this will read the ID of the aplication holding the lock). To find long queries [that are currently running], look for "Executing".
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.
Sending a SOAP request to a Web Service via URLConnection
You may want to test you web service by sending it a manually composed request and reading the XML returned. Here's how to do it (e.g. using BeanShell in jEdit):
RAD, WebSphere and changing the classloader mode
I've spent hours trying to change the classloader mode for a .war include in an .ear application and deployed to the WebSphere Portal v5.1 Test Environment by means of Rational Application Developer's server configuration editor. I was able to change to for the EAR, but when I changed the mode for a WAR of the EAR from PARENT_FIRST to PARENT_LAST and saved the configuration, I was required to republish, after doing this RAD promted me to reload the configuration from the disk because it has
Eclipse: Run => NoClassDefFoundError for an interface when loading a class implementing it
I had quite a hard time trying to run the following code in Eclipse (CollectionUserType implements UserType):Class.forName("net.sf.hibernate.tap.CollectionUserType"); The problem was:Exception in thread "main" java.lang.NoClassDefFoundError: net/sf/hibernate/UserType at java.lang.ClassLoader.findBootstrapClass(Native Method) at java.lang.ClassLoader.findBootstrapClass0(ClassLoader.java:891) at java.la
- Previous (24)Next (1)