Speeding up JBoss 5 applicaiton deployment

I've mentioned before the trick of turning off the AOP scanner to quicken deployment, but I've found another way, that I like a lot better.

The delays in starting up are worst for CF apps, because they've got so many classes, and so you may have noticed that the more classes you've saved, the longer it takes.

For a while I had a script that cleared out the cfclasses folder before each start, but that was soooo hackish. More of a kludge, actually. Fine for development tho.

I've found that if you use a jboss-structure.xml file in your META-INF (I put it in my ear/META-INF), jboss will use it to determine what and where to deploy stuff, along with class paths and whatnot. This disables the recursive scanning jboss normally does, and makes startup times acceptable again.

Example 1 (ear file with libs in each war):

<structure>

    <context>
        <path name="railo.war" />
        <metaDataPath>
            <path name="WEB-INF" />
        </metaDataPath>
        <classpath>
            <path name="/railo.war/WEB-INF/lib" suffixes=".jar" />
        </classpath>
    </context>

</structure>

Example 2 (ear file with consolidated libs folder):

<structure>

    <context>
        <path name="widgets.war" />
        <metaDataPath>
            <path name="WEB-INF" />
        </metaDataPath>
        <classpath>
            <path name="/lib" suffixes=".jar" />
        </classpath>
    </context>

    <context>
        <path name="sprockets.war" />
        <metaDataPath>
            <path name="WEB-INF" />
        </metaDataPath>
        <classpath>
            <path name="/lib" suffixes=".jar" />
        </classpath>
    </context>

</structure>

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Rich's Gravatar Thanks for the post, it's extremely difficult to find information on this particular topic. How much of a startup time improvement did you see after creating this descriptor? I'm having trouble creating one that will work for our app. Did you find any particular pages that described jboss-structure.xml and were helpful?
# Posted By Rich | 10/2/09 1:14 PM
coldshen's Gravatar Wow. Sorry for taking so long to respond to this comment.

I had to use the structure xml file again not too long ago to do something else. I need to update this post and if I can make the time, add a new one for the other stuff.

The documentation was, not much available, agreed. If I remember right, I actually looked at the sources for some stuff.

I saw a huge increase in startup time, back then. Easily 20-30 seconds less. I had oodles of compiled cfsources at the time, so it was pretty blatant.

I have been using jetty to develop locally, and deploying on JBoss remotely for the most part lately, but I think JBoss might now default some stuff to "off", that they used to default to "on".
# Posted By coldshen | 8/4/10 1:14 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.3.000. Contact Blog Owner