4 Replies Latest reply on Feb 17, 2009 8:29 PM by Alucard Hellsing

    Cannot deploy properly NetBeans 6.5 Glassfish V2 Seam 2.1.1

    Alucard Hellsing Newbie

      I'm trying to create a new project in NetBeans 6.5, employing Seam 2.1.1.GA, Facelets, RichFaces and Hibernate, to be deployed under Glassfish V2ur2. The database is PostgreSQL. I'm doing it based on booking example, which i've managed to manually convert to form of NetBeans enterprise applications. It compiles, deploys and works perfectly.

      The next step I took was creation of a new Enterprise Application project and setting it up for use of Facelets and RichFaces. I've copied all source files from Booking example, and adjusted package names. I also setup the project to work with PostgreSQL instead of Derby. The PostgreSQL database exists, but does not contain any tables.

      I am able to compile and deploy the project and see on its home page RichFaces controls I placed there for a test.

      The problem is when I try to log in to this my adjusted Booking example, I get the foloowing message:

      javax.el.PropertyNotFoundException: Target Unreachable, 
      identifier 'authenticator' resolved to null

      Also there is the following line in log, shown at deployment stage:

      Welcome to Seam null

      I beleive, instead of null there should be Seam version, but I've not managed to find a solution. I guess, Seam initialization is not happening properly, although there are lots of records in logs, stating that Seam components found and employed.

      I've tried including Seam libs both as class libraries and as dependent ejb project (so that jboss-seam.jar could be added to application.xml as ejb module).

      What could be the root of the issue? Or may be it is not actually the right way, to attempt using NetBeans instead of Eclipse?

        • 1. Re: Cannot deploy properly NetBeans 6.5 Glassfish V2 Seam 2.1.1
          Hal Johnson Newbie

          I'm still very new to seam, javaee in general, and netbeans, but my configuration is very similar to yours (glassfish, seam, netbeans, pgsql).  I've just spent the past couple of weeks immersed in it all, so I hope I can help at least a bit.

          The Welcome to Seam null happens to me as well.  It doesn't seem to negatively impact anything (as far as I can tell), and as such I haven't spent any time looking for a cause or solution (bigger fish to fry currently).

          The authenticator seam component is the default method of authenticating users.  If you use seam-gen, it will create a basic pojo named authenticator.  If you haven't reconfigured the seam security components, I believe seam will by default look for a component named authenticator.

          As I said, I was new to netbeans, seam, glassfish, and javaee when I finally got everything working.  I had problem after problem with netbean's EE project types (mostly due to jboss-seam.jar), and never even managed to get a project deployed in that manner.  Although now that I'm more familiar with the various configuration files I probably could, I'm not sure I'd want to.  GlassFish has some issues with exploded ear's and their component jar's.  I'm unsure if this is all automagically handled if you configure the enterprise/ejb/etc projects properly (I don't know if I tried the dependant EJB project for example).

          I do know what worked for me, I used seam-gen and then imported it into netbeans as an ant project.  A little hacking on the build.xml to unjar jboss-seam.jar allowed for a very fast development cycle.  I'm very curious if your configuration works with GlassFish's Directory Deployment option.  If it doesn't, you may want to consider the seam-gen/ant project method for the faster development cycles.

          At any rate, I hope I've helped somehow.  Good luck!

          • 2. Re: Cannot deploy properly NetBeans 6.5 Glassfish V2 Seam 2.1.1
            Thai Dang Vu Apprentice

            GlassFish has some 'issues' with exploded ear's and their component jars

            : I heard that too. That means everything must be exploded or archived.

            unjar jboss-seam.jar allowed for a very fast development cycle

            : could you explain a little bit more about that? and how to do that?

            • 3. Re: Cannot deploy properly NetBeans 6.5 Glassfish V2 Seam 2.1.1
              Hal Johnson Newbie

              I will help as much as I can Thai.  Please keep in mind that I hacked on the seam-gen build.xml just enough to get it to work while learning seam and netbeans.  I doubt this solution is optimal, but spending time cleaning up the ant script is fairly low on my list of priorities at the moment.

              With that said, what I seemed to have done is unjared the jboss-seam.jar file into a directory named jboss-seam_jar in the root of my project.  I then modified the ear target of the ant script to copy the files from that directory into the staging area (should be in a directory called exploded-archives in your project root).

              The code I added to the ear target is as follows:

              <copy todir="${ear.dir}/jboss-seam_jar">
                <fileset dir="${basedir}/jboss-seam_jar"/>

              I originally didn't manually unjar the jboss-seam.jar and instead used an ant command to do it instead of the copy.  I have this commented out, don't quite remember why, but I believe it was speed related.  In case you'd prefer this approach, the code for that was:

              <unjar src="${lib.dir}/jboss-seam.jar" dest="${ear.dir}/jboss-seam_jar"/>

              Either should work, but using both probably won't :P

              Aside from that, I poked around the netbeans included build scripts to figure out how it deployed to GlassFish and essentially copy & pasted those bits of code with a few modifications to allow direct deployments.  If you're interested in those bits, please let me know and I'll dig them up, post them, and explain what I can remember.

              Once those changes were made, its just a matter of configuring your project to call the stage target for builds (this is all that seems to be necessary for changes to most things aside from java classes and core configuration files, these require a redeploy).

              Overall its much faster than having to rebuild the jar/war/ears every iteration.  Builds are practically instantaneous on my machine, and redeploys tend to take 5-15 seconds (which isn't terrible considering the amount of seam required libraries that have to be processed by GlassFish during redeployment).

              I'm hoping to find a more efficient method, but this setup is fast enough that I haven't had the incentive to work on optimizing it yet.

              Hope this helps, take care!


              • 4. Re: Cannot deploy properly NetBeans 6.5 Glassfish V2 Seam 2.1.1
                Alucard Hellsing Newbie

                Thank you very much for your input!

                Although I managed to create a native Netbeans Enterprise Application with Seam for Glassfish, you obviusly got farther than me in terms of actually using this setup. I used dependent jboss-seam.jar project you've mentioned. I'm not sure if this still is a good choice from redeployment speed standpoint, because I havent actually worked any more with this setup. Though, in case anyone is interested, I can provide configs or actual project contents, since it is only the adapted to Netbeans booking example.

                That might seem a bit odd, but currently I'm trying to create analogous project under Eclipse Ganymede using Seam 2.1.1.GA and Glassfish v2ur2. This is because my two-weeks research brought me to trying some Eclipse examples, doing which I realised there is much better Seam support in Eclipse than in Netbeans, starting from xhtml code completion, which I wasn't able to consistently employ in Netbeans.
                Still, I wouldn't like to use JBoss though, because of learning time involved, and I'm also very new to J2EE, Seam and RichFaces.

                I have some issues with Eclipse as well. When I create a Seam Web Project, it builds fine, but cannot be deployed under Glassfish as is, since the latter complaints on missing ejbs in jar, inspite of having Authenticator class in place, adjusted to be a @Stateless with @Local interface.

                I would really appreciate if someone pointed me out how to create a standalone ear package from Eclipse Seam Web project so that I could see what are actual differences between it and Netbeans-originated one.