Powered by Syntax Highlighter scripts!

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:
Please move or remove them before you can merge.

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.

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
#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]
Comment=Eclipse IDE

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.