tomcat

  • apache_maven

    cargo-banner-left

    Following the post about Deploy to Tomcat 6 using Maven, here is a ready to use example with the main differences explained in the table below

      Tomcat 7 Tomcat 6
    containerId <containerId>tomcat7x</containerId> <containerId>tomcat6x</containerId>
    Url of Tomcat manager <cargo.remote.uri> <cargo.tomcat.manager.url>
    example http://host..com/manager/text/ http://host..com/manager/
    tomcat-users.xml

    <tomcat-users>
    <role rolename="manager-gui"/>
    <role rolename="manager-script"/>
    <role rolename="manager-jmx"/>
    <role rolename="manager-status"/>
    <user username="admin" password="admin" roles="manager-gui,manager-script"/>
    </tomcat-users>

    <tomcat-users>
      <role rolename="manager"/>
      <user username="admin" password="admin" roles="manager"/>
    </tomcat-users>

    And finally a snippet of an Apache Maven pom.xml ready to use in a profile, so you can reuse this profile like a method call

    <profile>
     <id>deployTomcat</id>
    <activation>
      <activeByDefault>false</activeByDefault>
    </activation>
    <build>
     <plugins>
        <plugin>
         <groupId>org.codehaus.cargo</groupId>
         <artifactId>cargo-maven2-plugin</artifactId>
         <version>1.1.0</version>
        <configuration>
         <wait>true</wait>
         <container>
          <containerId>tomcat7x</containerId>
          <type>remote</type>
         </container>
         <configuration>
          <type>runtime</type>
          <properties>
           <cargo.remote.uri>
             ${tomcat.url}
           </cargo.remote.uri>
           <cargo.remote.username>
              ${tomcat.user}     
           </cargo.remote.username>
            <cargo.remote.password>
              ${tomcat.pwd}
            </cargo.remote.password>
          </properties>
          </configuration>
          <deployer>
           <type>remote</type>
           <deployables>
           <deployable>
            <groupId>${deploy.groupid}</groupId>
            <artifactId>${deploy.artifactid}</artifactId>
            <type>war</type>
            <properties>
             <context>${deploy.context}</context>
            </properties>
           </deployable>
          </deployables>
         </deployer>
        </configuration>
        <executions>
         <execution>
          <id>verify-deploy</id>
          <phase>pre-integration-test</phase>
          <goals>
           <goal>deployer-undeploy</goal>
           <goal>deployer-deploy</goal>
          </goals>
         </execution>
        </executions>
        </plugin>
     </plugins>
    </build>
    </profile>

    Place as many profiles as you have machine to deploy in settings.xml and declare some variables as properties, as shown below:

    <profile>
     <id>serverA</id>
     <activation>
        <activeByDefault>false</activeByDefault>
     </activation>
     <properties>
        <tomcat.url>http://host.com/manager/text</tomcat.url>
        <tomcat.user>admin</tomcat.user>
        <tomcat.pwd>admin</tomcat.pwd>
        <!-- these properties must be defined
           as system property or -D -->
        <!-- - deployable.artifactid:
             artifactId of web application to be deployed -->
        <!-- - deployable.context: web context name -->
     </properties>
    </profile>

    So you can run, and traget multiple host by just exchanging the name of the profile serverA to something else.

    mvn integration-test –PdeployTomcat,serverA
       –Ddeployable.artifactid=demo
       -Ddeploy.groupid=com.mycompany
       –Ddeployable.context=showcase
  • Stop waiting for build & deploy make code changes. Write code and refresh your browser!

    Use DCEVM and add java fields, methods, classes and use them without restarting your application server, it's a modification of the HotSpot VM that allows unlimited class redefinition at run-time. You can add/remove fields and methods and change the super types of a class at run-time. The features of DCEVM are likely to be integrated in a future update of Java 8 as part of JEP 159.

    View code changes instantly and increases team velocity!

              DCEVM                  JVM Hot Swap         
    Changes to method bodies  yes yes
    Adding/removing Methods  yes  no
    Adding/removing constructors  yes  no
    Adding/removing fields  yes  no
    Adding/removing classes  yes  no
    Adding/removing annotations  yes  no
    Changing static field value  yes  no
    Adding/removing enum values  yes  no
    Modifying interfaces  yes  no
    Replacing superclass  yes  no
    Adding/removing implemented interfaces  no  no
    Initializes new instance fields  yes  no

     

  • atlassian.bamboo.logo My Bamboo continuous integration server is now fully functional and available at&160; http://bamboo.waltercedric.com/

    &160;

    &160;

    &160;

    Remember Atlassian is providing free license for Open Source Projects:

    Atlassian supports and believes in the Open Source movement -Bamboo utilizes a number of good Open Source components, and Atlassian developers are committers on a large number of Open Source projects.

    To give back to the open source community (and hopefully improve the quality of those projects!),Bamboo is free for any Open Source project to use.

    There are a few requirements for an Open Source license, the main ones being:

    • Established code base
    • Publicly available project website
    • Using an approved open source license
    • YourBamboo instance will be publicly accessible

    My objective is to make Joomla! and all my projects also running in Bamboo (not only in TeamCity as the limit of 20 builds will be rapidly reached)

    Visit it by clicking on the picture

    Very quick Bamboo install how to

    Install a fresh Tomcat 6 runtime,

    Move the war into the ROOT web context of tomcat

    Choose free port for HTTP, AJP, and Tomcat server port&160; in conf/server.xml

    <Server port="8050" shutdown="SHUTDOWN">
    
    <Connector port="8051" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443"
               enableLookup="false"         
               useBodyEncodingForURI="true" 
    
    <Connector port="8030" protocol="AJP/1.3" redirectPort="8443" />

    Copy mysqldriver.jar into /lib

    Configure the data source into server.xml

    <Host name="localhost"  appBase="webapps"
                unpackWARs="true" autoDeploy="true"
                xmlValidation="false" xmlNamespaceAware="false">
            <Resource name="jdbc/BambooDS" auth="Container" type="javax.sql.DataSource"
                username="user"
                password="pwd"
                driverClassName="com.mysql.jdbc.Driver"            
                url="jdbc:mysql://localhost/schema?autoReconnect=true"            
                maxActive="20"
                validationQuery="select 1" />

    Edit /etc/apache/worker.properties

    worker.list=ajp13, teamcity, jira, bamboo
    worker.bamboo.port=8030
    worker.bamboo.host=localhost
    worker.bamboo.type=ajp13

    &160;

    Create a vhost.conf in the subdomains

    # vi /srv/www/vhosts/waltercedric.com/subdomains/bamboo/conf/vhost.conf

    ServerName bamboo.waltercedric.com
    
    ProxyPass /  ajp://bamboo.waltercedric.com:8030/
    <Proxy *>
       Order Allow,Deny
       Allow from all
    </Proxy>
    
    <Directory />
      Options FollowSymLinks
      AllowOverride None
    </Directory>

    To tell plesk to include an overridden vhost.conf, run

    # /usr/local/psa/admin/sbin/websrvmng

    Restart Apache2

    rcapache2 restart

  • offVertColor-phil2.eps  Short description of how to accomplish some specific task in Debian Lenny.

    • How to install Sun java 1.6 on Debian Lenny
    • How to install Tomcat 6.x on Debian Lenny
    • How to install MySQL on Debian Lenny

     

     

     

     

     

     

    How to install Sun java 1.6 on Debian Lenny

    And not the OpenJDK, as sometimes some applications do not work without the SUN JDK

    Edit APT sources list

    # vi /etc/apt/sources.list

    The original Sun Java 2 is available in the ‘non-free’ section of the Debian repositories. To enable this section first add the non-free repository to the apt sources file - the /etc/apt/sources.list should look like, - important parts are in bold:

    deb http://ftp.ch.debian.org/debian/ lenny main non-free
    deb-src http://ftp.ch.debian.org/debian/  lenny main non-free
    deb http://security.debian.org  lenny/updates main

    Update the list of sources

    apt-get update

    Install java

    #  apt-get install sun-java6-bin

    Just follow and select all the time

    How to install Tomcat 6 on Debian Lenny

    Create new file

    # vi /etc/apt/sources.list.d/squeeze.list

    and put inside

    # Repository for Squeeze, to get Tomcat6
    deb http://ftp.ch.debian.org/debian/ squeeze main contrib non-free
    deb-src http://ftp.ch.debian.org/debian/ squeeze main contrib non-free

    Create new file

    # vi /etc/apt/preferences

    And put inside

    Package: *
    Pin: release o=Debian,a=stable
    Pin-Priority: 990
    Package: *
    Pin: release o=Debian,a=testing
    Pin-Priority: 500
    Package: tomcat6,tomcat6-admin,tomcat6-common,libtomcat6-java,libservlet2.5-java
    Pin: release o=Debian,a=testing
    Pin-Priority: 990

    Update sources

    # apt-get update

    Upgrade

    # apt-get upgrade

    To locate the correct package name, search for it

    # apt-cache search tomcat

    Found

    tomcat6

    Install

    # apt-get install -t testing tomcat6

    You may want also to install the tomcat manager

    # apt-get install -t testing tomcat6-admin

    Create new users/roles for tomcat manager

    # vi /etc/tomcat6/tomcat-users.xml

    NOTA: Webapp are located in

    /var/lib/tomcat6/webapp

    How to install MYSQL on Debian Lenny

    Luckily MYSQL 5.0 is available in the default source list of APT.

    # apt-cache search mysql
    # apt-get install mysql-server-5.0

    Open a mysql prompt

    Grant access to root from any host, this is insecure for production machine but in case of continuous build machine, development this is sometimes very useful.

    Let root connect not only from localhost by running

    # mysql –u root –p
    mysql> use mysql;
    mysql> update user set host = '%' where user = 'root' and host='127.0.0.1'
    mysql> flush privileges;

    Bad written code (DAO) will sometimes forces you to start MYSQL using insensitive casing table. In windows it will always work as the operating system do not make any difference between lower and upper case. In Linux, either you change your DAO’s or if you can’t, use this kind of trick:

    Case insensitive table in MYSQL

    # vi /etc/mysql/conf.d/lower_case_table_names.cnf

    Put inside file

    [mysqld]
    lower_case_table_names = 1

    Restart mysql

    # /etc/init.d/mysql restart

  • apache_maven

     cargo-banner-left
    A ready to use example on how you can deploy your web application to a Tomcat 6 container using Maven Cargo. Cargo is a thin wrapper that allows you to manipulate Java EE containers in a standard way. 

    Cargo provides the following Tools and APIs:

    • A Java API to start/stop/configure Java Containers and deploy modules into them.
    • A Java API to parse/create/merge Java EE Modules
    • Ant tasks, Maven 1, Maven 2 plugins.
    • Intellij IDEA and Netbeans plugins are in the sandbox.

    First you have to decide if your tomcat server run locally or remotely as this influence the way you’ll configure your pom.xml

    Below is an example of a standard architecture

    |---MyApplication
    |           |- ear       (ear)
    |           |- service (jar)
    |           |- client    (jar)
    |           |- web      (war)
    |           |- integration (jar)

    The most interesting Maven module, which will be the subject of this article, and the next one is describing how to automate the deployment of a war to Tomcat and later on running integration tests using Selenium.

    'Integration testing'  is the activity of software testing in which individual software modules are combined and tested as a group. It occurs after unit testing and before system testing. Integration testing takes as its input modules that have been unit tested, groups them in larger aggregates, applies tests defined in an integration test plan to those aggregates, and delivers as its output the integrated system ready for system testing. [WikiPedia]

    Deploying to Tomcat running locally

    Locally mean running on your development machine, at localhost 8080 or on any other port. Maven has the concept of a 'phase' which can be thought of a collection of goals. Hence here we are specifying that during the
    ’pre-integration-test’ phase first deploy the web app to the container specific folder and then start the container. Both 'deployer-deploy' and 'start' are cargo specific goals. The code below is already ready for integration testing!

    <!—Example of Configuration –>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <configuration>
                    <wait>true</wait>
                    <container>
                        <containerId>tomcat6x</containerId>
                        <type>installed</type>
                        <home>${catalina.home}</home>
                    </container>
                    <configuration>
                        <type>existing</type> 
                        <home>${catalina.home}</home>
                    <properties>
                            <cargo.tomcat.manager.url>https://yourhost/manager</cargo.tomcat.manager.url>
                            <cargo.remote.username>ManagerAdminLogin</cargo.remote.username>
                            <cargo.remote.password>ManagerAdminPassword</cargo.remote.password>
                        </properties>
                    </configuration>
                    <deployer>
                        <type>installed</type>
                        <deployables>
                            <deployable>
                                <groupId>com.waltercedric</groupId>
                                <artifactId>myapplication-web</artifactId>
                                <type>war</type>
                            </deployable>
                        </deployables>
                    </deployer>
                </configuration>
                <executions>
                    <execution>
                        <id>start-container</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>deployer-deploy</goal>
                            <!--  Only local containers can be started 
                            <goal>start</goal>
                            -->
                        </goals>
                    </execution>
                    <execution>
                        <id>stop-container</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>deployer-undeploy</goal>
                            <!--  Only local containers can be started 
                            <goal>stop</goal>
                            -->
                        </goals>
                    </execution>
                    <execution>
                        <id>verify-deploy</id>
                        <phase>install</phase>
                        <goals>
                            <goal>deployer-deploy</goal>
                        </goals>
                    </execution> 
                    <execution>
                        <id>clean-undeploy</id>
                        <phase>pre-clean</phase>
                        <goals>
                            <goal>deployer-undeploy</goal>
                            <!--  Only local containers can be started 
                            <goal>stop</goal>
                            -->
                        </goals>
                    </execution> 
    
                </executions>
            </plugin>
        </plugins>
    </build>

    Deploying to Tomcat running remotely

    The code slightly change:

    • You can NOT start and stop Tomcat running remotely, only deploy and un deploy your web application
    • ‘installed’ is replaced by ‘remote’
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <configuration>
                    <wait>true</wait>
                    <container>
                        <containerId>tomcat6x</containerId>
                        <type>remote</type>
                    </container>
                    <configuration>
                        <type>remote</type> 
                        <properties>
                            <cargo.tomcat.manager.url>https://yourhost/manager</cargo.tomcat.manager.url>
                            <cargo.remote.username>ManagerAdminLogin</cargo.remote.username>
                            <cargo.remote.password>ManagerAdminPassword</cargo.remote.password>
                        </properties>
                    </configuration>
                    <deployer>
                        <type>installed</type>
                        <deployables>
                            <deployable>
                                <groupId>com.waltercedric</groupId>
                                <artifactId>myapplication-web</artifactId>
                                <type>war</type>
                            </deployable>
                        </deployables>
                    </deployer>
                </configuration>
                <executions>
                    <execution>
                        <id>start-container</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>deployer-deploy</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>stop-container</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>deployer-undeploy</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>verify-deploy</id>
                        <phase>install</phase>
                        <goals>
                            <goal>deployer-deploy</goal>
                        </goals>
                    </execution> 
                    <execution>
                        <id>clean-undeploy</id>
                        <phase>pre-clean</phase>
                        <goals>
                            <goal>deployer-undeploy</goal>
                        </goals>
                    </execution> 
                </executions>
            </plugin>
        </plugins>
    </build>

    If you don’t want to let cargo deploy your web application artefact under the default name myapplication-web-0.0.1.SNAPSHOT.war, you can add the following to the deployable section of cargo

    <plugin>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-maven2-plugin</artifactId>
        <configuration>
            <deployer>
                <deployables>
                    <deployable>
                        <properties>
                            <context>mywebapp</context>
                        </properties>
                    </deployable>
                </deployables>
            </deployer>
        </configuration>
    </plugin>

    So you’ll be able to access your web application with http://localhost/mywebapp instead of http://localhost/myapplication-web-0.0.1.SNAPSHOT

    From now on, any phase higher than ’pre-integration-test’ will trigger the deployment to your web application to any tomcat, jboss or weblogic container. As a reminder, here are the major phase of Maven, You can put many of them just separate by a space in run as - goals

    • validate - validate the project is correct and all necessary information is available
    • generate-sources - generate any source code for inclusion in compilation
    • process-sources - process the source code, for example to filter any values
    • generate-resources - generate resources for inclusion in the package
    • process-resources - copy and process the resources into the destination directory, ready for packaging
    • compile - compile the source code of the project
    • process-classes - post-process the generated files from compilation, for example to do byte code enhancement on Java classes
    • generate-test-sources - generate any test source code for inclusion in compilation
    • process-test-sources - process the test source code, for example to filter any values
    • generate-test-resources - create resources for testing
    • process-test-resources - copy and process the resources into the test destination directory
    • test-compile - compile the test source code into the test destination directory
    • test - run tests using a suitable unit testing framework. These tests should not require the code be packaged or deployed
    • prepare-package - perform any operations necessary to prepare a package before the actual packaging.
    • package - take the compiled code and package it in its distributable format, such as a JAR
    • pre-integration-test - perform actions required before integration tests are executed. This may involve things such as setting up the required environment
    • integration-test - process and deploy the package if necessary into an environment where integration tests can be run
    • post-integration-test - perform actions required after integration tests have been executed. This may including cleaning up the environment
    • verify - run any checks to verify the package is valid and meets quality criteria
    • install - install the package into the local repository, for use as a dependency in other projects locally
    • deploy - done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects

    I recommend you also to use:

    • Maven profiles (triggered by environment, Linux, Windows, DEV, TEST, PROD)
    • Key value pair for sensitive data (login, password)
    • Key value pair for contextual data (URL’s of management console)

    All of these data can be saved in your Maven settings.xml or given by system variables at build time.

  • My platform of development is Suse 9.0 and Eclipse 3.0M4

    eclipse launcher (link)

    The best eclipse launcher available as today, written in smalltalk by my friends of www.xdreamteam.ch

    xdt Eclipse Launcher V1.0 RC2(761 KB) ist ein Tool für Java-Entwickler die mit Eclipse arbeiten.Mit dem xdt Eclipse Launcher verwalten Sie ihre Workspaces und können diese von einem Ort aus starten. Der xdt Eclipse Launcher startet als System-Tray Program, von wo Sie die Möglichkeit haben neue Definitionen einzutragen, oder die bestehenden Definitionen einfach und schnell zu starten.

    HP Nimius/E3 launcher

    Plugin for starting a HP Nimius application, Hewlett Packard Nimius informations can be found at www.hpnimius.com This plugin was originally developped at work, and has been totally rewritten to avoid any copyright infrigment.
    Why is the difference with a Eclipse Launcher? you have 3 icons...

    Installation:

    Prerequisite:
    This plugin assume that you are using a project for E3 which have the following structure (but you can change the default location of components):

         
    Project XXX/etc contains xml files, properties  
    Project XXX/log    
    Project XXX/lib contains applications E3 services and java code  

    Greetings:
    This plugin is based on Tomcat sysdeo plugin and was simply extended. Since the original code is based on the MIT licence, I am also giving you this code under the same conditions.

    The MIT Licence:
    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
    conditions:
    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

     

     

    Tutorials:

    http://www.awprofessional.com/articles/article.asp?p=31789&seqNum=1

    FAQ:

     

    Starting Tomcat in eclipse

    i get the following exceptions:

    2004-07-14 14:40:55,540 0 [main] ERROR org.apache.commons.digester.Digester - Digester.getParser:
    javax.xml.parsers.ParserConfigurationException: AElfred parser is namespace-aware
    at com.icl.saxon.aelfred.SAXParserFactoryImpl.newSAXParser(SAXParserFactoryImpl.java:37)
    at org.apache.commons.digester.Digester.getParser(Digester.java:686)
    at org.apache.commons.digester.Digester.getXMLReader(Digester.java:902)
    at org.apache.commons.digester.Digester.parse(Digester.java:1548)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:449)
    at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
    at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
    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:324)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203

     

    "With tomcat 4.x, things become simpler, but this version of tomcat uses the jaxp sax parser factory. Moreover, this version of tomcat requires a validating parser, and it doesn"t check whether the parser actually is validating. If the AElfred parser is supplied in the system properties, an exception will be thrown when tomcat attempts to set validating on. I"d recommend using the (validating) xerces 1.4.4 sax parser rather than AElfred parser. It"s not safe to rely on the default parser, by not setting system properties, because it"s very likely there are several versions of the JAXP classes in the classpath, and who knows when you might get another one. The practice by the distributors of XML tools to include implementations of the JAXP classes in their own jar files is, of course, rather insane, but that"s the way it is.

    Do this,
    System.setProperty("javax.xml.parsers.SAXParserFactory",
    "org.apache.xerces.jaxp.SAXParserFactoryImpl");=20
    but also do this
    System.setProperty("org.xml.parsers.sax.parser",
    "org.apache.xerces.parsers.SAXParser");=20
    since many third party tools base the parser choice on =
    "org.xml.parsers.sax.parser" rather than use the SAXParserFactory.

    Regards,
    Daniel Parker
    http://presentingxml.sourceforge.net/"

    in eclipse add the following key to the launcher in VM arguments

    -Djavax.xml.transform.TransformerFactory=com.icl.saxon.TransformerFactoryImpl -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
    -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
    -Dorg.xml.parsers.sax.parser=org.apache.xerces.parsers.SAXParser

     

     

     

  • We are working since 3 days on tuning a big application: 

    • Client server enterprise grade application,
    • Run on 2 JVM  with 4Gb (Tomcat/Application server) of RAM each!
    • Run on 2 Double core AMD 64 bits server,
    • Linux 64bits,
    • Has a lot of parallel users and > 10000 are registered
    • Use a product meta model which separate definition from implementation data.
    • Java server faces, java, ajax
     This application  is just consuming too much memory for the offline version. Our objective is to make that big application run

    • The same code as above,
    • In windows XP, 
    • IBM T40,  Intel Pentium M 1.6 GHz,  DDR266/PC2100
    • 1 JVM with 500Mb in Tomcat,
    • 1 GB of physical Ram,
    • 1 Desktop user who may run also Lotus Notes, Microsoft Office at the same time...
    There is already a lot of good resources and valuable advices on internet (Google is your friend :-)). Before digging in the code, and since the code is already productive,  we have done some tuning on component first.
    By tuning each components involved one after the other, this follow the principle: Lets do some quick win first before changing algorithm and increasing risk of breaking something....
    In order to back up each changes made with some statistics, the first step was to develop a testcase with Web Stress Tool(Commercial) but Apache JMETER (... replace with your favorite web testing tool) would have do the job

    At the OS Level

    by trying to convince the company to turn the anti virus off on some files and directory. They were scanning XHTML, javascript, XML, class files, images, so nearly everything... during EACH file access. Note the user has no windows right to alter files.


    MySQL 5(we are already using the latest 5.X branch by luck)

    By removing TCP database access and using name pipe only (+30 to +50% performances),

    By Installing MySQL Enterprise Advisor and Monitor. (You can request a free trial key here) and looking at what the advisor recommend. Attention this tool has been developed for monitoring servers, some recommendations are simply not always usable. In our case we are constrained by the memory, remember less than 500Mb, so we did not blindly follow advices. Basic stuff were done, like adding indexes (were it make sense to avoid full tables scan and reduce slow queries), increasing  buffers,

    By switching to myISAM (multi threaded with table locking) instead of innoDB (multi threaded with row locking), and also avoiding other storage engine to run with different algorithm to run in parallel..

    MyISAM is the default storage engine for the MySQL relational database management system. It is based on the older ISAM code but has many useful extensions. In recent MySQL versions, the InnoDB engine has widely started to replace MyISAM due to its support for transactions, referential integrity constraints, and higher concurrency.Each MyISAM table is stored on disk in three files. The files have names that begin with the table name and have an extension to indicate the file type. MySQL uses a .frm file to store the definition of the table, but this file is not a part of the MyISAM engine, but instead is a part of the server. The data file has a .MYD (MYData) extension. The index file has a .MYI (MYIndex) extension. [WikiPedia]

    InnoDB is a storage engine for MySQL, included as standard in all current binaries distributed by MySQL AB. Its main enhancement over other storage engines available for use with MySQL is ACID-compliant transaction support, similar to PostgreSQL, along with declarative referential integrity (foreign key support). InnoDB became a product of Oracle Corporation after their acquisition ofInnobase Oy, in October 2005. The software is dual licensed. It is distributed under the GNU General Public License, but can also be licensed to parties wishing to combine InnoDB in proprietary software. [WikiPedia]

    What are the differences, and you may want also to use myISAM for mono user applications...
    1. InnoDB recovers from a crash or other unexpected shutdown by replaying its logs. MyISAM must fully scan and repair or rebuild any indexes or possibly tables which had been updated but not fully flushed to disk. Since the InnoDB approach is approximately fixed time while the MyISAM time grows with the size of the data files, InnoDB offers greater perceived availability and reliability as database sizes grow.
    2. MyISAM relies on the operating system for caching reads and writes to the data rows while InnoDB does this within the engine itself, combining the row caches with the index caches. Dirty (changed) database pages are not immediately sent to the operating system to be written by InnoDB, which can make it substantially faster than MyISAM in some situations.
    3. InnoDB stores data rows physically in primary key order while MyISAM typically stores them mostly in the order in which they are added. This corresponds to the MS SQL Server feature of “Clustered Indexes” and the Oracle feature known as "index organized tables." When the primary key is selected to match the needs of common queries this can give a substantial performance benefit. For example, customer bank records might be grouped by customer in InnoDB but by transaction date with MyISAM, so InnoDB would likely require fewer disk seeks and less RAM to retrieve and cache a customer account history. On the other hand, inserting data in orders that differ substantially from primary key (PK) order will presumably require that InnoDB do a lot of reordering of data in order to get it into PK order. This places InnoDB at a slight disadvantage in that it does not permit insertion order based table structuring.
    4. InnoDB currently does not provide the compression and terse row formats provided by MyISAM, so both the disk and cache RAM required may be larger. A lower overhead format is available for MySQL 5.0, reducing overhead by about 20% and use of page compression is planned for a future version.
    5. When operating in fully ACID-compliant modes, InnoDB must do a flush to disk at least once per transaction, though it will combine flushes for inserts from multiple connections. For typical hard drives or arrays, this will impose a limit of about 200 update transactions per second. If you require higher transaction rates, disk controllers with write caching and battery backup will be required in order to maintain transactional integrity. InnoDB also offers several modes which reduce this effect, naturally leading to a loss of transactional integrity. MyISAM has none of this overhead, but only because it does not support transactions. [WikiPedia]
    For us the speed of myISAM is clearly balancing the drawback for a desktop applications.

    JSF tuning

    Obvious settings here:, JSF is lacking more fine tuning settings. Serialization is occurring during the model life cycle and consume memory and CPU. We may dig deeply later.
    • javax.faces.STATE_SAVING_METHOD to server
    • org.apache.myfaces.COMPRESS_STATE_IN_SESSIONto true since memory is the biggest constraint for us
    • org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION to 0
    • facelets.BUFFER_SIZE to 8192

    Tomcat tuning

    Nothing big can be done here...For me Tomcat is really missing a dynamic web application loader:  Tomcat is simply installing all applications found in /webapps at startup even if they are not used. They are never remove from memory or serialized to disk. Tomcat 4.1 seems to have a memory footprint of 22 Mb, going to the latest Tomcat 6.0 is a too big changes for us now, but we might reconsider it in the future. Removing java library which are not use from WEB-INF/libby trial and error can save some precious Bytes through as it is pretty common when you use frameworks to have jar not desired. For example: junit.jar, jdbc drivers, jms.jar,...Moving common lib to shared/lib may also help remove duplicate jars from webapps class loader and memory.


    JVM tuning

    Java 1.5 and java 1.6 have made a lot of progress, and the JIT compiler found in JAVA 1.5/1.6 is getting  more and more aggressive...The basic rule is to turn the GC JVM log on (by adding -Xloggc:<file> [-XX:+PrintGCDetails]) and analyze it offline with a tool like GCViewer (free). The JIT is doing a pretty good job as the application run more and more faster with the time, but it is just a feeling ;-)
    By analyzing the GC logs we were able to optimize and avoid big mis configurations mistakes, one more time a lot of articles and books are available on how to tune a JVM. Sadly java has no advisor at the moment or is not using genetic algorithms to tune itself...It remains a dream for now.

    By using an empiric approach, which means:
    1 changing JVM parameters -> running test cases ->deciding if we give CPU away or minimize RAM usage -> go back to 1

    We come down to the following  exotic parameters (Xms and Xmx are not of any help since it is really depending on your application and how memory is managed internally)

     -XX:+AggressiveOpts -XX:-UseConcMarkSweepGC

    By the way I use them in Eclipse + JDK 1.6 since months. This page A Collection of JVM Options compiled by: Joseph D. Mocker (Sun Microsystems, Inc.) has been of a great help during this stage.

    Still not enough, we were forced to profile the java code and make some big changes....
  • 2742514705_fe8fd07b14

    JIRA is a proprietary enterprise software product, developed by Atlassian, commonly used for bug tracking, issue tracking, and project management. JIRA is widely deployed within public open source projects and has over 12,000 customers in over 100 countries.

    Visit my JIRA instance at http://bugs.waltercedric.com or http://jira.waltercedric.com&160;

    This is now officially my new Tracker. (Thanks to Atlassian for giving me an open source license)

    &160;

    &160;

    Installation

    Better run these webapps with their own user for more security…

    # groupadd jira
    # useradd -g jira-c 'user for jira’ -m jira

    # su – jira

    Get the latest versions of the software

    # wgethttp://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-enterprise-3.13.3-standalone.tar.gz

    Unpack archive

    # tar xvf atlassian-jira-enterprise-3.13.3-standalone.tar.gz

    Define port

    JIRA is shipped with a Tomcat instance, I slightly modify it as OpenSuse is already using a Tomcat that may be running (HTTP 8080- Admin 8005 – AJP 8009)

    Worker.properties

    Now I tell apache that there is a new AJP waiting on port 8020

    # vi /etc/apache/worker.properties

    worker.list=ajp13, teamcity, jira
    worker.ajp13.port=8009
    worker.ajp13.host=localhost
    worker.ajp13.type=ajp13

    worker.teamcity.port=8010
    worker.teamcity.host=localhost
    worker.teamcity.type=ajp13

    worker.jira.port=8020
    worker.jira.host=localhost
    worker.jira.type=ajp13

    # rcapache2 restart

    # netstat –an | grep 8020

    Plesk

    Add&160; 2 new sub domains, I have defined

    Virtual host

    create 2 vhost.conf files

    • /srv/www/vhosts/waltercedric.com/subdomains/jira/conf/vhost.conf
    • /srv/www/vhosts/waltercedric.com/subdomains/bugs/conf/vhost.conf

    # vi /srv/www/vhosts/waltercedric.com/subdomains/bugs/conf/vhost.conf

    ServerName bugs.waltercedric.com

    ProxyPass /&160; ajp://bugs.waltercedric.com:8020/
    <Proxy *>
    &160;&160; Order Allow,Deny
    &160;&160; Allow from all
    </Proxy>

    <Directory />
    &160; Options FollowSymLinks
    &160; AllowOverride None
    </Directory>

    # vi /srv/www/vhosts/waltercedric.com/subdomains/jira/conf/vhost.conf

    ServerName jira.waltercedric.com

    ProxyPass /&160; ajp://jira.waltercedric.com:8020/
    <Proxy *>
    &160;&160; Order Allow,Deny
    &160;&160; Allow from all
    </Proxy>

    <Directory />
    &160; Options FollowSymLinks
    &160; AllowOverride None
    </Directory>

    To reread and include overridden vhost.conf, and tell plesk that you have create new vhost.conf, run at least once&160;
    # /usr/local/psa/admin/sbin/websrvmng

    Restart now apache

    # rcapache2 restart

    Change file to use MYSQL instead of HSQLDB

    # vi /home/jira/atlassian-jira-enterprise-xxxxx-standalone/atlassian-jira/WEB-INF/classes/entityengine.xml

    <datasource name="defaultDS" field-type-name="mysql"
    &160; helper-class="org.ofbiz.core.entity.GenericHelperDAO"
    &160; check-on-start="true"
    &160; use-foreign-keys="false"
    &160; use-foreign-key-indices="false"
    &160; check-fks-on-start="false"
    &160; check-fk-indices-on-start="false"
    &160; add-missing-on-start="true"
    &160; check-indices-on-start="true">
    &160;&160;&160; <jndi-jdbc jndi-server-name="default" jndi-name="java:comp/env/jdbc/JiraDS"/>

    Edit server.xml at

    # vi /home/jira/atlassian-jira-enterprise-xxxxx-standalone/conf/server.xml

    and add the new data source

    <Engine name="Catalina" defaultHost="localhost">
    &160;&160;&160;&160;&160; <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">

    &160;&160;&160;&160;&160;&160;&160; <Context path="" docBase="${catalina.home}/atlassian-jira" reloadable="false">
    &160;&160;&160;&160;&160;&160;&160;&160;&160; <Resource name="jdbc/JiraDS" auth="Container" type="javax.sql.DataSource"
    &160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; username="myuser"
    &160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; password="itspassword"
    &160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; driverClassName="com.mysql.jdbc.Driver"&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;
    &160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; url="jdbc:mysql://localhost/dbschema?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=UTF8"&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;
    &160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; maxActive="20"
    &160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; validationQuery="select 1" />

    Unpack MYSQL driver

    only the jar from this zip http://dev.mysql.com/downloads/connector/j/5.1.html) to /home/jira/atlassian-jira-enterprise-xxxxx-standalone/common/lib

    Start JIRA

    # /home/jira/atlassian-jira-enterprise-3.13.3-standalone/bin/startup.sh

  • subversion_logo-384x332 geeko plesk.logo Subversion (SVN) is an open source version control system. It allows users to keep track of changes made over time to any type of electronic data. Typical uses are versioning source code, web pages or design documents.

    I now host my own private subversion at http://svn.waltercedric.com

    A required step to be able to build some small project and finish the prototype of Continuous build for Joomla!