Skip to main content

Postgresql Tomcat en OpenSuse parte 1

Explicare brevemente los pasos para instalar Postgresql + Apache Tomcat en OpenSuse.
En este caso se trataba de una aplicaciĆ³n un poco antigua que corre sobre Apache Tomcat 5.5.20 y se deseaba migrar a un nuevo servidor.
Instalar Postgresql

yast2 –install postgresql-server

Instala postgresql en
/usr/share/postgresql/
Los datos se almacenan en
/var/lib/pgsql/
Los archivos de configuracion estan en
/var/lib/pgsql/data
Aqui estan los archios pg_hba.conf y postgresql.conf

Iniciar postgresql
rcpostgresql start
detener
rcpostgresql stop
Restaurar postgresql
rcpostgresql restart
Entrar a postgresql
su postgres -c psql postgres
Cambiar el password
ALTER USER postgres WITH PASSWORD ‘postgres’;

Descargamos el JDK 
Descargamos Apache Tomcat
Creamos un Script para el arranque de Tomcat 
CONFIGURAR TOMCAT PARA ARRANCAR CON EL SISTEMA OPERATIVO
copiar el script tomcat a la carpeta /etc/init.d/
#!/bin/sh
# TOMCAT Init Script written by Martin Loitzl 2006
DIR_FILE=/opt/apache-tomcat-5.5.20
START_FILE=bin/startup.sh
STOP_FILE=bin/shutdown.sh
TOMCAT_START=${DIR_FILE}/${START_FILE}
TOMCAT_STOP=${DIR_FILE}/${STOP_FILE}
TOMCAT_PID_FILE=/var/run/tomcat.pid
test -x $TOMCAT_START || { echo "$TOMCAT_START not installed or execeutable";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }
case "$1" in
start)
echo "Starting TOMCAT"
if [ -e $TOMCAT_PID_FILE ]; then
TOMCAT_PID=`head -n 1 $TOMCAT_PID_FILE`
if ps -p $TOMCAT_PID; then
echo "TOMCAT already running"
exit 1
else
$TOMCAT_START
exit 0
fi
else
$TOMCAT_START
exit 0
fi
;;
stop)
echo "Stopping TOMCAT"
if [ -e $TOMCAT_PID_FILE ]; then
TOMCAT_PID=`head -n 1 $TOMCAT_PID_FILE`
if ps -p $TOMCAT_PID; then
$TOMCAT_STOP
else
echo "Could not find process, trying $TOMCAT_STOP anyways"
$TOMCAT_STOP
fi
else
echo "Could not find PID file, trying $TOMCAT_STOP anyways"
$TOMCAT_STOP
fi
;;
status)
if [ -e $TOMCAT_PID_FILE ]; then
TOMCAT_PID=`head -n 1 $TOMCAT_PID_FILE`
ps -p $TOMCAT_PID
else
echo "$TOMCAT_PID_FILE not found"
fi
;;
restart)
$0 stop
echo "Shutting down TOMCAT takes some time. Waiting for 10 secs. to restart"
sleep 10
$0 start
;;
reload|force-reload)
$0 stop
echo "Shutting down TOMCAT takes some time. Waiting for 60 secs. to restart"
sleep 60
$0 start
;;
*)
echo "Usage: tomcat {start|stop|restart|status|reload|force-reload}"
exit 1
;;
esac

Le damos los permisos mediante
chmod 755 /etc/init.d/tomcat


En la parte dos explicare como agregarlo a los Run Level.

Comments

Popular posts from this blog

Cambiando el estado de un checkbox

Cambiando el Estado de un CheckBox Algunas veces deseamos controlar el estado de un checkbox o cambiarlo segĆ¹n determinadas condiciones. Pasos: 1. Creamos un proyecto Web. 2. En el diseƱador agregamos un checkbox y dos botones. * Dar click derecho en el checkbox y luego seleccionar Add Binding Attribute, para agregar los atributos al checkbox, de manera que los podamos usar en nuestro cĆ³digo. Generando automĆ”ticamente private Checkbox checkbox1 = new Checkbox(); public Checkbox getCheckbox1() { return checkbox1; } public void setCheckbox1(Checkbox c) { this.checkbox1 = c; } 3.Damos click derecho en el botĆ³n Habilitar, y seleccionamos Edit Action Event Handler. A continuaciĆ³n, agregamos el cĆ³digo: this.checkbox1.setSelected(true);, el mĆ©todo setSelected con valor true, marca el checkbox como seleccionado, y un valor de false, quita la marca. public String button1_action() { // TODO: Process the action. Return value is a navigation //

Corregir el error el archivo de manifiesto en proyectos maven

Corregir el error en el archivo de manifiesto en proyectos maven Si creamos un proyecto maven con NetBeans e intentamos ejecutarlo encontrarĆ­amos el siguiente error Agregamos el plugin   <artifactId>maven-jar-plugin</artifactId>  <plugin>                 <groupId>org.apache.maven.plugins</groupId>                 <artifactId>maven-jar-plugin</artifactId>                 <version>2.4</version>                 <configuration>                     <archive>                         <manifest>                             <mainClass>org.javscaz.maven1.App</mainClass>                         </manifest>                                           </archive>                 </configuration>             </plugin> Luego al construir el proyecto con dependencias, podemos ejecutar el .jar

Tutorial bƔsico de aplicaciones Web con NetBeans parte 1

NetBeans ofrece un excelente soporte para el desarrollo de aplicaciones Web, en esta ocasiĆ³n lo haremos utilizando el Framework Java Server Faces 2.0. En el Menu Seleccionamos Nuevo->Proyecto y luego en Categorias Java Web y en tipo de Proyectos Web  Application indicamos el nombre del proyecto Seleccinamos el servidor Web, usamos GlassFish ya que este soporta EJB3.0 y JSF 2.0 Framework Java Server Faces El IDE genera el esquelto del proyecto Web Pages   almacenamos las paginas .html, xhtml, jsf, los archivos de recursos, los scripts .js, imagenes Source Packages    Son las clases Java  Test Packages    Son las clases que usamos para los Test Libraries     Tenemos las bibliotecas de Java y GlassFish necesarias para ejecutar la aplicaciĆ³n Web. Test Libraries     EstĆ”n las bibliotecas usadas para los test  Configuration Files    Archivos de configuraciĆ³n de la aplicaciĆ³n. Ejecutamos la aplicaciĆ³n  Esperamos que se inicie GlassFish y se cargue la aplicaciĆ³n Este se