Tuesday, January 17, 2012

Permission error while starting Rational Application Developer (RAD) on Windows 7

Below error is shown in the logs while starting Rational Application Developer 7.5x on a Windows 7 machine. If you are starting RAD through a shortcut, right click and select "Run As Administrator" - this will resolve the issue.

ADMU0116I: Tool information is being logged in file D:\Apps\IBM\WCD7\WCDE_E~1\wasprofile\logs\server1\startServer.log java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:599) at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:260) Caused by: com.ibm.websphere.management.exception.AdminException: ADMU7707E: Failed while trying to determine the Windows Service name for server: server1; probable error executing WASService.exe: com.ibm.websphere.management.exception.AdminException: ADMU7709E: Unexpected exception while processing server: server1; exception = java.io.IOException: Cannot run program "D:\Apps\IBM\RAD7\SDP\runtimes\base_v7\bin\WASService.exe": CreateProcess error=740, The requested operation requires elevation. at com.ibm.ws.management.tools.WindowsService.getWindowsServiceNameForServer(WindowsService.java:221) at com.ibm.ws.management.tools.WindowsService.(WindowsService.java:154) at com.ibm.ws.management.tools.WindowsService.getWindowsServiceInstance(WindowsService.java:139) at com.ibm.ws.management.tools.WsServerController.getWindowsServiceIfAvailable(WsServerController.java:161) at com.ibm.ws.management.tools.WsServerLauncher.getWindowsServiceIfAvailable(WsServerLauncher.java:157) at com.ibm.ws.management.tools.WsServerController.executeUtilityOnWindows(WsServerController.java:129) at com.ibm.ws.management.tools.WsServerLauncher.main(WsServerLauncher.java:138) ... 5 more

Friday, November 18, 2011

Installing MySQL on Ubuntu without apt-get

If you are trying to install MySQL on a box that does not have internet connection, installation will be challenging.

This post explains how MySQL can be installed and configured by downloading individual .deb files.

1. Identify your Ubuntu distribution name/version and architecture 

For checking your Ubuntu distribution name,
root@localhost:$ cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.04
DISTRIB_CODENAME=lucid
DISTRIB_DESCRIPTION="Ubuntu 10.04.3 LTS"

For checking the architecture,use "uname -m" or arch command
root@localhost:/etc/mysql$ uname -m
x86_64

2. Download below packages from packages.ubuntu.com (links below correspond to amd64 architecture and lucid distribution, you will have to change this according to your configuration)

http://packages.ubuntu.com/lucid/all/libnet-daemon-perl/download
http://packages.ubuntu.com/lucid/all/libplrpc-perl/download
http://packages.ubuntu.com/lucid/amd64/libdbi-perl/download
http://packages.ubuntu.com/lucid/amd64/mysql-common/download
http://packages.ubuntu.com/lucid/amd64/libmysqlclient16/download
http://packages.ubuntu.com/lucid/amd64/libdbd-mysql-perl/download
http://packages.ubuntu.com/lucid-updates/amd64/mysql-client-core-5.1/download
http://packages.ubuntu.com/lucid-updates/amd64/mysql-client-5.1/download
http://packages.ubuntu.com/lucid-updates/amd64/mysql-server-core-5.1/download
http://packages.ubuntu.com/lucid-updates/amd64/mysql-server-5.1/download
http://packages.ubuntu.com/lucid/all/libhtml-template-perl/download
http://packages.ubuntu.com/lucid-updates/all/mysql-server/download


3. Install downloaded packages in the same order

sudo dpkg -i libnet-daemon-perl_0.43-1_all.deb
sudo dpkg -i libplrpc-perl_0.2020-2_all.deb
sudo dpkg -i libdbi-perl_1.609-1build1_amd64.deb
sudo dpkg -i mysql-common_5.1.41-3ubuntu12.10_all.deb
sudo dpkg -i libmysqlclient16_5.1.41-3ubuntu12.10_amd64.deb
sudo dpkg -i libdbd-mysql-perl_4.012-1ubuntu1_amd64.deb
sudo dpkg -i mysql-client-core-5.1_5.1.41-3ubuntu12.10_amd64.deb
sudo dpkg -i mysql-client-5.1_5.1.41-3ubuntu12.10_amd64.deb
sudo dpkg -i mysql-server-core-5.1_5.1.41-3ubuntu12.10_amd64.deb
sudo dpkg -i mysql-server_5.1.41-3ubuntu12.10_all.deb
sudo dpkg -i libhtml-template-perl_2.9-1_all.deb
sudo dpkg -i mysql-server-5.1_5.1.41-3ubuntu12.10_amd64.deb

During mysql-server-5.1 installation, you will be asked to provide the root user name and password. Make sure you remember what you provide here, without the root id and password you will not be able to connect to MySQL server.

To check whether MySQL is installed correctly, run the command
sudo netstat -tap | grep mysql

Reference 1:- http://askubuntu.com/questions/29533/install-mysql-without-apt-get

Thursday, November 17, 2011

Syntax highlighting on blogger

I always wanted a 'wiki' like functionality on blogger so that my technical posts are more readable (Highlighting commands, posting source code with line numbers etc..)

Some good options are :-

1. Using JEdit and Code2Html plugin - http://thinktibits.blogspot.com/2011/04/best-syntax-highlighter-for-bloggerpart.html

2. Alex Gorbatchev's Syntax Highlighter - http://alexgorbatchev.com/SyntaxHighlighter. Here is an example of how it is used on blogger - http://abhisanoujam.blogspot.com/2008/12/blogger-syntax-highlighting.html

3. Using google code prettify - http://code.google.com/p/google-code-prettify/. See the README file for implementation details. Here is a sample blog that uses google code preffify - http://blog.js-development.com/2008/01/finally-syntax-highlighting-on-my-blog.html

If you just need a simple highlighting mechanism, try editing the design template as explained below.

1. Open the template html (Template -> Edit HTML)



2. Look out for </b:skin> and add below piece of code as shown :-

code {background:whitesmoke; font-family: Arial; display:block; border:1px solid #999999; padding:10px;}

]]></b:skin>


3. Enclose the text that you want to highlight in <code></code> block

<code>
Your text here...
</code>


Sunday, November 13, 2011

Rpm installation - where can I find the installed files?


I recently installed ganglia to monitor the performance of my hadoop cluster running on fedora 14. Ganglia installation mainly consists of gmetad, gmond and the php web front end (ganglia-web). I installed these packages using the software update manager that comes with Fedora 14. After the installation was completed, I was trying to copy the gangila web files to my apache web root (/var/www/html) and I just could not locate the php web front end files!!

After a bit of googling I found out the command that I was searching for - rpm -ql <package name>

rpm -ql ganglia-web

SQL1092N "USER" does not have the authority to perform the requested command

The error "SQL1092N <USER> does not have the authority to perform the requested command" usually comes when a domain user tries to perform a database operation that requires administrative privileges.

To resolve this, perform below steps (Windows OS):-

1. Execute "db2set DB2_GRP_LOOKUP=LOCAL" from db2 command editor
2. Create a new group called DB2ADMNS (Right click My Computer -> Manage -> Computer Management ->  System Tools -> Local Users and Groups -> Groups
3. Add the domain user to the DB2ADMNS group
4. Execute "db2 update dbm cfg using sysadm_group DB2ADMNS" from db2 command editor
5. Execute "db2stop"
6. Execute "db2start"

Tuesday, November 01, 2011

WebSphere Commerce 7 feature packs - troubleshooting

I was getting below error while trying to install feature pack 1 for Websphere Commerce 7 developer edition (I selected "Enable all features" option in IBM installation manager at the final step of feature pack installation) There are two ways to resolve this :-
  1.  Try enabling the features one by one. Refer http://publib.boulder.ibm.com/infocenter/wchelp/v7r0m0/topic/com.ibm.commerce.install.doc/tasks/tigfepenable.htm

  2.  Try increasing the maximum heap size in enablefeature.bat 
  3.  
%RAD_HOME%\jdk\bin\java -cp "%CP%" -Xmx1536m -DLOGFILE=%LOG% org.eclipse.equinox.launcher.Main -application com.ibm.etools.j2ee.ant.RunAnt -logger com.ibm.commerce.config.internal.ant.loggers.FileLogger -data %WORKSPACE_DIR% -DWCInstallDir=%WCTOOLKIT% -DRADHome=%RAD_HOME% -Dworkspace=%WORKSPACE_DIR% -Dwashome=%WAS_HOME% -Dejbdir=%EJB_DIR% -buildfile %WCTOOLKIT%\components\common\xml\enableFeatureForToolkit.xml %*

Tuesday, May 29, 2007

Learning Struts 2 - Zero Configuration

Zero Configuration is a new feature introduced in Struts 2.

If you enable this,
  • No entry is required in struts.xml for defining new actions. Just write your action classes and they will be automatically mapped!!!!
  • Results (views) can be defined using annotations, no need to put entries in struts.xml
Mapping action classes

Modify web.xml and add the package names where your action classes can be located using actionPackages

<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
<init-param>
<param-name>actionPackages</param-name>
<param-value>com.mycompany.learning.struts2</param-value>
</init-param>

</filter>




Adding the above init-param will ensure that all actions classes in the package com.mycompany.learning.struts2 will be automatically mapped to the default URLs.

Mapping results views
Result views for an action should be specified using @Result & @Results annotations

For eg; Add the below annotation to your action class if you want to redirect to HelloWorld.jsp


@Result (name="success", value="/HelloWorld.jsp")
public class HelloWorldAction {
...code here...
}


Trouble-Shooting

1. How do I ensure my action class is automatically mapped?

You need to ensure the following:-
  • Check whether you package name is passed as to the FilterDispatcher in web.xml. If your action class is in x.y.z package, giving x.y is not sufficient for the automatic mapping to happen.
  • Your class should extend com.opensymphony.xwork2.ActionSupport or should end with the name Action

2. What will be the URL for my automatically mapped action classes?

If your action class name ends with Action, "Action" will be trimmed from the class name. And the remaining string will be formatted using java bean naming conventions.

Examples: (self-explanatory)
  • HelloAction.java - hello.action
  • HelloWorld.java - helloWorld.action
  • HelloWorldAction.java - helloWorld.action
  • HelloActionWorld.java - helloActionWorld.action

Wednesday, May 31, 2006

Struts Tips - Multi select list box "deselect all" problem

Problem
De-selecting all items from the multi select list box does not update the action form. Action form will still have the values pertaining to the previous selection.

Cause
When no items are selected from the list box, no data is sent for the parameter.

Solution
Add the below check in the action class:-

if (request.getParamter("list box name") == null) {
form.set(new String[]{});
}


This will clear the values of the earlier selection from the list box property

Saturday, April 01, 2006

JMS

Though I have used MQ Series in all the projects I have worked so far, i never got a chance to write a messaging program from scratch. Opportunity came when my ex-project mate requested me to take a training on JMS for his team members.

I started searching google for sample code that might help me write a simple "put" , "get" program, finally got one from Sun itself.

Assumptions
You are expected to have some basic understanding of messaging concepts.

H/W and S/W
This uses IBM MQ Series and the middleware, and tomcat servlet container.

What the program does




As shown above, this sample application has a text box where user can type something and on clicking "put" button, message will be send to a queue.

Clicking on "get" button will retrieve the first message in the queue and the message will be shown in the text box.

Logic for putting the message into queue