Powered by Syntax Highlighter scripts!

Configure postgreSQL to XA

Issue:
To store the message after receiving it from the Message Queue, this comes in the XA transaction scope when invoked in websphere application server. the datasource is created using the XA data source provider configured using the postgreSQL XA datasource class.
But after the prepared transaction is executed the exeption below gets thrown in logs. There is no issues when executing the Select queries.

Exception
DSRA0304E:  XAException occurred. XAException contents and details are: The cause is org.postgresql.util.PSQLException: ERROR: prepared transactions are disabled
Error code is: XAER_RMERR (-3).  Exception is: Error preparing transaction
Hint: Set max_prepared_transactions to a nonzero value.
.
Solution
After going through the postgreSQL database documentation got the solution to change the max_prepared_transactions property in the postgresql.conf file. (postgresql.conf file present in the C:\Program Files\PostgreSQL\9.1\data folder if installed in default directory on windows OS).

set the value to 100 for testing the fix. restarted the postgreSQL database by restarting the postgresql service in the windows service. (Type 'services.msc' in the Windows 'Run')

Schedule cleanup feature in Outlook

I was checking my Hotmail account using the new Outlook.com UI interface and on first look it is just awesome and refreshing! There are many features that awe you visually like the way you compose a new message, It looks wonderful with entire mail screen replaced by a new compose screen with people widget on left.

The 'Schedule cleanup' feature too is very handy for cleaning up on old shopping deal meals that got piled up from seasons! I would have searched for the sender and delete the emails, but still it is laborious as I need to see the date and then delete only mails earlier than 2 weeks etc...

Eclipse Keyboard shortcuts

We know most of the commonly used shortcuts in eclipse, yet there are many shortcuts that can be useful to increase our productivity. For example converting text from lowercase to uppercase and viceversa is not an option available in menus or context menus... the quick keyboard shortcut for converting case of selected text is
ctrl+ shift+ x -- convert selected text to UPPERCASE
ctrl+ shift+ y -- convert selected text to lowercase

This link gives an exhaustive list of keyboard shortcuts for getting things done quickly!

Image-less text-only browsing in Chrome

If you want to improve your productivity while browsing internet in office, do below for a change!

Create a new profile in Chrome,
   Now you can create a profile quickly by clicking on the left top corner of chrome window titlebar
When you are in new profile change Settings as below:
Wrench Icon -> Settings
in Settings page, click on 'Show advanced settings'
Under Privacy, click on 'Content Settings...'
In Images -- select 'Do not show Images'
    you can manage the exceptions as and when you are browsing'
In Plugins -- select 'Click to play' option and click on 'disable individual plug-ins...' link
    In the new disable individual plug-ins... tab - disable the plug-ins that you don't want to be loaded..

See how your browsing and surfing changes for the day and how you see the web in a different no-image angle! am loving it as it is less distracting, very fast and straight to the point, than a clutter of images.

Well you will end up adding the exceptions for the sites where you want to see images, But I would highly recommend this mode if you are browsing the web in office and your surfing involves browsing the forums for technical solutions in textual nature!

You can always go back to your profile and see the web in its original mode with images.

I searched for the chrome extensions for text only image less browsing that would allow me to do this, but could not find the extension that could match the behavior i got by doing this. Moreover i do not want another extension be running slowing down my system.

Issue in starting a specific eclipse workspace Juno ./metadata/.log file Job found still running after platform shutdown error


My local Eclipse workspace stopped working after I've installed some tools for WAS from eclipse workspace, I have had multiple issues and have to go through a series of resolutions to get the errors resolved... I am surprised to see that there were very few links that were actually giving a solution and there are fewer threads even reporting this error.

Issue: 
Not able to start my project workspace in eclipse, I am able to start eclipse with another workspace and even from a new workspace. But it is failing to start my project workspace.

Error in /.metadata/.log file
Job found still running after platform shutdown.  Jobs should be canceled by the plugin that scheduled them during shutdown

Configuration:
Eclipse Juno for Jee Developers
WAS 8.5 developer tools

Detailed Exceptions in logs:

java.lang.NullPointerException
at org.eclipse.ui.internal.statushandlers.StatusHandlerRegistry.<init>(StatusHandlerRegistry.java:72)
at org.eclipse.ui.internal.statushandlers.StatusHandlerRegistry.getDefault(StatusHandlerRegistry.java:91)
at org.eclipse.ui.statushandlers.StatusManager.getStatusHandler(StatusManager.java:135)
at org.eclipse.ui.statushandlers.StatusManager.handle(StatusManager.java:189)
at org.eclipse.ui.statushandlers.StatusManager.handle(StatusManager.java:231)
at org.eclipse.ui.statushandlers.StatusManager$StatusManagerLogListener.logging(StatusManager.java:305)
at org.eclipse.core.internal.runtime.RuntimeLog.logToListeners(RuntimeLog.java:160)
at org.eclipse.core.internal.runtime.PlatformLogWriter.logged(PlatformLogWriter.java:100)
at org.eclipse.equinox.log.internal.ExtendedLogReaderServiceFactory.safeLogged(ExtendedLogReaderServiceFactory.java:86)
at org.eclipse.equinox.log.internal.ExtendedLogReaderServiceFactory.logPrivileged(ExtendedLogReaderServiceFactory.java:205)
at org.eclipse.equinox.log.internal.ExtendedLogReaderServiceFactory.log(ExtendedLogReaderServiceFactory.java:178)
at org.eclipse.equinox.log.internal.ExtendedLogServiceFactory.log(ExtendedLogServiceFactory.java:65)
at org.eclipse.equinox.log.internal.ExtendedLogServiceImpl.log(ExtendedLogServiceImpl.java:87)
at org.eclipse.equinox.log.internal.LoggerImpl.log(LoggerImpl.java:54)
at org.eclipse.core.internal.runtime.Log.log(Log.java:62)

Resolution:
One of the resolution to resolve this error is to remove the workbench.xmi file as in link here: https://bugs.eclipse.org/bugs/show_bug.cgi?format=multiple&id=380608

So I have removed the workbench.xmi file from .metadata/.plugins/org.eclipse.e4.workbench/  folder in my project workspace and restarted the eclipse with -clean tag. And this resolved the issue.


Setting up the IBM WAS server on Eclipse for J2EE as an alternative to RAD IDE for Developers


After working in one of the biggest networking giant for 4+ years I had access to the IBM RAD as a pseudo right in my desktop and that provided me an oppurtunity to work with Websphere Application Serverintensively. Once I am out of that project I had to work on different non-WAS target platforms like Tomcat and liferay. One thing I did not want to loose is association with Websphere environment.

After surfing through the IBM download site, it did not take much time to notice that IBM offers no-charge distribution of Websphere Application Server for download for developers. https://www.ibm.com/developerworks/mydeveloperworks/blogs/wasdev/entry/download_was4d?lang=en

Eclipse for J2EE environment can be downloaded at http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/junor


Eclipse J2EE IDS comes by default with the Tomcat server for development. To integrate this eclipse IDE with Websphere Application Server search developor Tools in Eclipse Market Place for the correct 


Websphere application server tool as in link below:
WAS 8.5 - http://marketplace.eclipse.org/content/ibm-websphere-application-server-v85-developer-tools

PS: As it is indicated above this WAS server/ tools is a Developer install and meant to be used for development and unit testing in developer systems.

javax.naming.NameNotFoundException {jndiName} not found in context "java:" works in Tomcat but not in Websphere

We were using Tomcat application server in developer systems and have Websphere App server in Stage environment.
Our application which was working fine in Tomcat so far was giving the exception below after deploying it to the WAS server.

javax.naming.NameNotFoundException {jndiName} not found in context "java:"

The jndi Lookups were working fine in tomcat server without any issues. It seemed Websphere was expecting the JNDI names differently at first on seeing the exception. 
  • The JNDI entries are configured correctly on the WAS server
  • Our web layer include Jersey/Jackson for REST services and not using Spring or Struts for MVC layer.
  • The JNDI Lookup above is failing from an utility jar. This utility jar is also developed as a separate Java project.
  • The web application that we are deploying requires a jndi --- call it – jdbc/appjndi  and this lookup works fine.
  • The jndi lookup from the jar file for the jndi – call it jdbc/utiljarjndi -- is failing giving above exception.  
After browsing through some links and we see that the web.xml is having <resource-ref> entries for the jdbc/appjndi only.
    We added the <resource-ref> entries for the jdbc/utiljarjndi  also and this resolved the issue of JNDI lookup.

gitignore file gets created automatically and git pull does not work


naga.nookala@my_lappy /c/Naga/GitHome/my_proj (master)
$ git pull
Enter passphrase for key '/c/Users/naga.nookala/.ssh/id_rsa':
remote: Counting objects: 57, done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 34 (delta 13), reused 34 (delta 13)
Unpacking objects: 100% (34/34), done.
From github.com:my_proj_path/my_proj
   06598b7..b222fc1  master     -> origin/master
Updating 2330945..b222fc1
error: The following untracked working tree files would be overwritten by merge:
        module_01/.gitignore
        module_01/target/classes/.gitignore
Please move or remove them before you can merge.
Aborting

I was working on eclipse with git eclipse plugin. My project has multiple child modules.
I see that an .gitignore file gets created in a module that I am not currently working on.
When I run the git pull command it fails due to the .gitignore file that got created on the other module.
I tried replcing the .gitignore file from the one on gitindex, but it does not help in resolving git pull.
Then i tried removing it from with in Navigator in eclipse, it gets removed and in no time it gets created automatically.

I am not sure why it is getting created, i guess due to the eclipse git plugin.

To resolve this quickly, I closed my eclipse, deleted the .gitignore file from the windows explorer and ran git pull from git bash, This time the git pull went fine and did not gave me the error.

Installing eclipse latest version on Ubuntu manually

The eclipse version that comes with the Ubuntu is a eclipse core platform. I was not able to run the JavaEE plugins even though they were successfully installed as plugns. After some number of tries and tweaks and research on web, found this link to be very useful for installing eclipse with JavaEE.
http://colinrrobinson.com/technology/install-eclipse-ubuntu/

I liked this way mainly because it gives me a view of where the files are getting copied and what files are being touched to get this installation done :) getting hands dirty on this new ubuntu is interesting and and at the same time nice learning.

Listing the steps below for reference, almost same as the one given in link above:

1) Download Eclipse. I got eclipse-jee-indigo-SR2-linux-gtk.tar.gz to the Downloads folder

2) open the Terminal and navigate to the Downloads folder

3) Extract it using the command below
tar xzf eclipse-jee-indigo-SR2-linux-gtk.tar.gz

4) Move to /opt/ folder
sudo mv eclipse /opt/
sudo chown -R root:root eclipse
sudo chmod -R +r eclipse

5) Create an eclipse executable in your path
sudo touch /usr/bin/eclipse
sudo chmod 755 /usr/bin/eclipse
sudo nano /usr/bin/eclipse

copy this into nano
#!/bin/sh
#export MOZILLA_FIVE_HOME="/usr/lib/mozilla/"
export ECLIPSE_HOME="/opt/eclipse"

$ECLIPSE_HOME/eclipse $*

save the file (^O = Ctrl+o) and exit nano (^X = Ctrl+x)

6) Create a gnome menu item
sudo nano /usr/share/applications/eclipse.desktop

copy this into nano
[Desktop Entry]
Encoding=UTF-8
Name=Eclipse
Comment=Eclipse IDE
Exec=eclipse
Icon=/opt/eclipse/icon.xpm
Terminal=false
Type=Application
Categories=GNOME;Application;Development;
StartupNotify=true

save and exit nano

7) Launch Eclipse for the first time
/opt/eclipse/eclipse -clean &

8) Right click on the Eclipse icon in launcher and select "Lock to Launcher" option to create a launcher shortcut


JVM Monitoring - jConsole, VisualVM

Very useful links on the JVM monitoring and troubleshooting tools to monitor the memory, processors, thread pools, mbeans and other JVM components.

I was using jConsole for quite some time and VisualVM is a step up for that. Both being great open source tools from java.net.

VisualVM link
jConsole link

Both these tools come with latest Oracle JDK distribution so once you have the  JDK distribution you will not need to download from above links again. Go to command prompt and type 'jconsole' for jConsole tool and type 'jvisualvm' for opening the VisualVM tool.

getting error FATAL no pg_hba.conf entry for host user database SSL off

Getting the error below when I try to run the sql-maven-plugin for the project;

getting error FATAL no pg_hba.conf entry for host <host:ip:addr>, user <dbuser>, database <dbname>, SSL off

After searching through net I've added my local IP address to the hba.conf file using PGAdmin III tool
Tools Menu -> Server Configuration -> pg_hba.conf
Inserted one more row as below
Type: host
Database: all
user: all
IP Address: <my system IP address> <eg:  99.999.99.999 >
method: password   (I was using password as clear text in my build script).

Even after this I was getting the same error as above, after some more time of debugging, multiple trials and observations, I observed that a '/32' was present in IP Address column.

I've added '/32' as suffix for my IP address also in pg_hba.conf file and it resolved the connection issue.
In pg_hba.conf file a new row is inserted as below:
host    all             all             99.999.99.999/32            password

This solved only half of my problem as my IP address is not a static IP, so instead of adding multiple IP address entries, we can use 'samenet' literal as an IP address to accept all IP address in the same subnet.
host    all             all             samenet            password

Chrome Browser not opening pages not even the New Tab page

My Chrome browser got updated to v19 morning and after that its just next to useless, I can type on the omni  bar (aka location/ url bar) but the content pane seems just loading for ever!!!

Created a shortcut of chrome.exe with an extra parameter -no-sandbox, and this helped me in opening it back,. It looks like below in my Win 7 system:
C:\Users\<NAGA>\AppData\Local\Google\Chrome\Application

Not sure when the real chrome would open normally again though!
With the target of getting out a release too often, Chrome is getting dirty too often!

Update!: A Restart on computer fixed the original issue, so back to normal

Maven war packaging issue

Was getting the error message below when trying to package a web application to be deployed as war in tomcat:

Caused by: org.codehaus.plexus.archiver.ArchiverException: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)

http://www.coderanch.com/t/510164/tools/Help-Maven-WAR-Build
http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html

These link helped in resolving the WAR packaging issues that I was getting. As per the second link, I moved my webapp resources to a folder src/main/webapp.

Running MVN build from DOS Batch file

I had to execute maven build on multiple related projects, they are not children of a parent project to be grouped under a single Maven build. So my quick dirty hack is to put a single DOS batch file to run all the "mvn clean install" commands one by one.
So my batch file looked like below;
cd \Naga\workspace\demo
echo Maven build on xyz-commons
cd xyz-commons
mvn clean install
echo Maven build on xyz-consumer
cd ..\xyz-consumer
mvn clean install

echo Maven build on xyz-services
cd ..\xyz-services
mvn clean install

echo Maven build on xyz-services-test
cd ..\xyz-services-test
mvn clean install

echo Maven build on xyz-messenger
cd ..\xyz-messenger
mvn clean install

echo Maven build on xyz-cloud-app
cd ..\xyz-cloud-app
mvn clean install

echo Go back to xyz-build folder
cd \Naga\workspace\demo\xyz-build
I was stumped when I see that the execution stopped after the first "mvn clean install" command, 
Then after quick googling I realized that mvn itself is a batch file and hence it should be called using the 'call' command! The below code works fine in getting the job done.
cd \Naga\workspace\demo
echo Maven build on xyz-commons
cd xyz-commons
call mvn clean install
echo Maven build on xyz-consumer
cd ..\xyz-consumer
call mvn clean install

echo Maven build on xyz-services
cd ..\xyz-services
call mvn clean install

echo Maven build on xyz-services-test
cd ..\xyz-services-test
call mvn clean install

echo Maven build on xyz-messenger
cd ..\xyz-messenger
call mvn clean install

echo Maven build on xyz-cloud-app
cd ..\xyz-cloud-app
call mvn clean install

echo Go back to xyz-build folder
cd \Naga\workspace\demo\xyz-build

Maven Skip tests from build execution

Its a common scenario not to execute jUnit Test cases when we want to do only build the project.
-Dmaven.test.skip=true  this parameter can be used for this purpose skip executing of test cases.

Example:
mvn clean install -Dmaven.test.skip=true

Detailed information can be found at link:

http://maven.apache.org/plugins/maven-surefire-plugin/examples/skipping-test.html