quote

Visualizzazione post con etichetta tomcat. Mostra tutti i post
Visualizzazione post con etichetta tomcat. Mostra tutti i post

venerdì, aprile 20, 2007

singleton for tomcat

If you want having just one singleton class shared by all the web applications of your tomcat instance, you have to put the jar containing your singleton class in the folder tomcat/shared and don't put it in the WEB-INF/lib folder of your webapp. In this way the instance will be created just once,after the first call to the method MySingleton.getInstance() and it will be a real singleton object shared between all the webapps.
I needed a such behavior because I want to implement a centralized management of rules, using acegi framework in my project.

mercoledì, aprile 18, 2007

switching off apache web server and using tomcat

Here my notes about how switching off apache httpd web server of my virtual server on areaserver.com.
I don't know if this solution could be applied for different domain providers.

1) vi /etc/rc.conf
2) change the entry httpd_enable="YES" to httpd_enable="NO"
3) run command rebootvs

At this point you have disabled your apache web server httpd. Now you have to change the listening port of your tomcat.

1) cd /usr/local/jakarta-tomcat/conf
2) chmod 777 server.xml
3) vi server.xml
4) search for listening port (usually is configured as 8180) and change the value to 8080.
5) save the changes and run command rebootvs.

At this point your apache tomcat is listening on port 8080 (and port 80...why?) on your virtual server.
Try to connect using http://mydomain/mywebapp.

I have applied this solution to my website, and now it works.
Many thanks to Giovanni Remigi (Ireland) for his tips.