Archive

Archive for September, 2009

How to alter JBoss deployment order

September 17, 2009 Leave a comment

If one application depends on another one  — you may want to alter the deployment order of JBoss.

1. One way to accomplish this is to change the order in the ${serverconfig}/conf/xmdesc/org.jboss.deployment.MainDeployer-xmbean.xml file.

<attribute access=’read-write’ setMethod=’setEnhancedSuffixOrder’ getMethod=’getEnhancedSuffixOrder’>
   <description>Allows the override of the suffix order declared by subdeployers, using the syntax [order:]suffix
   </description>
   <name>EnhancedSuffixOrder</name>
   <type>[Ljava.lang.String;</type>
   <descriptors>
      <value value=”250:.rar,300:-ds.xml,400:.jar,500:.war,550:.jse,650:.ear,800:.bsh”/>
   </descriptors>
</attribute>

2. One way to accomplish this is to create a deploy.last directory inside the deploy directory and put the application that needs to be deployed after the other in the deploy.last directory.

Another one is to modify ${serverconfig}/conf.xmdesc/org.jboss.deployment.MainDeployer-xmbean.xml
and add your application before the othes in the EnhancedSuffixOrder list.

<attribute access=’read-write’ setMethod=’setEnhancedSuffixOrder’ getMethod=’getEnhancedSuffixOrder’>
   <description>Allows the override of the suffix order declared by subdeployers, using the syntax [order:]suffix
   </description>
   <name>EnhancedSuffixOrder</name>
   <type>[Ljava.lang.String;</type>
   <descriptors>
      <value value=”250:.rar,300:-ds.xml,400:.jar,500:.war,550:.jse,600:mynewapp.ear,650:.ear,800:.bsh”/>
   </descriptors>
</attribute>

Advertisements
Categories: Uncategorized Tags: ,

how to configure a startup class for a web application in Tomcat

September 17, 2009 Leave a comment

In this tutorial you will learn how to configure a startup class for a web application in Tomcat 5.5.x or Tomcat 6.

Step 1:Let us assume Tomcat is installed in C:\tomcat. Let us assume you want to define a startup class for a web application named reminder. Navigate to C:\tomcat\webapps\reminder\WEB-INF and open the file web.xml. Configure the startup class ApplicationStartUpListener under the package com.corelabs as in the screen shot below.

<web-app>
          <listener>
            <listener-class>com.corelabs.ApplicationStartUpListener</listener-class>
        </listener>

 Step 2: The startup class ApplicationStartUpListener should follow certain rules like implementing javax.servlet.ServletContextListener. The Java source of the ApplicationStartUpListener is provided in the below screen shot.

package com.corelabs;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.apache.log4j.Logger;

/**
 * @author ramb
 */
public class ApplicationStartUpListener implements ServletContextListener {

    private static final Logger log = Logger.getLogger(ApplicationStartUpListener.class);
    private ServletContext context = null;

    public ApplicationStartUpListener() {
    }

    public void contextInitialized(ServletContextEvent event) {
  //Do Something you wish when application is loaded.
    }

    public void contextDestroyed(ServletContextEvent event) {
        this.context = null;
    }
}

Categories: Java