Saturday, December 25, 2010

JRockit Mission Control Console Cannot be Started

Today I had an issue that the JRockit mission control cannot be started. The problem is when trying to start mission control from windows programs, the mission control splash flashed and disappeared right away. Something is blocking the process to be started properly.

The key to this issue is to start JRockit mission control using debug command-line. From windows:

%JROCKIT_HOME%\bin\jrmc -consoleLog 2>1& | more

Here was the output I got:

Dec 25, 2010 11:07:57 PM initializeSettings
INFO: Reading console settings from C:\Documents and Settings\jzheng\.jrmc\4.0.1\rjmx.4.0.1.xml
Dec 25, 2010 11:07:58 PM diffAgainstConsoleModel
WARNING: Found discrepancy in Browser View - could not find in view. Removing it from the model...
!SESSION 2010-12-25 23:07:56.656
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments: -consoleLog

!ENTRY org.eclipse.osgi 4 0 2010-12-25 23:07:58.188
!MESSAGE An error occurred while automatically activating bundle (79).
org.osgi.framework.BundleException: Exception in of bundle
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(
-- More --
By checking the debug info, I can see that the console setting config xml file -- "C:\Documents and Settings\jzheng\.jrmc\4.0.1\rjmx.4.0.1.xml" is the trouble spot. After I deleted the file, the console was able to be started properly.

Friday, December 24, 2010

How to Enable JRockit Remote Management

To enable a JRockit JVM for remote management, the external management agent must be started.

There are two ways to start the management agent:

1. Start the JVM with the -Xmanagement command-line.

JROCKIT_HOME/bin/java -Xmanagement:ssl=false,authenticate=false,port=4711

2. use JRCMD when the JVM is already started.

use JRCMD to find the PID of the JVM (4620 for example)

JROCKIT_HOME/bin/jrcmd 4620 start_management_server ssl=false authenticate=false port=4711 autodiscovery=true

The command line will not produce any output if everything goes well.

Friday, December 10, 2010

Page Navigation using JavaScript in ADF Faces

Recently I posted a question on the Oracle ADF forum asking if there is Javascript API for page navigations in ADF faces and the simple answer is NO.

My Original Post:

I have a UI user case that has a af:menu which contains mutiple af:goMenuItem. When user click on the menu, the menu slides down and shows up the af:goMenuItem. As we know, you could define the page destinations in af:goMenuItem to go to another page when user clicked, but af:menu itself cannot be redirected to another page. Well, the user case wants the menu itself could be redirected if user click on it. 

So I am thinking using JavaScript to do this: when the af:menu gets clicked, redirect to another page. BUT, I looked over the ADF Faces Javascript API and was not able to find that piece of code to do this. Any help???

Frank's Response:

1 - you can have a hidden command item to do the navigation based on a control flow case. In this case, you access the command component from JavaScript create a new ActionEvent and queue it
2 - JavaScript can use an af:serverListener to call into a server side managed bean method to perform the navigation

there is no JavaScript API for navigation in ADF Faces because navigation in JavaServer Faces is an event driven framework and we don't support developers fighting the framework.

Steps to solve the problem:

Step 1: Create a CommandMenuItem under the af:menu component. Note goMenuItem is not working in this case because later we will use AdfActionEvent.queue method to simulate CommandMenuItem action while GoMenuItem doenn't have the action property.

Step 2: Drag and Drop af:ClientListener tag to af:menu component. Set the method as "onMenuClick" and the type is "click".

Step 3: Create a new JavaScript file and add the following codes into the file:

function onMenuClick(evt) {
    var source = evt.getSource();
    var component = source.findComponent('::pt_cmi1');
    AdfActionEvent.queue(component, component.getPartialSubmit());

pt_cmil1 is id name of the created commandMenuItem.

Step 4: Add af:resouce tag to af:document and set the source to the created javascript file and type is "javascript".