Monday May 05, 2008

GlassFish V2 update center module for Spring Framework

GlassFish update center module for Spring Framework Effective this weekend there is a new GlassFish V2, update center module for Spring Framework. The aim of this module is to make is easier for users to deploy their spring based applications to GlassFish application server. This is version 1.0 of the updatecenter module and supports Spring Framework 2.5.4.

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/updatetool

Select the "Available Modules" tab and you should find the Spring Framework module as one of the modules available for install.
Spring Framework Module for GlassFish V2

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 domain1
In 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
    Start JavaDB database

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 :
Server log for application deploy

Below are few screen shots of the SpringJPA sample application :
SpringJPA application first page

SpringJPA - List Items

SpringJPA - Details of an Item


Additional Resources :

About

pramodg

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today