The Holy Java

Building the right thing, building it right, fast

Archive for November, 2006

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

Posted by Jakub Holý on November 24, 2006

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:

  1. 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 doesn§t support authetification.
  2. After that, everything seemed to be ok, but an error was logged every few seconds with the cause “No received or invocation credential exist on the thread“. The stack trace pointed to a MBean (a part of JMX) being contacted via RMI.
    Work-around: Disable an RMIConnector for JMX in WAS Console: log in, go to
    Application servers > server1 > Administration  > Administration Services > JMX connectors
    And delete the RMIConnector – make first sure that you don’t need it.

BTW, to enable the security, I enabled it first on the server via WAS admin console and then I created a new server configuration in RAD and set it to use security.

Stack trace for issue 2: Code)) at at at at at at at at at at at at at at at at at$ Code)) . 


Posted in eclipse, WebSphere | Tagged: , , , , | Comments Off on RAD, WAS 6 Test Env and J2EE security: getting rid of “No received or invocation credential exist on the thread”

RAD: Profiling a portlet

Posted by Jakub Holý on November 14, 2006

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 portlet performance with hprof
  1. Create a normal Java app. that will call the portlet’s code or a JUnit (or e.g. MockObjectTestCase, if you need  JNDI and the like set up) test
  2. Write a main method of the app. and call there the portlet code. If it’s a test case, don’t forget to call setUp before and tearDown after that.
  3. At the end of main call System.exit(0) – otherwise it may happen that the thread will not actually finish and thus the output won’t be completely generated (usually there will only be a header and names of threads that have started). Killing it via the red square button stops the threads but doesn’t generate the output.
  4. Run the app./test case as a “Java Application” using a Sun JRE 1.4 (IBM JRE would fail) and passing the VM the option “-Xrunhprof:cpu=samples,thread=y,file=cpu_profiling.hprof,depth=32

The important points: Call System.exit at the end and use Sun’s JRE 1.4.

Analyzing the output of hprof

The best is to find a tool that analyzis the output of hprof. If you want to do it yourself, look first at the end of the file – there is a list of the most time consuming methods, each with a trace number. Find a stack trace of the method in the previous part of the file using that number. Note that the stack traces are not ordered w.r.t. the trace number.

Additional notes

I’ve also tried Eclipse 3.2 and its profiling tool (TPTP). For a simple java application it displayed no output untill I changed the default options, setting polling frequency to 1sec (default: auto). I had also some problems trying to run it with JRE 5.0 but 1.4 was ok. So perhaps the RAD’s profiling would display soem results if set correctly.

Posted in eclipse, Languages | Tagged: , , , | Comments Off on RAD: Profiling a portlet

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

Posted by Jakub Holý on November 2, 2006

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 the old databases if you don’t remove them in the correct way (whatever that is). The steps to fix this were:

  • catalog db w3ibmdb
  • check “list database directory” to verify that it is listed now
  • drop database W3IBMDB
  • create database W3IBMDB                                      — Voila – no more error messages

Posted in Databases | Tagged: | Comments Off on Kill a zombie database (not in the directory but can’t create it)