8 Replies Latest reply on Jan 20, 2007 2:46 PM by tvrtko

    Lazy mans guide to developing SEAM!

    tony.herstell1

      The examples in other posts are ant-build-deploy based... including how to connect to a running server "somewhere ourside the IDE" - e.g. a Live/Pre Production Server.

      For developement you probably don't want to do that! If you have a Good IDE why not use it?

      I generally work alone on projects so time is king!


      So, call me very sad but I could not stand the time taked to ant build/redeploy each time I made a tiny change !!! so I bothered to set up a J2EE project in MYEclipse comprising of three parts:
      xxxx.ear
      xxxx.jar
      xxxx.war

      I then ripped apart a war created for the booking example (from Ant) and kept fiddling until I finally got the right Jars/Code in the right areas (ear, jar and war) that matched the WAR. (I can supply this!)

      I then told MyEclipse to "deploy as exploded" to my JBoss server; which creates a directory in the JBoss Deploy area called xxx.ear and puts your "real" code in there... unarchived! NEAT!

      I then just run the JBoss server from INSIDE MyEclipse with one button click and generally when I change code/xhtml I don't even have to redeploy/restart the server; it just works... and I can also set breakpoints etc. (might have to close the browser to clear the browsers cache of .css and .xhtml though!)

      All your output from the server, including your logging statements, is in the MyEclipse console and you just set breakpoints in your code and it works! none of this fiddling with Jboss config etc.

      Set your log statements to info to see them in the console (the easy option as JBoss logs by default to info I guess) or else do some fiddling in the Jboss Logger Config XML file (cant remember the name) to either:
      1. change the default outputter to log at the level of debug (you get a lot of debug info from everywhere including the JBoss server itself! some of it quite interesting and amusing!)
      OR (the geek solution)
      2. add a outputter for your project that outputs your applications packages logging (xxx.xxxx.xxxx.xxx) at the debug level. - See a Geek for how to do this or RTFM from JBoss as it should be in there!

      Now, if you change the code too much (i.e. change an interface) then you get MyEclipse reporting (on behalf of JBoss) that it can't manage the change and you are offered the option to terminate the server; which I generally do; and then re-start it (again one-click from inside MyEclipse).

      Finally, when I have to, I write an ant script for other people ! (Not actually done one yet and been working this project for weeks!!!)

      NOTE: MyEclipse is SUPPOSED to deploy as an WAR archive as well as exploded but I never get a valid war !!! as the application.xml gets munged...(e.g. <web-uri>risingstars.war.war</web-uri>). This is a shame as then I would only have to writer an Ant script at the VERY VERY end to get rid of some Jars I dont need deployed (the test ones) but I think I may be able to fiddle around more and have "dependent" projects in MyEclipse to get round this e.g. xxxx._testing.ear. (NOte to self - RTFM in MyEclipse as I can't 'NOT' deploy a jar file from my project to the exploded or archived project).

      Not bad for a tool that really doesn't even support SEAM/EJB3.


      If you go this route make sure you do this:
      Under xxxx.ear go into properties
      Under EAR check the option for
      "Do No Modify 'application.xml' (I will manually manage it)"
      as it gets it wrong!


      SEAM + IceFaces Related stuff:

      I seem to have ended up with the same jars in some/all parts of the project! seems to still work ok though.

      You seem to have to add your icefaces jars to the application.xml

      <application>
       <display-name>risingstars</display-name>
      
       <module>
       <web>
       <web-uri>risingstars.war</web-uri>
       <context-root>/risingstars</context-root>
       </web>
       </module>
       <module>
       <ejb>risingstars.jar</ejb>
       </module>
       <module>
       <java>jboss-seam.jar</java>
       </module>
       <module>
       <java>icefaces.jar</java>
       </module>
       <module>
       <java>icefaces-comps.jar</java>
       </module>
      </application>
      

      And if you have to use IceFaces table etc. then dont forget to open this file:
      C:\Program Files\jboss-4.0.5.GA\server\default\deploy\jbossweb-tomcat55.sar\META-INF\jboss-service.xml and alter this line:
      true
      and no, I don't know why.

      MyEclipse are looking to add in EJB3 support and possibly Seam support but that depends on the support from JBoss Seam Team I guess and they may not want to take this "inside the IDE approach". I can only hope the MyEclipse Devs talk to Gavin or Michael.

      Hope this helps.

        • 1. Re: Lazy mans guide to developing SEAM!
          tony.herstell1

          From MyEclipse Forum


          Posted: Jan 09, 2007 - 11:24 AM Reply with quote Back to top
          First let me thank you for this, fantastic guide and a lot of users are going to appreciate this. I'm moving this ot the Documentation forum so folks can find it.

          Now to address a few things you mentioned:

          Quote:

          NOTE: MyEclipse is SUPPOSED to deploy as an WAR archive as well as exploded but I never get a valid war !!! as the application.xml gets munged...(e.g. <web-uri>risingstars.war.war</web-uri>).

          Is your project named with a dot in the name? That would be screwing up the deployment...

          Quote:

          (NOte to self - RTFM in MyEclipse as I can't 'NOT' deploy a jar file from my project to the exploded or archived project).

          Deployment filtering is comming soon, I promise! :)

          _________________
          Riyad
          MyEclipse Support
          Please do us a big favor and remember to vote for MyEclipse at the
          JDJ Reader's Choice
          Awards. We really appreciate it!


          Even more good news from the MyEclipse guys.

          • 2. Re: Lazy mans guide to developing SEAM!
            tony.herstell1

            Update

            Don't have a . (dot) in your MyEclipse projects:
            xxxx.ear
            xxxx.jar
            xxxx.war

            should be
            xxxx
            xxxx_jar
            xxxx_war

            and then you can deploy a .ear file directly to your server from MyEclipse (thanks MyEclipse guys).

            making your xxx
            META-INF
            application.xml

            <application>
             <display-name>xxxx</display-name>
            
             <module>
             <web>
             <web-uri>xxxx_war.war</web-uri>
             <context-root>/xxxx</context-root>
             </web>
             </module>
             <module>
             <ejb>xxxx_jar.jar</ejb>
             </module>
             <module>
             <java>jboss-seam.jar</java>
             </module>
             <module>
             <java>icefaces.jar</java>
             </module>
             <module>
             <java>icefaces-comps.jar</java>
             </module>
            </application>
            


            Also, allegedly, filtered deployment is COMING SOON to MyEclipse (so you don't deploy your test .jars to your archive!)

            • 3. Re: Lazy mans guide to developing SEAM!

              Well, I don't know why you actually chose to create your project out of one of those examples.
              And maybe I don't completely get your point here (had a couple beers earlier)...
              ...but I think what you made and what you want to provide an Ant script for can be easily done by executing seam-gen's project generator. You end up with a wonderful structured easy to understand ant build file which deploys the project as exploded ear to your Jboss. Even project files for eclipse, nb (and soon IntelliJ) are being generated. I further made for myself a modified version of that build script, which enables you to deploy the same project as "icefaces-enabled" in order to compare the two "faces" and easily switch back... very sweet ;)

              I hope I didn't get you wrong, but I think there are easier ways to accomplish an exploded deployment.

              Good nite... :)

              • 4. Re: Lazy mans guide to developing SEAM!
                perwik

                What I'd like to get from seam-gen is the "run jboss in eclipse" scenario described by the OP. When I create a project with seam-gen I can use ant to deploy an .ear or deploy exploded, but that's all done outside of eclipse so I don't get the breakpoints and there are no instant updates without running "ant explode".
                Am I missing something in my usage of seam-gen or is it not possible?

                • 5. Re: Lazy mans guide to developing SEAM!
                  tony.herstell1

                  As Far as I know you are not missing anything.

                  Ant is the common ground.

                  Everyone can use ANT; even the command line commandoes so thats why is the default.

                  Gavin Uses Net Beans as his IDE.
                  I dont know what Gavin Uses.

                  But in my experience 99% of people just use their IDE's as editors and use ANT for deploying etc. and NOT as shown above. Which sort of defeats the point!

                  I will try to get this project I am fiddling with further and then supply it for inclusion on the wiki as a "MyEclipse" project. (Seam: Facelets (so xhtml and including templates, includes and even parameters!), IceFaces (partialsubmit, sorted (i.e. click the columns) paged datatable... so far) EJB3).

                  ;)

                  p.s. Not a sales pitch but you can try MyEclipse for free for 3 months!

                  • 6. Re: Lazy mans guide to developing SEAM!
                    tvrtko

                    Is there any difference between MyEclipse and plain eclipse + jboss IDE in regard with deployment and all this stuff that you are writing about.

                    Can I do this kind of deployment with plain eclipse?

                    • 7. Re: Lazy mans guide to developing SEAM!
                      tony.herstell1

                      I dont think so. :( there are a lot of plugins for MyEclipse that the subscription pays for.
                      Download MyEclipse for free and get the 3 month trial ;)

                      Hummm... I sound like a sales person... Sorry... that was NOT the point of the thread!

                      Anyhow, you could try setting it up in normal eclipse as I have said above and report back to this thread so others can share your experience/method.

                      • 8. Re: Lazy mans guide to developing SEAM!
                        tvrtko

                        I followed instructions from chapter 2: getting started http://docs.jboss.com/seam/1.1BETA2/reference/en/html/gettingstarted.html

                        I also had to comment out part of jmx-invoker-service.xml as stated on this wiki page http://wiki.jboss.org/wiki/Wiki.jsp?page=SecureTheInvokers or else the JBossIDE was unaware that jboss has started