Posted by: Joshua on: January 29, 2008
Alot of people wondered whether Seam can be deployed on other appserver other than JBoss AS. Well indeed it can. Now I’m going to show how to deploy Seam on Glassfish in a very simple way without you having to modify your project stub that is created with seam-gen. So in the future you only have to modify your persistence.xml, other than that you can deploy the same seam apps you deploy on JBossAS. Note that this only works with Seam POJO apps and doesn’t work with Seam EJB3 apps mainly because Glassfish requires you to write the EJB3 reference on your web.xml. So it’s not Seam fault! As this blog entry is written I am using Seam 2.x and Glassfish 2.
Here’s what you need to do:
$GLASSFISH_HOME/domains/$DOMAIN_NAME/lib/ext:
$GLASSFISH_HOME/lib: Here we will use Hibernate as the persistence layer and will override toplink which is the default persistence layer from Glassfish because Seam does not yet support Toplink as the persistence layer for Seam POJO apps.
Note: These libraries is bundled with seam distribution so you don’t have download it separately.
FAQ: We copied these libraries into two different folders because Glassfish has a very unique classloader and becaus we want to override Toplink which is located inside $GLASSFISH_HOME/lib
persistence.xml. If your project is created with seam-gen this will be located inside $PROJECT_HOME/resources/META-INF/. And then edit these lines:
hibernate.dialect property into the database you use. You can find these dialects for various databases inside hibernate docs.hibernate.transaction.manager_lookup_class into org.hibernate.transaction.SunONETransactionManagerLookupNow the next time you create and deploy another project to the same Glassfish server, you only need to do step 3 and 4. Good luck
Recent Comments