Friday, October 28, 2011

Fedora install tomcat 6

yum install tomcat6 tomcat6-admin-webapps tomcat6-webapps
chmod g+x /usr/share/tomcat6/logs
chmod g+x /etc/tomcat6
chmod g+x /usr/share/tomcat6/webapps/
chmod g+x /usr/share/tomcat6/temp
chmod g+x /usr/share/tomcat6/work
chmod g+x /var/cache/tomcat6
chown -R tomcat:tomcat /etc/tomcat6/Catalina
chmod g+x /var/lib/tomcat6/

Ok. Now try start tomcat again:
service tomcat6 restart
Open browser: http://localhost:8080/

Sunday, October 9, 2011

How to list the files installed by a yum package

If you don’t have repoquery you’ll need to install it first:

% yum install yum-utilsThen you can run it like so:

% repoquery --list *package*repoquery writes the list of files for the specified package to standard output. For example, to see the files installed by the nmh package, use:

% repoquery --list nmh
/etc/nmh
/etc/nmh/MailAliases
/etc/nmh/components
/etc/nmh/digestcomps
/etc/nmh/distcomps
...

#Referenced from http://cimarron-taylor.appspot.com/html/0901/090107-yum.html

YUM command

yum gets the list of packages from repository /etc/yum.repos.d

install additional repository into top folder
- wsget *.repo

Saturday, April 16, 2011

JavaServlet\WebService Security Constraint

Reference: http://blogs.sun.com/monzillo/entry/web_xml_security_constraints_best

Thursday, April 14, 2011

Javascript Get browser\OS version

*** browser\other version ***



Ref: http://www.webdeveloper.com/forum/archive/index.php/t-127667.html

*** OS version ***

// This script sets OSName variable as follows:
// "Windows" for all versions of Windows
// "MacOS" for all versions of Macintosh OS
// "Linux" for all versions of Linux
// "UNIX" for all other UNIX flavors
// "Unknown OS" indicates failure to detect the OS

var OSName="Unknown OS";
if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";

document.write('Your OS: '+OSName);

Ref: http://www.javascripter.net/faq/operatin.htm

Others: https://developer.mozilla.org/En/Browser_Detection_and_Cross_Browser_Support

Sunday, January 23, 2011

Setting Java System Properties in JBoss

I like using JVM system properties as a way to access non hard coded resources. Typing System.getProperty("myPropertyName") is convenient and clean. The best part is that these properties have JVM scope, so you don't have to worry about class loaders.

For convenience let me define a couple of variables:

%JBOSS_HOME= directory where JBoss is installed
%JBOSS_SERVER= server instance name

There are 2 ways to define system properties in JBoss:

a) By specifying them in %JBOSS_HOME/bin/run.conf

You use run.conf, don't you? Don't change run.sh or run.bat directly. That makes your application less portable. The file run.conf is used by run.sh or run.bat to setup a number of properties. To setup system properties you need modify the JAVA_OPTS variable. Find this section in run.conf and modify it accordingly:

#
# Specify options to pass to the Java VM.
#
if [ "x$JAVA_OPTS" = "x" ]; then
JAVA_OPTS="-Xms500m -Xmx500m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -DyourPropertyName=yourPropertyValue"
fi

As you can see I added the property yourPropertyName to the System Properties. So, once you restart the server, you will able to simply call System.getProperty("yourPropertyName") and get the value of it in any application running in JBoss.

The problem with this approach is that to change the values of the properties, or add values, you need to restart the server.

b) Use properties-service.xml

This is my favorite method. In $JBOSS_HOME/server/$JBOSS_SERVER/deploy you will find the file properties-service.xml . In this file you can specify new system properties, modify existing ones and even remove old ones. All you need to do is uncomment the following block in properties-service.xml:






yourPropertyName=yourPropertyValue



You don't need to restart the server for defined properties or changed in properties-service.xml to take effect. Placing properties with links to web services endpoints, LDAP servers and other resources in properties-service.xml makes an application EAR or WAR more portable and easier to move from a development environment to a production environment since the properties are outside of the deployment instruments.

Reference from: http://www.hugotroche.com/my_weblog/2008/07/setting-java-sy.html

Wednesday, January 12, 2011

JBOSS 5 on Java 5 Unsupported Operation...Set ....

from 5.0.0.GA
JBossAS 5.0.0.GA can be compiled with both Java5 & Java6. The Java5 compiled binary is our primary/recommended binary distribution. It has undergone rigorous testing and can run under both a Java 5 and a Java 6 runtime. When running under Java 6 you need to manually copy the following libraries from the JBOSS_HOME/common/lib directory to the JBOSS_HOME/lib/endorsed directory, so that the JAX-WS 2.0 apis supported by JBossWS are used:

* jbossws-native-saaj.jar
* jbossws-native-jaxrpc.jar
* jbossws-native-jaxws.jar
* jbossws-native-jaxws-ext.jar

Thursday, January 6, 2011

Linux change hostname

Display Hostname
Type the following command:

hostnameSample ouputs:

server.nixcraft.net.inStep # 1: Change Hostname
You need to update two files:

Linux Distribution specific file. Edit appropriate file as per your distribution as follows.
/etc/hosts
Redhat / CentOS / Fedora: Change Hostname
Edit /etc/sysconfig/network, enter:

vi /etc/sysconfig/networkSet HOSTNAME=newhost.example.com, enter:

HOSTNAME=server2.nixcraft.comSave and close the file. Type the following command:

hostname server2.nixcraft.com
hostname


Step #2: Update /etc/hosts
Now, you need to edit /etc/hosts file, enteR:

vi /etc/hostsChange all old hostname with newer one.