7 Replies Latest reply: Jun 8, 2011 4:07 PM by jsoye RSS

explode via maven to JBoss 6 and Glassfish 3.1

Kevin Sapper Newbie

Hi Guys,


I just created a new JEE 6 project scaffold using seam forge. Adding the seam 3 dependencies was really painless. But then I stumbled across a problem. How do I explode my project to JBoss 6 or Glassfish 3.1? Does anyone has a maven explode configuration for either one of these servers?


Br//Kevin

  • 1. Re: explode via maven to JBoss 6 and Glassfish 3.1
    Jason Porter Master

    Sounds like a feature is needed, at the very least in the docs. Please file.

  • 2. Re: explode via maven to JBoss 6 and Glassfish 3.1
    Kevin Sapper Newbie

    A documentation would be really nice as first step.

    I created a forge issue SEAMFORGE-193 to add such functionality to the pom.xml during the projects scaffold creation.

  • 3. Re: explode via maven to JBoss 6 and Glassfish 3.1
    mimik789 Newbie
    I have such working maven configuration for gf3.1 with exploded war.
    to deploy I use:
    mvn compile war:exploded glassfish:deploy
    to re-deploy I use:
    mvn compile war:exploded glassfish:redeploy

    This needed changes in maven-glassfish-plugin to make it works with new glassfishes V3.1. The plugin uses glassfish REST admin api to deploy - which require enabling security for glassfish v 3.1 (at least I don't know how to use gf REST api without securing access), so you need to:
    asadmin change-admin-password
    asadmin enable-secure-admin

    But then org.glassfish.maven.plugin:maven-glassfish-plugin:2.2 is too old for gf 3.1, and don't have possibility to speak to SSL secured gf REST api - that required to fix/implement this feature in the plugin - which I made successful.

    **only for remote expoded deployment - scenario - win (dev workst.) to unix (server) - filesystem path missmatch***
    Lastly to allow deploying war exploded webapps on remote gf 3.1 (from windows devs workstation) to unix/linux (I use remote gf instance running in opensolaris host) there was need to fix mentioned maven gf plugin and gf module:
    org.glassfish.admin:admin-util (which maven-glassfish-plugin uses locally on dev workstation to deploy to remote server).
    so i added 'remoteArtifact' property to maven-glassfish-plugin under
    <components>
      <component>
      <remoteArtifact>[remote]/mnt/developer_workspaces_dt/aw-web/target/aw-web</remoteArtifact>
      ..
      <component>
    </components>

    and made sure that gf's admin-util recognizes path value prefixed with [remote] as string (not as a File - as default without my modification - file not found exception or similar was thrown)  and correctly passes it to REST api - so remote unix gf receives valid existing path (btw - nfs mounted from win host) '/mnt/developer_workspaces_dt/aw-web/target/aw-web'.

    I'm sharing my modified org.glassfish.maven.plugin:maven-glassfish-plugin:2.2-dt-SNAPSHOT mvn profiles
    #local mvn deployment of exploded war to gf 3.1
    http://pastebin.com/pKazqqkD
    #remote mvn deployment of exploded war to gf 3.1
    http://pastebin.com/TYhgFeif

    ps
    I can provide sources of the 2 plugins If requested (eg. attach zips to SEAMFORGE-193)
  • 4. Re: explode via maven to JBoss 6 and Glassfish 3.1
    mimik789 Newbie

    I wrote:



    (which maven-glassfish-plugin uses locally on dev workstation to deploy to remote server).


    of course maven-glassfish-plugin uses asadmin utility locally (which uses org.glassfish.admin:admin-util)

  • 5. Re: explode via maven to JBoss 6 and Glassfish 3.1
    Kevin Sapper Newbie

    That looks really nice, I'll try it as soon as I get the change.

  • 6. Re: explode via maven to JBoss 6 and Glassfish 3.1
    elfuhrer Novice

    You could as well write your own ant tasks and embed them within maven for that purpose, you could use as well multiple profile for application server specific configurations

  • 7. Re: explode via maven to JBoss 6 and Glassfish 3.1
    jsoye Newbie
    Hi. I've just started Seam 3 myself and was wondering the same. I was a Netbeans & Glassfish user, but getting the seam-booking example running on GF didn't work for me (and I couldn't figure out the error), but it worked ok on JBoss. That was just deploying the WAR to the application server.

    To get it hot deployed, I had to switch from Netbeans back to Eclipse (Helios is what I'm using). Install JBoss Tools Plugin (to get JBoss AS 6 adaptor) and from the "Help | Eclipse Marketplace...| Popular tab" install Maven Integration for Eclipse (i.e. m2eclipse).

    Next, import 'seam-booking' for example, by selecting File | Import...| Maven | Existing Maven Projects and choosing the 'seam-booking' project.

    Add your JBoss 6 server by right-clicking on the empty space in the Server tab. Once set up, right-click on the JBoss Server you just added in the Servers tab and click on "Add and Remove...". You want to add your project here, i.e. 'seam-booking'. By doing this, you can now right-click on the project (in Project Explorer) and select "Run As | Run On Server". Make sure you've copied the booking-ds.xml into your JBoss deploy directory.

    That should be it. Once it runs, and you see it running in your browser, open "home.xhtml", say, and change the heading to your own. Hit save, watch the Eclipse messages briefly say "building ... publishing to JBoss" and refresh your browser to see the change.

    I don't know how to do this in Netbeans and you'll need to restart the server for java files, but it's a start. I'll give what Dominik mentioned above a try once I get up to speed with maven.

    I was wondering how everyone else develops in Seam3. Am I off the track? Is there a POM profile that someone could maybe post, to incorporate all of the WAR files exploded onto JBoss (or Glassfish). I think writing one at this stage is beyond me. A bit more reading first required :-(