Oct 23, 2013

Eclipse Cannot Start "Failed to load the JNI shared library ** jvm.dll" problem

Today I downloaded the latest eclipse (R4.3.1 Kepler Service Release 1) 64bit. When I tried to start eclipse, it failed and poped up an error message

Failed to load the JNI shared library "C:\Program Files(x86)\Java\jdk1.6.0_45\bin..\jre\bin\client\jvm.dll"


It turns out that in my system environment variables, JAVA_HOME was setting to 32bit version, which makes 64bit eclipse cannot start up. Setting JAVA_HOME to 64bit version java path makes it work.

If you think this article is useful, please click the ads on this page to help. Thank you very much.

Oct 12, 2013

Eclipse Breakpoint Is Not Hit

Today I was debugging a Java web application, and I met a strange problem:

In the javascript side, it is written in this way:
 var helpers = { 
 executeQuery: function(a) {               
  var param = {sQuery : a.sqlquery, sTitle: ""};
  REST.postObject('resources/whiteboardsql/executeQuery/'+a.instanceId+"/"+a.timestamp,param, a);
 }

And in the java side, I am sure that the code below it the rest call will invoke, so that I set a breakpoint there. But what's weird is that I executed the rest call many times but the breakpoint is never hit.

Finally I figured out the reason, it is so simply but I would like to share with those who might experience the same scenario.
The reason is "Hot Code Replace Failed"

I was modified the program, and the modification was deleting a comment, but eclipse pops up the "Hot Code Replace Failed" dialog. And I clicked "Continue".

Then when I come to debug the problem, the breakpoint is not hit. Terminate and restart the application solves the problem.

If you think this article is useful, please click the ads on this page to help. Thank you very much.

Oct 11, 2013

[Solved] How to Change and Config Yum Repository Source in RedHat 6 (No Package Available Problem)

I am using Red Hat Enterprise Linux Workstation 6.1, as it is a enterprise version. When I tried to install a software, for example I run: yum install vim
It returns that I "No package vim available".

I run:
1. cd  /ect/yum.repos.d
2. ls
The redhat.repo is empty.

Only after got a valid license, it will have the right value. For people don't have purchased a license, I have to find a way to config another source. Fortunately I figured out how to do it.

Then general solution is to:

  1. Unistall the original yum in Red Hat 
  2. Download yum rpm packages 
  3. Install Yum 
  4. Config Repository Source
  5. Run Yum and Test Install
The following are the details. 

1. Uninstall The Original Yum in Red Hat

rpm -aq|grep yum|xargs rpm -e --nodeps

2. Download yum rpm packages
You can manually go to the URL http://mirrors.163.com/centos/6/os/x86_64/Packages/ to find what's the right package version:

I have done this and find out them, so run these commands in terminal:

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

3. Install Yum


rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm 
rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

Please notice that the in the last command it installs two packages together, because the two packages have dependencies on each other.

4. Update the repo configuration
a. cd /etc/yum.repos.h
b. backup original redhat.repo
mv redhat.repo redhat.repo.repo.bak
c. download a copy of CentOS repo, for example our version is verson 6
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
d. modify CentOS6-base-163.repo
vi CentOS6-Base-163.repo

the repo file contains 5 sections: [base], [updates], [exras], [centoplus], [contrib]

For each section, you need to replace with the the values in your environment
$releaserver means the version, in our case it's 6
$basearch means which branch, in our case it's x86_64, (another branch is i386

Modify each of the 5 sections.

The result looks like below:

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base - 163.com
baseurl=http://mirrors.163.com/centos/6/os/x86_64
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6/updates/x86_64
                                                           
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
baseurl=http://mirrors.163.com/centos/6/extras/x86_64/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/6/centosplus/x86_64/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/6/contrib/x86_64/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6


f. the last step is to replace the original redhat.repo
mv CentOS6-Base-163.repo redhat.repo

[Note] In my case, I am using the mirror located in China which is hosted by Netease (163), people can also use the website http://mirrors.fedoraproject.org/publiclist/ to find one that good for yourself.
For example http://mirror.overthewire.com.au/pub/centos/6/
It has the same structure.

5. Run Yum and Test Install
run yum:
yum clean all

test install
yum install vim


hallelujah!

If you think this article is useful, please click the ads on this page to help. Thank you very much.