Friday, November 5, 2010

How to increase Maven memory.

Enter this line just after the copyright and comments in the mvn.sh file in Maven_home.

export MAVEN_OPTS=”-Xmx512m”

For Maven 2.0.6 onwards you have to set the parameter without double quotes.

export MAVEN_OPTS=-Xmx512m

Sunday, August 1, 2010

MySQL connecting issue.

Mysql issue

Hi friends...
I just install the mysql becuse of db crashe. After that when i try to connect to the mysql server through the client i got this exception.

Con't connect to local MySQL server through socket.

Finally i found that i need to give the socket path with 'mysql' command.

like this...

mysql --socket=/var/lib/mysql/mysql.sock ...

For the mysql client, the default location of this socket file is /tmp/mysql.sock. However, for a variety of reasons, many MySQL installations place this socket file somewhere else like /var/lib/mysql/mysql.sock.

It is painful to type this in every time.
So i update the /etc/my.cnf file. Add these at the bottom.

[client]
socket=/var/lib/mysql/mysql.sock


Note : If there is already a [client] section in the my.cnf file, add or edit the socket line as appropriate. You won’t need to restart your server or any other processes. Subsequent uses of the mysql client will use the proper socket file.

Friday, July 16, 2010

Start Tomcat in dubug mode and connect with idea.

Tomcat : 6.0.14
idea : Ultimate 9

Tomcat configurations.

copy these to catalina.sh
JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=52385,suspend=n,server=y $JAVA_OPTS"
JPDA_TRANSPORT=dt_socket
JPDA_ADDRESS=8000

Start tomcat : sh catalina.sh run

Idea configurations.

Go to Tools -> debug... (In server tab)
1. Select application server as tomcat 6.
2. Uncheck start browser.
3. Set host as localhost.
4. Set port as 8000

(In startup/connection tab)
1. Select debug.
2. Transport : socket
3. port : 52385

uncheck all in "berfore launch".                                                                              

Click debug.

Wednesday, May 5, 2010

Use Jetty with Spring

1) Insert these beans to the application-context.xml

    <bean name="smpp.gw.httpListener" class="org.eclipse.jetty.server.Server" init-method="start" destroy-method="destroy">
        <constructor-arg index="0" value="8080"/>
        <property name="handler" ref="smsc.mtHttpRequestHandler"/>
    </bean>

    <bean id="anyHandler" class="path.to.AnyHandler">
            ..................................
            ..................................
    </bean>

2) The "AnyHandler" class shold have to extends the AbstractHandler class.

     import org.eclipse.jetty.server.Request;
     import org.eclipse.jetty.server.handler.AbstractHandler;

     import javax.servlet.ServletException;
     import javax.servlet.http.HttpServletRequest;
     import javax.servlet.http.HttpServletResponse;
     import java.io.IOException;
    
     public class HttpRequestHandler extends AbstractHandler {

        public void handle(String s, Request request, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException, ServletException {
            System.out.println(">>>> Request received. <<<");
            // Can do anything using request and response
            ......................................
            ......................................
        }
    }

Thursday, February 18, 2010

Ten Techniques To Transform

Hi Friends...
I'm going to die...... :( I can't find any medicine to treat this illness. But fortunately i met two specialist. Both of them were overcome this illness earlier. So they ask me to follow 10 medical treatments to change my life style. I believe i can .....!!!

1) Build up the confidence among others.
2) Select what you can do.
3) Continuous progress.
4) Don't be fear to know what you don't know.
5) Start from any where, don't waist time to find the best.
6) Make the good things be habits.
7) Tell all the issues when doing some thing before the end.
8) Learn the concepts not the technology.
9) Break down to small peace's when you got a task. (Divide and conquer)
10) THINK how to OVERCOME.