Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7984337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:14:18+00:00 2026-06-04T11:14:18+00:00

Suppose I have two web apps to deploy in Tomcat 6, packed as, let

  • 0

Suppose I have two web apps to deploy in Tomcat 6, packed as, let us say, A.war and B.war. Is there a way to force Tomcat, when restarting, to:

  • load B before A? or
  • load A after everything else? or
  • make A loadable only after B is loaded – that is, make B a dependency of A?

These are the questions. Below comes a background that may be too complex but also very useful.

Background

I am trying to deploy some portlets in Liferay. These portlets are legacy code made by people who did not knew a lot about how Liferay works and made, let us say, “amazing” decisions, such as to map Liferay Service Builder entity tables to new classes. This does not come too much in case, actually, but someone who knows Liferay may understand my point a bit better.

These portlets are seamed by Spring and mapped to database by Hibernate. To avoid the annoying requirement of editing context.xml (which is tiresome, error prone, easily forgettable, makes the persistence layer slow as hell etc.) I provided the Liferay datasource as a new bean…

<bean id="liferayDataSource" 
    class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy">
    <property name="targetDataSource">
        <bean
            class="com.liferay.portal.kernel.util.InfrastructureUtil"
            factory-method="getDataSource" />
    </property>
</bean>

…and used this new bean as the datasource of the Entity Manager Factory:

<bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="liferayDataSource"/>
    <property name="persistenceUnitName" value="liferay-db" />
</bean>

If I have the Liferay running and I deploy my portlets, it runs without problem because the Liferay resources are already available. The problem is, when I restart Liferay these portlets are loaded before the Liferay app going up, so the InfrastructureUtil class is not even loaded yet. So, I want to postpone the loading of the portlets.

I noted that each application has a directory under $CATALINA_HOME/temp/, usually called something like 0-this-annoying-portlet, 2-that-weird-portlet etc. I believe the number at the beginning is what determines the order, since it forces an alphabetical sorting of applications. Is that true? Can I set this number?

Of course, I am receptive to any solution but I am really curious about the possibilities of defining an ordering of application loading in Tomcat.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T11:14:20+00:00Added an answer on June 4, 2026 at 11:14 am

    The problem was that, in the Liferay 6.0 SP2 bundle, Tomcat was deploying an XML context file for each portlet. So when I deployed my annoying-portlet, a $TOMCAT/conf/Catalina/localhost/annoying-portlet.xml file is created. When Tomcat is restarted, these XML context files are read, the respective projects are loaded (incidentally in alphabetical order) and the portlet is started before Liferay, whose context name is ROOT.

    As @MarceloBezerra first link made clear, the $TOMCAT/conf/Catalina/localhost/annoying-portlet.xml will have precedence (in the sense that all contexts with a file in $TOMCAT/conf/Catalina/localhost/ will be loaded before the contexts which just has a directory in $TOMCAT/webapps. The solution is to inhibit the deployment of the $TOMCAT/conf/Catalina/localhost/annoying-portlet.xml file.

    How to do it? Well, after some time talking to the Liferay great staff, they discovered that the context XML deployment can be inhibited by adding a deployXML="false" attribute to the Host element from $TOMCAT_HOME/conf/server.xml:

    <Host autoDeploy="true" 
        appBase="webapps" name="localhost" unpackWARs="true" 
        xmlNamespaceAware="false" xmlValidation="false">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose you have two linked servers called Local and Remote respectively. Is there a
I have a question about the architecture of a backbone.js web app. Let's say
Suppose you have two seperate ASP.NET Web Application projects that both need to use
Suppose I have two comboboxes. One for the lower-value and one for the upper
Suppose I have two arrays: a = [1, 2, 3, 4] b = [5,
Suppose I have two .NET DataTables populated as follows, where ID is the primary
Suppose I have two classes that both contain a static variable, XmlTag. The second
Suppose I have two tables that are linked (one has a foreign key to
Suppose I have two fingers touching iPhone's screen but just one is moving. TouchesMoved
Suppose I have two XML files. First XML File: <?xml version=1.0?> <AccessRequest xml:lang=en-US> <AccessLicenseNumber>Your_License</AccessLicenseNumber>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.