Wednesday, March 31, 2010

Apache Tomcat: starting, stopping and killing processes

STOPPING:
 /opt/apache/apache-tomcat-6.0.26/webapps $ ../bin/shutdown.sh
Using CATALINA_BASE:   /opt/apache/apache-tomcat-6.0.26
Using CATALINA_HOME:   /opt/apache/apache-tomcat-6.0.26
Using CATALINA_TMPDIR: /opt/apache/apache-tomcat-6.0.26/temp
Using JRE_HOME:        /Library/Java/Home/
Using CLASSPATH:       /opt/apache/apache-tomcat-6.0.26/bin/bootstrap.jar
Mar 31, 2010 11:13:58 AM org.apache.catalina.startup.Catalina stopServer
SEVERE: Catalina.stop:
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)
at java.net.Socket.connect(Socket.java:525)
at java.net.Socket.connect(Socket.java:475)
at java.net.Socket.(Socket.java:372)
at java.net.Socket.(Socket.java:186)
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:408)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:338)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:416)

CHECKING IF STILL RUNNING:
 /opt/apache/apache-tomcat-6.0.26/webapps $ ps aux | grep tomcat
uki       3086  57.9  6.8  1506508 143136 s000  U    11:12AM   0:22.70 /Library/Java/Home//bin/java -Djava.util.logging.config.file=/opt/apache/apache-tomcat-6.0.26/conf/logging.properties -Xms128m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=256m -Dfile.encoding=UTF-8 -Dcom.sun.management.jmxremote -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/opt/apache/apache-tomcat-6.0.26/endorsed -classpath /opt/apache/apache-tomcat-6.0.26/bin/bootstrap.jar -Dcatalina.base=/opt/apache/apache-tomcat-6.0.26 -Dcatalina.home=/opt/apache/apache-tomcat-6.0.26 -Djava.io.tmpdir=/opt/apache/apache-tomcat-6.0.26/temp org.apache.catalina.startup.Bootstrap start
uki       3120   0.2  0.0   590540    204 s000  U+   11:14AM   0:00.00 grep tomcat

KILL A PROCESS:
 /opt/apache/apache-tomcat-6.0.26/webapps $ kill 3086

CHECKING IF STILL RUNNING:
 /opt/apache/apache-tomcat-6.0.26/webapps $ ps aux | grep tomcat
uki       3122   0.9  0.0   600020    472 s000  R+   11:14AM   0:00.00 grep tomcat


STARTING:
ill-lt20220@(Wed Mar 31 11:14:27) /opt/apache/apache-tomcat-6.0.26/webapps $ ../bin/startup.sh 
Using CATALINA_BASE:   /opt/apache/apache-tomcat-6.0.26
Using CATALINA_HOME:   /opt/apache/apache-tomcat-6.0.26
Using CATALINA_TMPDIR: /opt/apache/apache-tomcat-6.0.26/temp
Using JRE_HOME:        /Library/Java/Home/
Using CLASSPATH:       /opt/apache/apache-tomcat-6.0.26/bin/bootstrap.jar
ill-lt20220@(Wed Mar 31 11:14:33) /opt/apache/apache-tomcat-6.0.26/webapps $ ps aux | grep tomcat
uki       3132  49.5  3.6  1504832  74680 s000  U    11:14AM   0:06.14 /Library/Java/Home//bin/java -Djava.util.logging.config.file=/opt/apache/apache-tomcat-6.0.26/conf/logging.properties -Xms128m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=256m -Dfile.encoding=UTF-8 -Dcom.sun.management.jmxremote -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/opt/apache/apache-tomcat-6.0.26/endorsed -classpath /opt/apache/apache-tomcat-6.0.26/bin/bootstrap.jar -Dcatalina.base=/opt/apache/apache-tomcat-6.0.26 -Dcatalina.home=/opt/apache/apache-tomcat-6.0.26 -Djava.io.tmpdir=/opt/apache/apache-tomcat-6.0.26/temp org.apache.catalina.startup.Bootstrap start
uki       3134   0.0  0.0   590736    308 s000  R+   11:14AM   0:00.00 grep tomcat
ill-lt20220@(Wed Mar 31 11:14:41) /opt/apache/apache-tomcat-6.0.26/webapps $


CHECKING THE LOG:

/opt/apache/apache-tomcat-6.0.26/webapps $ tail -f ../logs/catalina.out
Mar 31, 2010 11:15:12 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory work
Mar 31, 2010 11:15:12 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Mar 31, 2010 11:15:12 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Mar 31, 2010 11:15:12 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/88  config=null
Mar 31, 2010 11:15:12 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 36930 ms



Mac: location of hosts file

The hosts file on Mac is located at: /private/etc/hosts
The easiest way to modify it is using pico, you need to have WRITE permissions to do so.

 ~ $ cd /private/etc/
 /private/etc $ pico hosts

Monday, March 29, 2010

Eclipse: show line numbers

This is simple stuff, but it is frustrating when you want to show line numbers and cannot find the setting:

On Mac:

Eclipse -> Preferences -> General -> Editors -> Text Editors -> Show line numbers




Friday, March 26, 2010

IE8 and Windows7 hacked easily

I don't think anything with Windows is really safe...

http://www.computerworld.com/s/article/9174101/Hacker_busts_IE8_on_Windows_7_in_2_minutes


I wonder if Mac vulnerabilities would be found this easy if we put effort towards it or does everyone just like to pick on Microsoft?

Tuesday, March 9, 2010

Virus test file (it is save to use)

In case you write a code to test your anti-virus software you will need a "test virus file" that does not actually wipe out your computer, you can download it from this site...

http://eicar.org/