Passa ai contenuti principali

Post

Living in a simulation

Interested in Science-Fiction novels ? Here is my first foray on the topic! The title is: " Chronicles from a Simulated World ". It's a book about stories, or simple facts of life of people, in their quest to answer a simple yet tricky question:" Is our world real? " Through the voice of these people I will try to convince you that this world has been carefully programmed (be it for fun or as an experiment) by somebody living in an High Castle . Available in English and Italian. Are we living in a simulation ? 10 reasons why we might be living in a simulation
Post recenti

Tomcat mod_proxy configuration

Configuring Tomcat with mod_proxy  mod_proxy configuration is the simplest way to integrate Apache tomcat with Apache server. In order to do that,we need to add the module and redirect the URL to a virtual host. Open the httpd.conf : 1. Place the following lines of code after the other LoadModule directives: LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so 2. Place the following lines of code with your other VirtualHost, or at the bottom of the file: NameVirtualHost * < VirtualHost * > ServerName abc.com ProxyRequests Off < Proxy * > Order deny,allow Allow from all </ Proxy > ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/ < Location /> Order allow,deny Allow from all </ Location > </ VirtualHost > Save the configuration file and restart Apache Web server in order to test the integration using mod_proxy. [root@localhost bin]# ./apachectl stop [root@

How to configure Tomcat JVM parameters

How to increase JVM size in Tomcat In order to change the JVM heap size for Tomcat, we need to pickup the catalina.sh/catalina.bat file and modify the value for the JAVA_OPTS parameter. For example, suppose we want to change the max heap size from 256 MB to 512 MB while setting the Perm Gen = 256 MB. Here's how to modify the JAVA_OPTS : JAVA_OPTS= "-Xms128m -Xmx512m -XX:MaxPermSize=256m" The changes in the JVM settings will take effect on the server restart. You can verify the change done in the JVM parameter by running the jmap command that is part of the JDK distribution. This tool requires passing the processId of Tomcat. Example: C:\Users\tomcat>jmap -heap 3860 Attaching to process ID 3860, please wait... Debugger attached successfully. Server compiler detected. JVM version is 24.51-b03 using thread-local object allocation. Parallel GC with 4 thread(s) Heap Configuration:    MinHeapFreeRatio = 40    MaxHeapFreeRatio = 70    MaxHeapSize    

Tomcat Context Path configuration

Tomcat context path configuration Every time we deploy an application we need to setup a context path for the application. The context path will be used for accessing the application from a browser: http://SERVER:PORT/Context-Path/Resource Even if it's actually possible to deploy an application on the Root Context Path ("/") this is usually reserved in special cases, for example if you need to provide a welcome page for your server or in other circumstances. Enabling a context path The context path in Tomcat can be enabled in two ways: GUI using the Tomcat Web Application Manager Command-line configuration in server.xml In order to enable Context Path using the GUI interface , login into the Tomcat Application Manager: You can create the context path using the Deploy tab. Click on Browse and select the required WAR file. Then click on Deploy. It will take some seconds seconds to deploy the application (based on the application size) . The followin

Tomcat Manager Configuration

This tutorial shows how to configure the tomcat manager application that can be used to administrate Tomcat. We will also show how to enable the default user and password and how to grant the roles required to run the manager application. The Tomcat Manager is a very powerful tool for Tomcat administration. It allows you to use the following features: Remote application deployment  Cleanup of Idle session Application undeployment and redeployment Analysis of memory leaks JVM status Server status The Tomcat Manager by default is disabled in Tomcat 7. In order to enable it, pickup the tomcat-users.xml in the conf folder of Tomcat 7. This file contains two users: tomcat and role1. These roles however are not enabled to use the manager gui, as you need an user with the " manager-gui " roles. So change the file so that it look like this: < tomcat-users > < role rolename= " manager-gui " /> < user username= " tomcat " pas

Tomcat Websocket example

A WebSocket is a full-duplex communication mechanism that allows both textual and binary messages to be sent between clients and servers, without the HTTP request/response life cycle. WebSockets allow either the client or the server to send a message at any time, providing an asynchronous solution for working with data while the user is performing a task. Websockets API are included in Tomcat 7 Web server distribution so you don't have to download any extra library: In this tutorial we will show how to create a WebSocket example using Apache Tomcat and Eclipse. Start by creating on Eclipse a new Dynamic project named websocket-example : We will now create a server side class named WebSocketDemo that is going to echo messages from a Javascript client: package com . sample ; import java . io . IOException ; import java . nio . ByteBuffer ; import javax . websocket . OnMessage ; import javax . websocket . Session ; import javax . websocket . server . ServerEndp

Tomcat session timeout

Tomcat session timeout is defined into the CATALINA_HOME/conf/web.xml file by the following directive: < web - app version = "2.5" xmlns = "http://java.sun.com/xml/ns/javaee" xmlns : xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi : schemaLocation = "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" > < session - config > < session - timeout > 30 </ session - timeout > </ session - config > </ web - app > You can however override the default session timeout by setting in your application's WEB-INF/web.xml file the session timeout as well. The number in session-timeout tag is in minutes . To make it unlimited or no time out, simply set the number to -1 and restart your Tomcat Service. < web - app version = "2.5" xmlns = "http://java.sun.com/xml/ns/javaee" xmlns : xsi = "http://www.w3.org/2001/XML