Blogs

Blogs

Deploying Liferay Spring MVC Offline

Spring MVC Portlet will be requiring Internet for checking and creating beans from xsd's. In case we need to deploy and use Spring MVC Portlet without internet then we can achieve it by saving the xsd file in Liferay Tomcat server  and using this xsd  in application-context.xml.

Steps

 1. Download the Following  XSDs based on your version required

  • spring-beans-4.0.xsd
  • spring-context-4.0.xsd
  • spring-tool-4.0.xsd
  • spring-util-4.0.xsd

 2. open spring-context-4.0.xsd and edit it as follow (replace existing content with highlighted)

 <xsd:import namespace="http://www.springframework.org/schema/beans"  schemaLocation=" ../spring-xsd/spring-beans-4.0.xsd"/>
 
 <xsd:import namespace="http://www.springframework.org/schema/tool"  schemaLocation=" ../spring-xsd/spring-tool-4.0.xsd"/>
 
 Note - Change according to your server port
 
 3. Copy all four file (spring-beans-4.0.xsd,spring-context-4.0.xsd,spring-tool-4.0.xsd,spring-util-  4.0.xsd) to an  folder and name the folder as spring-xsd.
 
 4.
WIndows : Copy the spring-xsd. folder into the Drive where your Liferay tomcat is present 
Ex. If Liferay Tomcat is in d:\workspace\tomcat then paste spring-xsd folder in d: drive
 
Linux : Copy spring-xsd. folder into your liferay tomcat folder 
/liferay-portal-6.2-ce-ga6/tomcat-7.0.62 - here
 
 
 5.Inside your Spring MVC portle edit application-context.xml file as follow(replace existing  content with highlighted)
 
 <beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:p="http://www.springframework.org/schema/p"
 xmlns:context="http://www.springframework.org/schema/context"
 xmlns:util="http://www.springframework.org/schema/util"
 xsi:schemaLocation="http://www.springframework.org/schema/beans   ../spring-xsd/spring-beans-4.0.xsd    http://www.springframework.org/schema/context   ../spring-xsd/spring-  context-4.0.xsd         http://www.springframework.org/schema/util .. /spring-  xsd/spring-util-4.0.xsd">
 
 Note - 1.Change according to your server port
             2.If you have multiple application-context.xml files then do this for all of them
             3. If you have more schema in your application  context then change the path as above for all
 
 6. Build war and Deploy the Spring MVC Portlet without internet it will check and build beans  from local server path