Re: JBoss WAR deployment

From: Pierre Bernard (webobjects-list..oudah.com)
Date: Thu Mar 23 2006 - 03:25:49 EST

  • Next message: manumohedan..sal.es: "Problems installing WOLips"

    Forgot to mention:

    You need to add JavaWOJSPServlet.framework to your project.

    Pierre

    On Mar 21, 2006, at 10:09 AM, Pierre Bernard wrote:

    > Hi!
    >
    > I just slaved days over getting Eclipse/WOLips to generate a WAR to
    > JBoss' liking.
    >
    > Somehow the out-of-the-box WAR support in WOLips seems very broken.
    > I ended up rewriting much of the involved Ant targets. Furthermore
    > I had to patch the generated web.xml to get a classpath that
    > NSBundle can work with.
    >
    > First, I had to add additional arguments to the WOApplication task:
    >
    > <woapplication name="${project.name}" stdFrameworks="false"
    > destDir="${dest.dir}"
    > customInfoPListContent="${customInfoPListContent}"
    > principalClass="${principalClass}"
    > webXML="${webXML}"
    > webXML_CustomContent="${webXML_CustomContent}"
    > webXML_WOAINSTALLROOT="/tmp/${project.name}.dst/Library/
    > WebObjects/Applications/"
    > webXML_WOtaglib="WOtaglib_1_0.tld"
    > webXML_WOAppMode="Development">
    >
    > ...
    >
    > <frameworks root="${wo.wosystemroot}" embed="true">
    > <patternset>
    > <includesfile name="woproject/ant.frameworks.wo.wosystemroot"/>
    > </patternset>
    > </frameworks>
    > <frameworks root="${wo.wolocalroot}" embed="true">
    > <patternset>
    > <includesfile name="woproject/ant.frameworks.wo.wolocalroot"/>
    > </patternset>
    > </frameworks>
    > <frameworks root="${user.home}" embed="true">
    > <patternset>
    > <includesfile name="woproject/ant.frameworks.user.home"/>
    > </patternset>
    > </frameworks>
    >
    > ...
    >
    > </woapplication>
    >
    > I modified the ssdd target as follows:
    >
    > <target name="ssdd">
    > <mkdir dir="${dest.dir}/${project.name}/WEB-INF/tlds"/>
    > <copy todir="${dest.dir}/${project.name}/WEB-INF/">
    > <fileset dir="${dest.dir}/${project.name}.woa/Contents/">
    > <include name="web.xml"/>
    > </fileset>
    > </copy>
    > <copy todir="${dest.dir}/${project.name}/WEB-INF/">
    > <fileset dir=".">
    > <include name="LICENSE"/>
    > </fileset>
    > </copy>
    > <copy todir="${dest.dir}/${project.name}/WEB-INF/">
    > <fileset dir="${dest.dir}">
    > <include name="${project.name}.woa/**"/>
    > </fileset>
    > </copy>
    > <copy todir="${dest.dir}/${project.name}/WEB-INF">
    > <fileset dir="${dest.dir}/${project.name}.woa/Contents">
    > <include name="Frameworks/**"/>
    > <include name="Resources/**"/>
    > </fileset>
    > </copy>
    > <copy todir="${dest.dir}/${project.name}/WEB-INF/lib">
    > <fileset dir="${dest.dir}/${project.name}/WEB-INF">
    > <include name="**/Resources/**/*.jar"/>
    > </fileset>
    > <flattenmapper />
    > </copy>
    > <copy todir="${dest.dir}/${project.name}/WEB-INF/lib">
    > <fileset dir="/Library/WebObjects/Extensions">
    > <include name="*.jar"/>
    > <exclude name="servlet.jar"/>
    > </fileset>
    > <flattenmapper />
    > </copy>
    > <copy todir="${dest.dir}/${project.name}/WEB-INF/tlds">
    > <fileset dir="${wo.wosystemroot}/Library/Frameworks/
    > JavaWOJSPServlet.framework/Resources/">
    > <include name="WOtaglib_1_0.tld"/>
    > </fileset>
    > </copy>
    > <fixcrlf srcdir="${dest.dir}/${project.name}/WEB-INF/" eol="unix"
    > includes="web.xml" />
    > <patch originalfile="${dest.dir}/${project.name}/WEB-INF/web.xml"
    > patchfile="web.diff" ignorewhitespace="true"/>
    > </target>
    >
    > The last two steps patch the classpath. First we neet to strip Mac
    > line endings for the patch task to work. The patch file looks like
    > this:
    >
    > 75c75,77
    > < WEBINFROOT/Resources/Java/
    > ---
    > >
    > > WEBINFROOT/HelloWorld.woa/Contents/Resources/Java/helloworld.jar
    > >
    > 84d85
    > < WEBINFROOT/Resources/Java/helloworld.jar
    >
    > BTW, having to work with a patch file is UGLY. I guess WOLips
    > should be updated to generate a valid classpath.
    >
    > This changes the way we refer to the main JAR in a way that allows
    > NSBundle to recognize it as a bundle.
    >
    > The WAR target could be greatly simplified by basing the WAR off
    > the SSDD:
    >
    > <target name="war" depends="ssdd">
    > <war destfile="${dest.dir}/${project.name}.war" webxml="$
    > {dest.dir}/${project.name}/WEB-INF/web.xml" basedir="${dest.dir}/$
    > {project.name}">
    > <lib dir="${wo.wosystemroot}/Library/Frameworks/
    > JavaWOJSPServlet.framework/WebServerResources/Java/">
    > <include name="JavaWOJSPServlet_client.jar"/>
    > </lib>
    > </war>
    > <copy todir="/tmp/${project.name}.dst/Library/WebObjects/
    > Applications/">
    > <fileset dir="${dest.dir}">
    > <include name="${project.name}.woa/**"/>
    > </fileset>
    > </copy>
    > </target>
    >
    > All this buys me a self-contained WAR file with all frameworks
    > embedded. This WAR works fine on JBoss 4.
    >
    > Pierre.



    This archive was generated by hypermail 2.0.0 : Thu Mar 23 2006 - 03:25:59 EST