Dec 24, 2013

[memo] Eclipse proxy configuration

Eclipse 4.2
Window -> Preferences -> search network
Set your Host and Post for HTTP and HTTPS. Do not set SOCKS

Nov 19, 2013

[memo] Maven release:perform DO NOT deploy

As you know web application is not supposed to be uploaded maven repository. I tried to not deploy on the release. Finall I found the answer here.
It took much time.

Nov 17, 2013

[memo] Print file names that contain word and exclude extension.

### command
find ${TARGET_DIR}/*.xml -type f | xargs grep -l ${SEARCH_WORD} | awk '{ num = split($0, array, "/"); print array[num];}' | awk '{ num = split($0, array, "."); print array[1];}'

Nov 15, 2013

Jenkins Git Plugin fails with NullPointerException

When I ran Jenkins job to build project, I got the following error message.


I found the answer from here.

1. Uninstall git client plugin
2. Restart, it would be automatically executed
3. Install git plugin, not git client. Git client is installed automatically too.
4. Confirm git is available and name it "default" on Manage Jenkins > Configure System

Enjoy!

Nov 14, 2013

[memo] this parser does not support specification null version null digester

java.lang.UnsupportedOperationException: This parser does not support specification "null" version "null"
at javax.xml.parsers.SAXParserFactory.setXIncludeAware(SAXParserFactory.java:448)
at org.apache.commons.digester.Digester.getFactory(Digester.java:534)

Update your xercesImpl.jar!!! old xercesImpl.jar can not handle setXIncludeAware method.
2.9.1 helps you.

Thank you Coding in Color!!!


Jul 24, 2013

Continuous Delivery Using Jenkins

Let me introduce our Jenkins jobs. If Jenkins was not exist, we would suffer from HARD HARD build and deploy jobs.

First of all, we made our server list file. Because this is very often used by Jenkins deploy and restart jobs.
Add your Jenkins user key to my_name/.ssh/authorized_key on each server.
-Jenkins Server List Configure Job-


Next step, we build our project and make backup too.
-Jenkins Build Job-
Build our project by running maven.
  clean release:clean release:prepare package -P prd

And make backup directory.


And run deploy job. Don't forget set post-build Actions. We set Build other projects(Jenkins Restart Job)
-Jenkins Deploy Job-


-Jenkins Restart Job-


Sometimes we need to revert our service. We use this job. Don't forget to set Build other projects(Jenkins Deploy Job) that it will execute Jenkins Restart Job.
-Jenkins Roll Back Job-

Jul 22, 2013

[memo] jmagick 6.4.0 configure problem

I had to install jmagick 6.4.0. And I tried to install as the following.



Jmagick dose not care "--with-java-home=/opt/java/". It just uses "/usr/bin/java javac javah jar".
So you need to link them to /usr/bin

#ln -s /opt/java/bin/java /usr/bin/java


[memo] svc: warning: unable to control file does not exist.

I solved this problem here.

The key is the following command.
# svscanboot &

Jul 9, 2013

[memo] How to add many nodes to Chef Server

I created my node.json file with jackson. And I need to add 100 over nodes to Chef server.
I uploaded to Chef server's tmp directory my nodes files and ran the following script.


It is simple!

Jun 7, 2013

maven scala java mixed project

I develop my product with Java and have test code written by Scala(Specs2). I wanted run test cases on my PC and Jenkins.
I have got some problems and solved by the following pom.xml. It works well. I hope this helps you.

Don't forget add "@RunWith(classOf[JUnitRunner])" to your xxxSpec class.



May 29, 2013

error: src refspec master does not match any.

When I executed the following command, I got an error.
#] git push origin env-properites
  error: src refspec env-properites does not match any.
  error: failed to push some refs to 'http://localhost/mygit/firsttest.git'

I can solve this problem by doing as here is written. It is easy!
Just modify unnecessary file like .gitignore.
And add & commit.
Run the above command again.

You can see the following message.
  Compressing objects: 100% (8/8), done.   Writing objects: 100% (12/12), 1.82 KiB, done.   Total 12 (delta 2), reused 0 (delta 0)   To http://localhost/mygit/firsttest.git    * [new branch]      env-properties -> env-properties

May 16, 2013

com.aerospike.client.AerospikeException: Error Code 13: Record too big

Recently I am trying to verify Aerospike can satisfy our requirements -
1. Persistent Cache for images
2. Time To Live(TTL)
3. Eviction
4. Remove all of related data by a key
5. Scale Out easily

I am testing it with YCSB to check performance. When I tried 256KB data size test, YCSB just stopped. As you know, YCSB is not kind. It doesn't show me any error message. So I ran the following code.

You can find out how to use Aerospike client here.


The result was "Record too big".


What? I already ran same test case on AWS and had no problem. They say "The size of the object or record is exceeding the limit, currently at 1MB". I just ran 256KB and 456KB. Something is wrong. I tried applying several data size files to find out MAX_SIZE. MAX_SIZE was 128KB. Finally I got a hint to solve this problem.

citrusleaf.conf

I am using data file because server was already configured RAID 10 with 4 SSDs and I did not want to go far far our data center. :) Anyway the reason was [write-block-size]. It makes limitation on using data file. When I use raw device([device]), I had no problem. I removed it and could run my test case.

You know what?  The max size of our images is 10MB. orz... 


Apr 18, 2013

java: invalid flag: -target=1.6 intellij idea

When I ran my test cases, I got this message "error: java: invalid flag: -target=1.6". I search this -"target=1.6" phrase in my project. So I re installed Intellij idea and removed .idea directory and .iml file. But I got same messages.
Finally I solved this problem by removing Additional command line parameters of java compiler.


Apr 11, 2013

How to add new node to an existing Aerospike Cluster - Using multicast

Modify /etc/citrusleaf/citrusleaf.conf as my example.

After modifying just start new node, it will be added an existing cluster automatically. You can confirm it on /var/log/citrusleaf.log with the following message.


Tip(?).
I changed ip address to 172.28.206.73 - it's wrong address -,  after I got succeeded with above configuration. So I fixed it to 172.28.206.72 and restarted node. But I got some non normal message.
I issued the command and failed to get expected result - ClusterSize 2 -.

I fixed this event by restarting all nodes.

Install and Run Aerospike Community Edition on CentOS 6.2

This installation is just for CentOS 6.2. If you use other OS like Ubuntu, please see Aerospike Standard Installation.

Step 1. Download Aerospike Database Server rpm packages
You can download here.

Step 2. Untar file


Step 3. Install the Aerospike Server


Step 4. Run the Aerospike Server for Testing

Oops! I got a error message. It means "CLD is stopped!".  Let me see the log.

Aha! Aerospike can't get ip address by eth, bond, wlan. Wait! my network interface name is "bond0.2032". If they use regular expression, it would be solved. But I can't fix it, so I changed my configuration file - /etc/citrusleaf/citrusleaf.conf - as blow. I just added network-interface-name item.

......

network {
        service {
                address any
                port 3000
                reuse-address
                network-interface-name bond0.2032

......

I ran it again and got succeeded.


Step 5. Verify Installation
I used the Aerospike command line interface tool to verity installation. It is installed as /opt/citrusleaf/bin/cli and lined in /usr/bin/cli. So you can use it normally.


It's simple, right?

Apr 10, 2013

How to install Jenkins and plugins offline.

I tried to the following commands that are introduced on Installing Jenkins on Red Hat distributions.


But I got failed. This server is not connected to internet. So I downloaded rpm package from RedHat Linux RPM packages for Jenkins and git, git-client plugins from Jenkins plugins download site to my MBA. And I uploaded them to the server and executed as blow.





Mar 18, 2013

No runnable methods junit 4.11

I am implementing Swift(OpenStack Object Storage) Client to use Swift simply. I ran each of test cases successfully on IDE, but I ran test cases with Class. It throws the following exception messages.



Here is my code.


I googled and searched several pages.

http://stackoverflow.com/questions/15383387/no-runnable-methods-on-junit-with-custom-annotation-and-all-tests-filtered

It says
You get this error due to the validation performed in validateInstanceMethods since computeTestMethods() returns an empty List: 

He suggested override or remove List size validation. I couldn't agree with him. Cause I have run my test cases with no problem on other projects. I read my code and error message again.

at swift.client.SwiftConfigTest.suite(SwiftConfigTest.java:17)

I felt it weird.  Because I don't need to run suite method. I removed suite method and ran all tests successfully.
Here is my right source code.

Feb 7, 2013

[memo] Kill all process by uid in Linux

Sometimes flunetd porecess is not stopped by "/etc/init.d/td-agent stop".
So I executed the following command.

Feb 5, 2013

bash while loopの変数が初期化される問題

業務上処理件数を調べる必要があったため軽くスクリプトを書くつもりが変数が初期化される現象に遭遇してはまった。

最初書いたスクリプトはこちらです。

特に問題ないように見えますが、最後のecho文の結果が0(zero)になります。

Google先生に聞くと下記のサイトを教えて下れました。
http://www.edwardawebb.com/linux/scope-issue-bash-loops

それで修正したスクリプトがこちら。正しくカウントできました。


ではなぜこの現象が起きるかというとパイプ(|)からのstdinはいつもsubshellを使うそうです。なのでループの中のcountはループ内の変数になってしまいます。
while文前パイプを使った場合よく起きるそうです。w

上で修正したスクリプトは自分のスタイルではないので下記のように見やすく修正しました。