Details

    • Type: Feature Request Feature Request
    • Status: Closed Closed (View Workflow)
    • Priority: Major Major
    • Resolution: Done
    • Affects Version/s: 2.0.0.BETA1
    • Fix Version/s: 2.1.2.CR1
    • Component/s: Tools
    • Labels:
      None
    • Environment:
      Glassfish V2
    • Affects:
      Documentation (Ref Guide, User Guide, etc.), Compatibility/Configuration
    • Estimated Difficulty:
      Medium
    • Similar Issues:
      Show 10 results 

      Description

      I believe that adding support for Glassfish will help promote the adoption of Seam. In my mind, Tomcat is not nearly as important because it is not a Java EE-compliant environment and seam-gen is all about creating compliant projects.

      Supporting Glassfish is actually quite straightforward. There are a couple of assumptions that are made by seam-gen that render it incompatible with a generic Java EE-compliant application server. Here is what needs to change:

      1. The java:/ prefix on the data source causes problems with other servers. This can be easily brought into compliance by adding <use-java-context>false</use-java-context> to the ds.xml files and removing the java:/ prefix from the persistence.xml files in the seam-gen/resources/META-INF directory

      2. Glassfish does not use Hibernate EntityManager as the default JPA provider, and therefore does not have any of its jar files. Of course, we could just make everyone copy necessary hibernate jar files into the glassfish installation directory, but that just isn't going to go over well. I think a better approach is to modify the build.xml file to copy the following three libraries if the property hibernate.needed=true is set:
      hibernate-all.jar
      thirdparty-all.jar
      jboss-archive-browsing.jar (not currently in the seam distribution, but stuck inside the jboss-embedded-all.jar file)

      3. Make the hibernate.transaction.manager_lookup_class parameterized, perhaps asking during setup

      4. Removing the .war suffix on the exploded archive directory (so that Glassfish can deploy the directory using asadmin deploydir)

      That's it! Then you can have Glassfish working.

        Issue Links

          Activity

          Hide
          Dan Allen
          added a comment -

          I have attached the glassfish-datasource.xml to complement the datasource-ds.xml file used for the JBoss AS deployment. The destination file is handled differently for the Glassfish deployment. It is not just copied into the deployment directory as is done for JBoss AS. Instead, the file is fed into the Glassfish add-resources command to setup the pool and data source in the JNDI tree. This can only be done once, so it may need a special target in the ant script to run it.

          The add-resources command is:

          $

          {glassfish.home}/bin/asadmin add-resources $PWD/resources/glassfish-dev-datasource.xml

          and

          ${glassfish.home}

          /bin/asadmin add-resources $PWD/resources/glassfish-prod-datasource.xml

          The absolute file name is important. If it is relative, Glassfish will look for it in the domain configuration directory. Glassfish must be running for this command to be executed.

          Show
          Dan Allen
          added a comment - I have attached the glassfish-datasource.xml to complement the datasource-ds.xml file used for the JBoss AS deployment. The destination file is handled differently for the Glassfish deployment. It is not just copied into the deployment directory as is done for JBoss AS. Instead, the file is fed into the Glassfish add-resources command to setup the pool and data source in the JNDI tree. This can only be done once, so it may need a special target in the ant script to run it. The add-resources command is: $ {glassfish.home}/bin/asadmin add-resources $PWD/resources/glassfish-dev-datasource.xml and ${glassfish.home} /bin/asadmin add-resources $PWD/resources/glassfish-prod-datasource.xml The absolute file name is important. If it is relative, Glassfish will look for it in the domain configuration directory. Glassfish must be running for this command to be executed.
          Hide
          Dan Allen
          added a comment -

          We should probably establish the property glassfish.home early on as it will become useful for executing commands for adding resources and deploying the exploded directory.

          If the .war suffix is removed from the exploded archive, the following command will work to deploy to Glassfish:

          $

          {glassfish.home}

          /bin/asadmin deploydir $PWD/exploded-archives/project_name

          Unfortunately, if the directory has a .war suffix, Glassfish becomes confused and thinks that it is supposed to be an actual .war file. Fortunately this does not mess up compatibility with JBoss since the files are still copied into the JBoss deployment directory in a directory that contains the .war suffix.

          The nice part about Glassfish is that no further coping must be done to repeatedly deploy files.

          Show
          Dan Allen
          added a comment - We should probably establish the property glassfish.home early on as it will become useful for executing commands for adding resources and deploying the exploded directory. If the .war suffix is removed from the exploded archive, the following command will work to deploy to Glassfish: $ {glassfish.home} /bin/asadmin deploydir $PWD/exploded-archives/project_name Unfortunately, if the directory has a .war suffix, Glassfish becomes confused and thinks that it is supposed to be an actual .war file. Fortunately this does not mess up compatibility with JBoss since the files are still copied into the JBoss deployment directory in a directory that contains the .war suffix. The nice part about Glassfish is that no further coping must be done to repeatedly deploy files.
          Hide
          Gavin King
          added a comment -

          Great, thanks Dan, much appreciated, we should try and get this integrated asap.

          Show
          Gavin King
          added a comment - Great, thanks Dan, much appreciated, we should try and get this integrated asap.
          Hide
          Dan Allen
          added a comment -

          It appears that the standard file extension for a Glassfish resource file is

          .sun-resource

          We should probably follow that convention.

          Show
          Dan Allen
          added a comment - It appears that the standard file extension for a Glassfish resource file is .sun-resource We should probably follow that convention.
          Hide
          Pete Muir
          added a comment -

          Dan, we shouldn't deploy the -all.jar files, but instead just copy the necessary (real) jars (i.e. hibernate.jar, hibernate-entitymanager.jar, hibernate-annotations.jar etc).

          Can you write a patch against seam-gen for this? IMO we should write ant targets to wrap up the glassfish deploy commands. I think this will need a way to check if glassfish is currently running, and if not perhaps prompt to start it.

          Show
          Pete Muir
          added a comment - Dan, we shouldn't deploy the -all.jar files, but instead just copy the necessary (real) jars (i.e. hibernate.jar, hibernate-entitymanager.jar, hibernate-annotations.jar etc). Can you write a patch against seam-gen for this? IMO we should write ant targets to wrap up the glassfish deploy commands. I think this will need a way to check if glassfish is currently running, and if not perhaps prompt to start it.
          Hide
          Daniel Kimmig
          added a comment -

          I was thinking about requesting a feature concerning seam-gen for a long time. That feature would have been to make seam-gen aware of other containers such as Glassfish and Tomcat.

          Although I am happy to see that there is work in progress to decouple seam-gen from JBoss AS, I think it is quite disappointing that you rule out Tomcat like that. Bringing Tomcat to seam-gen would help Seam adoption much more then Glassfish imho, because the biggest concern about Seam adoption is still the environment restriction it emposes. By aggressively showing RAD with seam-gen on a container like Tomcat, much of the "Do i need to use EJB on one of those huge and complicated appservers?"-FUD could be negated.

          As Michael Yuan pointed out in his blog ( http://www.michaelyuan.com/blog/2007/07/24/seam-20-and-tomcat/ ), there are two ways to use Seam on Tomcat, either with Embedded JBoss MC or without the MC but restricted to Seam POJOs. If that is the case, why is it so hard to ask the user during seam-setup which container he chooses and if he enters Tomcat, then ask which of these two options should be used.

          My concern for this issue relies in the fact that in my company we evaluated Seam and found its features quite nice, especially for a new project that needs JSF components ajaxified with each other. It was great to read about seam-gen, a tool that supposedly should get you started with the project structure and build process. Unfortunately a lot of development effort has been done using Spring/Hibernate on Tomcat during the last years and therefor all of theapplications are hosted on a unique instance of Tomcat.

          I think I am by far not alone with an environment like that. If you want to compete with Spring, you need to be able to live in the same environment that Spring does. This is the only way that you can make developers choose Seam for their next project. Because in real life, no one will port their production applications to a different container/appserver JUST to make the new project executable.

          I opened a thread concerning this issue in the Seam forum. http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4087856#4087856

          Show
          Daniel Kimmig
          added a comment - I was thinking about requesting a feature concerning seam-gen for a long time. That feature would have been to make seam-gen aware of other containers such as Glassfish and Tomcat. Although I am happy to see that there is work in progress to decouple seam-gen from JBoss AS, I think it is quite disappointing that you rule out Tomcat like that. Bringing Tomcat to seam-gen would help Seam adoption much more then Glassfish imho, because the biggest concern about Seam adoption is still the environment restriction it emposes. By aggressively showing RAD with seam-gen on a container like Tomcat, much of the "Do i need to use EJB on one of those huge and complicated appservers?"-FUD could be negated. As Michael Yuan pointed out in his blog ( http://www.michaelyuan.com/blog/2007/07/24/seam-20-and-tomcat/ ), there are two ways to use Seam on Tomcat, either with Embedded JBoss MC or without the MC but restricted to Seam POJOs. If that is the case, why is it so hard to ask the user during seam-setup which container he chooses and if he enters Tomcat, then ask which of these two options should be used. My concern for this issue relies in the fact that in my company we evaluated Seam and found its features quite nice, especially for a new project that needs JSF components ajaxified with each other. It was great to read about seam-gen, a tool that supposedly should get you started with the project structure and build process. Unfortunately a lot of development effort has been done using Spring/Hibernate on Tomcat during the last years and therefor all of theapplications are hosted on a unique instance of Tomcat. I think I am by far not alone with an environment like that. If you want to compete with Spring, you need to be able to live in the same environment that Spring does. This is the only way that you can make developers choose Seam for their next project. Because in real life, no one will port their production applications to a different container/appserver JUST to make the new project executable. I opened a thread concerning this issue in the Seam forum. http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4087856#4087856
          Hide
          Dan Allen
          added a comment -

          Please let's keep this issue focused on Glassfish V2. I do not want to distract the goal here.

          Pete, I have a better understanding now of what it takes to get the app deployed to Glassfish and I am prepared to make a new patch with your suggestions (though it may be that Hibernate isn't even required)

          Show
          Dan Allen
          added a comment - Please let's keep this issue focused on Glassfish V2. I do not want to distract the goal here. Pete, I have a better understanding now of what it takes to get the app deployed to Glassfish and I am prepared to make a new patch with your suggestions (though it may be that Hibernate isn't even required)
          Hide
          David Sachdev
          added a comment -

          What is the current status of this issue? I would be very interested in Seam-gen working seamlessly with Glassfish.

          Reference pages:
          http://jkook.blogspot.com/2007/12/kooking-seam-with-glassfish.html
          http://joshuajava.wordpress.com/2008/01/29/deploying-seam-pojo-apps-on-glassfish/

          Show
          David Sachdev
          added a comment - What is the current status of this issue? I would be very interested in Seam-gen working seamlessly with Glassfish. Reference pages: http://jkook.blogspot.com/2007/12/kooking-seam-with-glassfish.html http://joshuajava.wordpress.com/2008/01/29/deploying-seam-pojo-apps-on-glassfish/
          Hide
          Dan Allen
          added a comment -

          Seam in Action chapter 2 also details exactly what needs to be done for a glassfish deployment.

          I know there is some opposition to having seam-gen support multiple appservers, but I think that is an unwise position. We really need to figure out how to get a couple of additional options baked into seam-gen. I went with Glassfish because it behaves and thus the changes were minimal. I guess Tomcat could go just as smoothly with the prerequisite of having the Embedded JBoss installed.

          I recognize that additional appserver support results in more to maintain and test, but we are out there promising folks that we will test it for them, so yeah, I think we have to take on that responsibility. Let's just start with Glassfish. It's more about proving it is possible then making everyone happy. Next, we move on to Tomcat, which by the way needs a separate issue report.

          Show
          Dan Allen
          added a comment - Seam in Action chapter 2 also details exactly what needs to be done for a glassfish deployment. I know there is some opposition to having seam-gen support multiple appservers, but I think that is an unwise position. We really need to figure out how to get a couple of additional options baked into seam-gen. I went with Glassfish because it behaves and thus the changes were minimal. I guess Tomcat could go just as smoothly with the prerequisite of having the Embedded JBoss installed. I recognize that additional appserver support results in more to maintain and test, but we are out there promising folks that we will test it for them, so yeah, I think we have to take on that responsibility. Let's just start with Glassfish. It's more about proving it is possible then making everyone happy. Next, we move on to Tomcat, which by the way needs a separate issue report.
          Hide
          Max Rydahl Andersen
          added a comment -

          Dan, please realize if seam-gen does jboss tools should also be changed. It is this N x N configuration setup that is the reason for us to keep things simple and then simply explain in docs how to adjust.

          The changes are not exactly trivial to implement in something like seam-gen without introducing a big dependency and version mismatch...

          Show
          Max Rydahl Andersen
          added a comment - Dan, please realize if seam-gen does jboss tools should also be changed. It is this N x N configuration setup that is the reason for us to keep things simple and then simply explain in docs how to adjust. The changes are not exactly trivial to implement in something like seam-gen without introducing a big dependency and version mismatch...
          Hide
          Max Rydahl Andersen
          added a comment -

          note: if someone can explain me how we can do this without breaking every release of seamgen and jbosstools when something gets updated then I am very interested...

          Show
          Max Rydahl Andersen
          added a comment - note: if someone can explain me how we can do this without breaking every release of seamgen and jbosstools when something gets updated then I am very interested ...
          Hide
          Dan Allen
          added a comment -

          Aside from one naming issue, this is really just a packaging issue. It's just a matter of having build.xml include targets that package it properly for a different server. I don't really see how that affects jbosstools, but I could be lacking the understanding.

          The biggest issue is the java:/ prefix on the datasource. JBoss is the only appserver that seems to understand this notation. To avoid having to modify the persistence.xml file for different environments, I propose that we use the standard JNDI naming (something like jdbc/datasource). This can be enabled in the -ds.xml file by using <use-java-context>false</use-java-context>.

          Show
          Dan Allen
          added a comment - Aside from one naming issue, this is really just a packaging issue. It's just a matter of having build.xml include targets that package it properly for a different server. I don't really see how that affects jbosstools, but I could be lacking the understanding. The biggest issue is the java:/ prefix on the datasource. JBoss is the only appserver that seems to understand this notation. To avoid having to modify the persistence.xml file for different environments, I propose that we use the standard JNDI naming (something like jdbc/datasource). This can be enabled in the -ds.xml file by using <use-java-context>false</use-java-context>.
          Hide
          Max Rydahl Andersen
          added a comment -

          if it purely changes in the build.xml then probably i'm fine...but if it changes where things are supposed to go or different set of jars etc. we should at least do it in a way so it is possible for us to reuse the set of libraries and where thing goes.

          the naming issue will be relevant if it changes the way templates will be processed and how things run in the embedded container.

          Show
          Max Rydahl Andersen
          added a comment - if it purely changes in the build.xml then probably i'm fine...but if it changes where things are supposed to go or different set of jars etc. we should at least do it in a way so it is possible for us to reuse the set of libraries and where thing goes. the naming issue will be relevant if it changes the way templates will be processed and how things run in the embedded container.
          Hide
          Samuel Doyle
          added a comment -

          There is a lot of noise on this subject and I believe Dan is correct in that adding GlassFish support will increase the adoption rate of Seam.

          Show
          Samuel Doyle
          added a comment - There is a lot of noise on this subject and I believe Dan is correct in that adding GlassFish support will increase the adoption rate of Seam.
          Hide
          Dan Allen
          added a comment -

          Fixed. The only change that was made to the shared templates is that I renamed Authenticator to AuthenticatorJavaBean, make Authenticator a @Local interface, and introduced the @Stateless bean AuthenticatorBean. So the generator for WAR projects has to copy AuthentictorJavaBean to Authenticator.java

          Please see the following entries documenting the progression for how I implemented it this support.

          http://www.mojavelinux.com/blog/archives/2008/10/deploying_a_seamgen_project_to_glassfish/
          http://code.google.com/p/seaminaction/wiki/DeployingToGlassFish
          http://in.relation.to/Bloggers/JBossAS5AndGlassFishSupportAddedToSeamgen

          Show
          Dan Allen
          added a comment - Fixed. The only change that was made to the shared templates is that I renamed Authenticator to AuthenticatorJavaBean, make Authenticator a @Local interface, and introduced the @Stateless bean AuthenticatorBean. So the generator for WAR projects has to copy AuthentictorJavaBean to Authenticator.java Please see the following entries documenting the progression for how I implemented it this support. http://www.mojavelinux.com/blog/archives/2008/10/deploying_a_seamgen_project_to_glassfish/ http://code.google.com/p/seaminaction/wiki/DeployingToGlassFish http://in.relation.to/Bloggers/JBossAS5AndGlassFishSupportAddedToSeamgen
          Hide
          Dan Allen
          added a comment -

          Ignore the comment about Authenticator.java. I restored the previous template so that it doesn't break JBoss Tools. I just use new file names for the @Stateless and @Local classes (AuthenticatorLocal.java and AuthenticatorBean.java).

          Show
          Dan Allen
          added a comment - Ignore the comment about Authenticator.java. I restored the previous template so that it doesn't break JBoss Tools. I just use new file names for the @Stateless and @Local classes (AuthenticatorLocal.java and AuthenticatorBean.java).

            People

            • Assignee:
              Dan Allen
              Reporter:
              Dan Allen
            • Votes:
              11 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1 day
                1d
                Remaining:
                Remaining Estimate - 1 day
                1d
                Logged:
                Time Spent - Not Specified
                Not Specified