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:
- 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.
- 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:
com.ibm.ws.security.role.RoleBasedAuthorizerImpl.checkAccess(RoleBasedAuthorizerImpl.java(Compiled Code)) at com.ibm.ws.management.AdminServiceImpl.preInvoke(AdminServiceImpl.java:1696) at com.ibm.ws.management.AdminServiceImpl.preInvoke(AdminServiceImpl.java:1603) at com.ibm.ws.management.AdminServiceImpl.preInvoke(AdminServiceImpl.java:1533) at com.ibm.ws.management.AdminServiceImpl.preInvoke(AdminServiceImpl.java:1506) at com.ibm.ws.management.AdminServiceImpl.getAttribute(AdminServiceImpl.java:501) at com.ibm.ws.management.connector.AdminServiceDelegator.getAttribute(AdminServiceDelegator.java:99) at com.ibm.ws.management.connector.rmi.RMIConnectorService.getAttribute(RMIConnectorService.java:123) at com.ibm.ws.management.connector.rmi._RMIConnectorService_Tie.getAttribute(_RMIConnectorService_Tie.java:193) at com.ibm.ws.management.connector.rmi._RMIConnectorService_Tie._invoke(_RMIConnectorService_Tie.java:87) at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:608) at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:461) at com.ibm.rmi.iiop.ORB.process(ORB.java:432) at com.ibm.CORBA.iiop.ORB.process(ORB.java:1728) at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2229) at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:65) at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:95) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code)) .
Posted in eclipse, WebSphere | Tagged: development, IDE, javaEE, security, WebSphere | Leave a Comment »
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
- 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
- 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.
- 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.
- 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.
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, Java | Tagged: eclipse, java, performance, profiling | Leave a Comment »
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/DB2 | Tagged: db2 | Leave a Comment »