If your getting null value as your host name, check that both /etc/hosts and /etc/hostname files has the same name to the host, If not put the same name to both file as hostname, Here[1] you can find how to do that.
Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts
Wednesday, March 20, 2013
How to change machine name in Ubuntu 12.04 LTS
Go to the terminal
Type "sudo su" , because you need log into root mode to modify following files.
Now type "gedit /etc/hostname"
Replace new name with old name
Save and close the file
Now type "gedit /etc/hosts"
Replace your new name with old name
eg : 127.0.1.1 <old name> --> 127.0.1.1 <new name>
Save and close the file
Now you need to restart the machine, type "reboot" in terminal to restart via terminal.
Now you have successfully changed machine name.
Type "sudo su" , because you need log into root mode to modify following files.
Now type "gedit /etc/hostname"
Replace new name with old name
Save and close the file
Now type "gedit /etc/hosts"
Replace your new name with old name
eg : 127.0.1.1 <old name> --> 127.0.1.1 <new name>
Save and close the file
Now you need to restart the machine, type "reboot" in terminal to restart via terminal.
Now you have successfully changed machine name.
Saturday, August 25, 2012
Install Netbeans 7.2 in Ubuntu 11.10
When I try to install Netbeans IDE by downloading netbeas*.sh file from the Netbeans website and run it in terminal, it say installation is not completed please find the log file and try again. I tried with serveral netbeans.sh files , even several versions but result is the same. After that i tried by giving path to javahome using "sh netbeans*.sh --javahome /path/to/JDK/home ". But still i get the same error message.
Somehow I could able to solve this issue using pack which provided by Oracle. In that pack they have bundle JDK and Netbeans 7.2 together. You can find it in JDK 7u6 with Netbeas 7.2 post published by Oracle. You need to do is accept the license agreement and download it. Then you can run it using sh command as usual.
Thanks,
Shameera.
Somehow I could able to solve this issue using pack which provided by Oracle. In that pack they have bundle JDK and Netbeans 7.2 together. You can find it in JDK 7u6 with Netbeas 7.2 post published by Oracle. You need to do is accept the license agreement and download it. Then you can run it using sh command as usual.
Thanks,
Shameera.
Wednesday, June 27, 2012
How to use SoapUI client
You can download SoapUI from here ,
Unzip the soapui-4.*.*-*-bin.zip to your preferable place , lets assume you unzip to your home directory ,
Then go to bin directory - run this command in terminal "cd soapui-4.*.*/bin/".
To run the SoapUI client use "sh soapui.sh " command.
Ok now you ready to create a new soapui project using your wsdl :)
Go to File--> New soapui Project
Then you can see a pop up window like below
Give a name to your project , and select you wsdl file
click ok button to create a new project.
select a operation in request window and fill out the request message. Now click on green arrow button which is at the top left conner of Request window to send your request to the service. Here I am sending echoString request giving "sample" as my string.
If you have deploy your service at particular endpoint then you will receive response and you can see it right side pane of Request window.
Unzip the soapui-4.*.*-*-bin.zip to your preferable place , lets assume you unzip to your home directory ,
Then go to bin directory - run this command in terminal "cd soapui-4.*.*/bin/".
To run the SoapUI client use "sh soapui.sh " command.
Ok now you ready to create a new soapui project using your wsdl :)
Go to File--> New soapui Project
Then you can see a pop up window like below
Give a name to your project , and select you wsdl file
click ok button to create a new project.
select a operation in request window and fill out the request message. Now click on green arrow button which is at the top left conner of Request window to send your request to the service. Here I am sending echoString request giving "sample" as my string.
If you have deploy your service at particular endpoint then you will receive response and you can see it right side pane of Request window.
Friday, June 15, 2012
How to run Apache Zookeeper server
It is easy to up and run apache zookeeper server. First you need to download latest stable version of zookeeper distribution . Lets say you have downloaded zookeeper-3.3.4 to home directory , Then open Terminal by pressing Ctrl+Alt+t all together.Go to zookeeper bin folder(run "cd ~/zookeeper-3.3.4/bin" command in terminal)
Then run "zkServer.sh start" command then you will see following three lines
JMX enabled by default
Using config: /home/zookeeper-3.3.4/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
If you can see above output in the terminal window. It means you have started Zookeeper server successfully in your local machine.
To stop the server run "zkServer.sh stop" command.
If you need You can run zookeeper default client come up with the distribution, for that, run "zkCli.sh" command. Then you will see
zookeeper-3.3.4/bin/../conf:
...............
2012-06-14 23:47:35,640 - INFO [main:Environment@97] - Client environment:java.io.tmpdir=/tmp
2012-06-14 23:47:35,641 - INFO [main:Environment@97] - Client environment:java.compiler=<NA>
........
connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@7369ca65
Welcome to ZooKeeper!
2012-06-14 23:47:35,697 - INFO [main-SendThread():ClientCnxn$SendThread@1061] - Opening socket connection to server localhost/127.0.0.1:2181
JLine support is enabled
2012-06-14 23:47:35,713 - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@950] - Socket connection established to localhost/127.0.0.1:2181, initiating session
[zk: localhost:2181(CONNECTING) 0] 2012-06-14 23:47:35,915 - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@739] - Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x137ec2306ef0000, negotiated timeout = 30000
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
[zk: localhost:2181(CONNECTED) 0]
Then type "ls" or what ever you will see list of available commands
[zk: localhost:2181(CONNECTED) 0] ls
ZooKeeper -server host:port cmd args
connect host:port
get path [watch]
ls path [watch]
set path data [version]
delquota [-n|-b] path
quit
printwatches on|off
create [-s] [-e] path data acl
stat path [watch]
close
ls2 path [watch]
history
listquota path
setAcl path acl
getAcl path
sync path
redo cmdno
addauth scheme auth
delete path [version]
setquota -n|-b val path
[zk: localhost:2181(CONNECTED) 1]
eg: If you like to list down zookeeper root directory, Type "ls / "
Note: If you need you can change zookeeper configuration file(zoo.cfg). You can fine it zookeeper-3.3.4/conf/ directory. Sometimes you need to change its default values. As an example, If you need to connect more than 10 zookeeper client to your zookeeper server Then you should probably add maxClientCnxns=# (#-any number) otherwise defalut value is 10. if you add maxClientCnxns=0 it means there is no any client limit. please refer advanced configuration in Zookeeper administrator's guide
Then run "zkServer.sh start" command then you will see following three lines
JMX enabled by default
Using config: /home/zookeeper-3.3.4/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
If you can see above output in the terminal window. It means you have started Zookeeper server successfully in your local machine.
To stop the server run "zkServer.sh stop" command.
If you need You can run zookeeper default client come up with the distribution, for that, run "zkCli.sh" command. Then you will see
zookeeper-3.3.4/bin/../conf:
...............
2012-06-14 23:47:35,640 - INFO [main:Environment@97] - Client environment:java.io.tmpdir=/tmp
2012-06-14 23:47:35,641 - INFO [main:Environment@97] - Client environment:java.compiler=<NA>
........
connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@7369ca65
Welcome to ZooKeeper!
2012-06-14 23:47:35,697 - INFO [main-SendThread():ClientCnxn$SendThread@1061] - Opening socket connection to server localhost/127.0.0.1:2181
JLine support is enabled
2012-06-14 23:47:35,713 - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@950] - Socket connection established to localhost/127.0.0.1:2181, initiating session
[zk: localhost:2181(CONNECTING) 0] 2012-06-14 23:47:35,915 - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@739] - Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x137ec2306ef0000, negotiated timeout = 30000
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
[zk: localhost:2181(CONNECTED) 0]
Then type "ls" or what ever you will see list of available commands
[zk: localhost:2181(CONNECTED) 0] ls
ZooKeeper -server host:port cmd args
connect host:port
get path [watch]
ls path [watch]
set path data [version]
delquota [-n|-b] path
quit
printwatches on|off
create [-s] [-e] path data acl
stat path [watch]
close
ls2 path [watch]
history
listquota path
setAcl path acl
getAcl path
sync path
redo cmdno
addauth scheme auth
delete path [version]
setquota -n|-b val path
[zk: localhost:2181(CONNECTED) 1]
eg: If you like to list down zookeeper root directory, Type "ls / "
Note: If you need you can change zookeeper configuration file(zoo.cfg). You can fine it zookeeper-3.3.4/conf/ directory. Sometimes you need to change its default values. As an example, If you need to connect more than 10 zookeeper client to your zookeeper server Then you should probably add maxClientCnxns=# (#-any number) otherwise defalut value is 10. if you add maxClientCnxns=0 it means there is no any client limit. please refer advanced configuration in Zookeeper administrator's guide
Saturday, January 28, 2012
Configure pom.xml to use JAVA_HOME to compile a mavan project
If you have a new maven project then you will definitely need to use another jdk version instead of maven default jdk version which is jdk_1.3 to build your maven project. Here I point you out how to use your JAVA_HOME to build your maven project. It is simple what you need is just add maven-compiler-plugin to pom.xml file of your project as i have mentioned below.
I have exported jdk_1.6.0_30 as my JAVA_HOME variable in .bashrc file and have set PATH bin.
i.e : export JAVA_HOME=/path/to/jdk
export PATH=$JAVA_HOME/bin:$PATH
Here is how i uses my jdk_1.6 to build my maven project.
I have exported jdk_1.6.0_30 as my JAVA_HOME variable in .bashrc file and have set PATH bin.
i.e : export JAVA_HOME=/path/to/jdk
export PATH=$JAVA_HOME/bin:$PATH
Here is how i uses my jdk_1.6 to build my maven project.
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <source>1.6</source> <target>1.6</target> <executable>${java.home}/bin</executable> </configuration> </plugin> </plugins> </build>
Friday, January 20, 2012
How to Install Maven2/Maven3 in ubuntu
Maven is a java building tool which can uses for compile,run test, install, etc.. Today I'm going to tell you how to install maven2/maven3 in ubuntu by manually and by apt-get package manager.
Install Maven2 manually
1. First you need to download maven 2.2.1 binary file.
2.Extract downloaded binary file to a directory where you like to keep maven . Let's say you created a directory call "maven-2.2.1" in your home directory.
3. Now you need to set maven classpath in ".bashrc" file.
i. Open your terminal and type "cd" to go to home directory where .bashrc has located
ii. Now Type "gedit .bashrc" in your terminal. It will open .bashrc file via gedit.
iii. Add this line to the end of .bashrc file "export PATH=/home/your_home_directory_name/maven-2.2.1/bin:$PATH" (note: replace your home directory name with "your_home_directory_name", i have added "export PATH=/home/shameera/maven-2.2.1/bin:$PATH" as my home directory name is "shameera")
4. Save and close .bashrc file.
5. Get a new terminal and type "mvn --version" then you will get below line and some other information like java versin and java home. If you need to install oracal(sun) java 1.7 on your machine see my previous post Install Oracle(sun) jdk 1.7 in ubuntu.
Apache Maven 2.2.1 (r801777; 2009-08-07 00:46:01+0530)
6. If you get same out put then you have installed maven2 on your machine. NOTE: if you used previous terminal for this before type "mvn --version" type "source .bashrc".
Install Maven3 using manual
This is same as Maven2 installation. Download apache-maven-3.0.4 instead of maven2
Install Maven2 using apt-get
Open a new terminal and type "sudo apt-get install maven2". Then it will ask your password type your password. After that it will ask to install some necessary packages including openjdk if you like to install openjdk on your machine type "y" if not type "n" and use Install Maven2 manuall procedure to install maven2/maven3 on your machine.
Install Maven2 manually
1. First you need to download maven 2.2.1 binary file.
2.Extract downloaded binary file to a directory where you like to keep maven . Let's say you created a directory call "maven-2.2.1" in your home directory.
3. Now you need to set maven classpath in ".bashrc" file.
i. Open your terminal and type "cd" to go to home directory where .bashrc has located
ii. Now Type "gedit .bashrc" in your terminal. It will open .bashrc file via gedit.
iii. Add this line to the end of .bashrc file "export PATH=/home/your_home_directory_name/maven-2.2.1/bin:$PATH" (note: replace your home directory name with "your_home_directory_name", i have added "export PATH=/home/shameera/maven-2.2.1/bin:$PATH" as my home directory name is "shameera")
4. Save and close .bashrc file.
5. Get a new terminal and type "mvn --version" then you will get below line and some other information like java versin and java home. If you need to install oracal(sun) java 1.7 on your machine see my previous post Install Oracle(sun) jdk 1.7 in ubuntu.
Apache Maven 2.2.1 (r801777; 2009-08-07 00:46:01+0530)
6. If you get same out put then you have installed maven2 on your machine. NOTE: if you used previous terminal for this before type "mvn --version" type "source .bashrc".
Install Maven3 using manual
This is same as Maven2 installation. Download apache-maven-3.0.4 instead of maven2
Install Maven2 using apt-get
Open a new terminal and type "sudo apt-get install maven2". Then it will ask your password type your password. After that it will ask to install some necessary packages including openjdk if you like to install openjdk on your machine type "y" if not type "n" and use Install Maven2 manuall procedure to install maven2/maven3 on your machine.
Sunday, December 25, 2011
Install Oracle(sun) jdk 1.7 in ubuntu 11.10 (Oneiric Ocelot)
When i upgraded to ubuntu 11.10(oneiric Ocelot) i have noticed that there is no any jdk installed in default. But it is good as previous ubuntu versions have OpenJdk in default. I am preffer to use Oracle(sun) jdk instead of OpenJdk for some reasons. Therefore i have to first uninstall Openjdk and then install Oracle(sun) jdk in those versions. Thanks to ubuntu developers in ubuntu 11.10 i don't need to uninstall OpenJdk to install Oracle jdk.
Here are the steps you need to install Oracle jdk 1.7 on ubuntu 11.10
Step 1. Download Oracle jdk 1.7 form here
Step 2. Extract it to your home folder and move to usr/lib/jvm/
open terminal(ctrl+Alt+T)
(assume that extracted folder name is "java_1.7" now we need to move this folder to usr/lib/jvm)
shameera@dell:~$ sudo mv java_1.7/ usr/lib/jvm/
Step 3. Install Update Java package created by Bruce Ingalls (packages available for Ubuntu 11.10, 11.04, 10.10 and 10.04)
shameera@dell:~$ sudo add-apt-repository ppa:nilarimogard/webupd8
shameera@dell:~$ sudo apt-get update
shameera@dell:~$ sudo apt-get install update-java
Step 4. To install oracal jdk 1.7 run following command in terminal
shameera@dell:~$ sudo update-java
after this you have installed java-1.7-oracal successfully for
you can check version by running "java -version" in terminal then you will see an output like this(my os is 64 bit if your one is 32 bit then this will different little bit)
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
It means you have installed jdk 1.7 on your machine successfully
first remove old firefox java plugin
shameera@dell:~$ rm -f ~/.mozilla/plugins/libnpjp2.so ~/.mozilla/plugins/libjavaplugin_oji.so
shameera@dell:~$ sudo rm -f /usr/lib/firefox/plugins/libnpjp2.so /usr/lib/firefox/plugins/libjavaplugin_oji.so
for 32bit :-
shameera@dell:~$ mkdir -p ~/.mozilla/plugins
shameera@dell:~$ ln -s /usr/lib/jva/java_1.7/jre/lib/i386/libnpjp2.so ~/.mozilla/plugins/
for 64bit :-
shameera@dell:~$ mkdir -p ~/.mozilla/plugins
shameera@dell:~$ ln -s /usr/lib/jvm/java_1.7/jre/lib/amd64/libnpjp2.so ~/.mozilla/plugins/
Here are the steps you need to install Oracle jdk 1.7 on ubuntu 11.10
Step 1. Download Oracle jdk 1.7 form here
Step 2. Extract it to your home folder and move to usr/lib/jvm/
open terminal(ctrl+Alt+T)
(assume that extracted folder name is "java_1.7" now we need to move this folder to usr/lib/jvm)
shameera@dell:~$ sudo mv java_1.7/ usr/lib/jvm/
Step 3. Install Update Java package created by Bruce Ingalls (packages available for Ubuntu 11.10, 11.04, 10.10 and 10.04)
shameera@dell:~$ sudo add-apt-repository ppa:nilarimogard/webupd8
shameera@dell:~$ sudo apt-get update
shameera@dell:~$ sudo apt-get install update-java
Step 4. To install oracal jdk 1.7 run following command in terminal
shameera@dell:~$ sudo update-java
after this you have installed java-1.7-oracal successfully for
you can check version by running "java -version" in terminal then you will see an output like this(my os is 64 bit if your one is 32 bit then this will different little bit)
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
It means you have installed jdk 1.7 on your machine successfully
Install oracal java 7 browser plugin for Firefox
first remove old firefox java plugin
shameera@dell:~$ rm -f ~/.mozilla/plugins/libnpjp2.so ~/.mozilla/plugins/libjavaplugin_oji.so
shameera@dell:~$ sudo rm -f /usr/lib/firefox/plugins/libnpjp2.so /usr/lib/firefox/plugins/libjavaplugin_oji.so
for 32bit :-
shameera@dell:~$ mkdir -p ~/.mozilla/plugins
shameera@dell:~$ ln -s /usr/lib/jva/java_1.7/jre/lib/i386/libnpjp2.so ~/.mozilla/plugins/
for 64bit :-
shameera@dell:~$ mkdir -p ~/.mozilla/plugins
shameera@dell:~$ ln -s /usr/lib/jvm/java_1.7/jre/lib/amd64/libnpjp2.so ~/.mozilla/plugins/
Sunday, September 11, 2011
Apache Axis2 Server: A Developer Guide To New Contributors
Env : OS - Ubuntu 10.04(Lucid Lynx)
Apache Axis2 is an open source web service / soap / wsdl engine. There are two implementations Axis2/java and Axis2/C. In here I'm talking about Axis2/java. There are three ways we can run Axis2 as,
- Axis2 binary distribution
- Axis2 source distribution
- Axis2 war(Web archive) distribution
But If you need to contribute to Axis2 development, you need to checkout the source code of Axis2 trunk and build it.Here I will talk on how to build Axis2 trunk, how to up the Axis2 server and deploy a simple service in Axis2. Then I am going to talk on how we can run Axis2 Server with our changes what we have done to source code.
Checkout Axis2 trunk
Axis2 project uses subversion as its version control system therefore we need to have subversion installed in our machine (If not you can install latest subversion by typing "sudo apt-get install subversion" in terminal).
Now you can checkout Axis2 trunk to your machine by typing "svn co <url_to_trunk> <directory_name>".
eg: svn co http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/ axis2_trunk
This will checkout Axis2 trunk to the axis2_trunk directory in our local machine.
Build Axis2 trunk
Axis2 uses Maven2 as its building tool, which means we need install maven2 in our machine to build axis2 source code. You can install maven2 by typing "sudo apt-get install maven2" .
Lets assume you have checked out trunk to the directory called axis2_trunk, go to that directory and type "mvn install" it will build Axis2 by default. Then go to distribution module typing "cd modules/distribution/" and again type "mvn install". It will build the distribution module as in default profile, it doesn't build this module. That's all and now you have build latest Axis2 trunk in your machine.
Up the Axis2 server and deploy a new service
Lets see how to up Axis2 server. After building process is finished it will create a target directory in distribution module. Now type cd target/axis2-1.7.0-SNAPSHOT/bin/ to navigate to bin directory. In bin directory you can see several .sh files, to run Axis2 server run "sh axis2server.sh" command in terminal.
It will up axis2server in default port 8080. Now go to you browser and type http://localhost:8080/axis2/services/ you can see axis2 services list and available operations.
You have built Axis2 trunk and up the Axis2 server in localhost. Now you can deploy your services in Axis2. It is a simple thing in Axis2 as it supports hot deployment which means you can deploy a service while Axis2 is up and running as it doesn't need to down the server and up it again after adding a new service. You just need to add <service_name>.aar file to repository/serivces/ directory in axis2-1.7.0-SNAPSHOT .
However as developers we may need to deploy the same service again and again. Then you need to create new .aar file for each attempt and this is cumbersome. No need to worry , you can deploy a service by putting a directory which has content same as .aar file.
Run Axis2 with changes we have done to the source code
If you are a new contributor to Axis2 project then you need to run Axis2 server which new changes you have done to the source code of Axis2. There are two ways you can accomplish this.
- Go to the axis2_trunk directory and run "mvn clean install" then go to the distribution module and run "mvn clean install" commands in terminal. Now you have built Axis2 with modifications what you have done to the source. Go to the bin directory and run "sh axis2server.sh" to up the modified Axis2 server.
- If you have done changes to a few modules then you don't need to build all modules. Hence you just need to build those modules as we built distribution module in previous method. Lets say you have done modifications to kernel module, then you can build kernel module running "mvn clean install" inside the kernel module, copy axis2-kernel-<version>.SNAPSHOT.jar which was created in target directory of kernel module to the target/axis2-1.7.0-SNAPSHOT/lib/ directory in distribution module. Thats all and now you can up the Axis2 server by running sh axis2server.sh command inside the bin directory of distribution module.
Subscribe to:
Comments (Atom)
Categories
- Apache (10)
- Apache commons (3)
- Axis2 (6)
- Carbon (1)
- Class Loader (1)
- client (2)
- Drools (1)
- Enum (1)
- equinox (3)
- How to (8)
- IDE (1)
- Intellij Idea (1)
- java (14)
- java best practice (1)
- JavaScript (2)
- jdk (1)
- JSON (2)
- Linux (1)
- Maven (5)
- Netbeans (1)
- OSGi (3)
- server (2)
- soap (1)
- soapui (2)
- Terminal (4)
- Tips (2)
- ubuntu (9)
- WSDL (2)
- XML (3)
- XSD (2)
- Zookeeper (1)






