GlassFish V2 update center module for Spring Framework
By pramodg on May 05, 2008
Thanks to Rajeshwar Patil, who actually pushed the module to the external servers. Installing the module :
You can install this module after you have successfully installed GlassFish by following the section Instructions to unbundle and configure GlassFish. For the rest of this blog, let us refer to the GlassFish root directory location as $GLASSFISH_ROOT. After you have installed GlassFish, launch the Update Center client :
$GLASSFISH_ROOT/updatecenter/bin/updatetoolSelect the "Available Modules" tab and you should find the Spring Framework module as one of the modules available for install.
Accept the license agreement to install this module. After the successful installation of this module, you would see a new directory "spring_framework" created under the $GLASSFISH_ROOT directory. A screenshot of the module directory
Post Installation steps :
During the module installation process 2 files are copied to the $GLASSFISH_ROOT/lib directory : spring.jar and commons-logging.jar. Please note that you need to restart the GlassFish application server after the spring module has been successfully installed.
$GLASSFISH_ROOT/bin/asadmin stop-domain domain1 $GLASSFISH_ROOT/bin/asadmin start-domain domain1In the above commands - "domain1" is the default domain that is created when the application server is installed. If you are using a different domain, provide that domain name instead of domain1.
When the application server is restarted it would now use the new spring libraries. From this point of time you should be able to deploy and use spring applications to the application server.
Sample application - SpringJPA
Before we dwell into the sample application please follow these steps :
- Change the value of "javaee.home" in 2 property files : setup/build.properties & bp-project/build.properties.The property points to your application server installation location i.e $GLASSFISH_ROOT.
- Ensure that the script files setup_sample.sh & unsetup_sample.sh have execute permission. The setup script also creates tables and inserts data into a javadb database. Hence the next 2 steps are required.
- Ensure that you have a DERBY_HOME environment variable pointing to the value - $GLASSFISH_HOME/javadb
- Ensure that the javadb startup script has execute permissions.
- Start the javadb database by executing the command $DERBY_HOME/bin/startNetworkServer
To setup the resources required for the sample application, create the javadb database, insert data and deploy the sample application execute the shell script "setup_sample.sh". Check the server.log to ensure that the application has been successfully deployed. Below I have attached a small section of the log file for reference :
Below are few screen shots of the SpringJPA sample application :
Additional Resources :
- Blog by Carol McDonald Detailed documentation of the sample application SpringJPA.
- For issues/questions on the spring framework module use the email@example.com mailing list.
- Introduction to Spring Framework 2.5