[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1859
  • Last Modified:

Static files cannot be refreshed without redeploy in Weblogic's clustered environment

1) It works in a single server (i.e. a non-clustered environment). When updated, the static html file changes are reflected immediately on the JSP.

2) However when it's deployed in a clustered environment, the update would not be reflected unless the static web application is redeployed. This is unacceptable as there's this requirement to update the html changes on a regular basics by end-users and they do not know about weblogic deployment.

The following's the codes extracts of one of the jsps:

<body style="MARGIN: 0px;margin-left: 0px">
 <%
      ServletContext sc= application.getContext("/xxx_static/");
      RequestDispatcher rd = null;
      rd = sc.getRequestDispatcher("/aaa/home.htm");
      rd.include(request, response);
 %>

Is there any solution to ensure that this kind of static files can be refreshed without redeploying in Weblogic's clustered environment?





0
feliciayong
Asked:
feliciayong
  • 2
1 Solution
 
illusionz70Commented:
the foll is from weblogic docs version 6.1


Refreshing Static Components Without Redeploying the Application

To refresh static components of an application without having to redeploy the entire application, use the weblogic.refresh tool.

When you update a static file in a Web Application on the Administration Server, the file is not automatically copied to the Web Application on any Managed Servers, but you can use weblogic.refresh to refresh, add, or delete static files such as:


JSPs

XML files

HTML files

Image files, such as .gif and .jpg

Text files
Refreshing JSPs does not require redeploying the Web Application because each JSP is loaded by its own classloader, of which the Web Application classloader is a parent.

Note the following limitations of this utility:


You cannot use this utility to refresh Java class files.

To use this utility, the Web Application must be deployed in exploded directory format, and if it is contained in an ear file, the ear file must be in exploded format. The utility does not work for components archived in .war files.
To refresh a static file:


Set up your development environment so that WebLogic Server classes are in your system CLASSPATH and the JDK is available. You can use the setEnv script located in the config/mydomain directory to set your environment.

Enter a command in the following form:
% java weblogic.refresh -url -username -password -application
-component -files -delete -root

Where:


url is the URL of your WebLogic Administration Server.

username is the username for system administration.

password is your system administration password.

application is the name of an Enterprise Application that contains the Web Application being refreshed. If your Web Application is not part of an Enterprise Application, enter the name of the Web Application.

component is the name of the Web Application being refreshed.

files is a comma-separated list of files to be refreshed. The files can be specified using wildcards, e.g., *.jsp or *.gif. Note that to specify multiple files you cannot use both wildcards and multiple comma-separated files. Filenames must be relative filenames to the root of the Web Application, so if the file is ball.gif and is contained in a subdirectory \foo of the Web Application root directory, the filename is foo\ball.gif. If a file does not exist on the server, it will be created, along with any specified subdirectories.

if delete is set, named files will be deleted.

root is the directory from which files should be picked up for refresh. Default is the current directory.
For example, the following command refreshes the files HelloWorld.jsp and foo\ball.gif in the myWebApp Web Application:

java weblogic.refresh -url t3://localhost:7001 -username
myUsername -password myPassword  -application myApplication
-component myWebApp -root c:\stagedir\myWebApp
HelloWorld.jsp,foo\ball.gif

0
 
rama_krishna580Commented:
Hi,

You can look at the documentation provided by the Weblogic ....
@ http://e-docs.bea.com/wls/docs61/webapp/deployment.html   in particularly...
@ http://e-docs.bea.com/wls/docs61/webapp/deployment.html#149386 

And...You are deploying a Web Application or Enterprise Application that contains static files that you will periodically update. In this case, it is more convenient to deploy the application as an exploded directory, because you can update and refresh the static files without re-creating the archive.

For more info refer to again documentation by Weblogic
@ http://e-docs.bea.com/wls/docs81/deployment/overview.html

i hope it may help you...

best of luck..
R.K
0
 
feliciayongAuthor Commented:
Hi,

Really appreciate all the prompt responses. Thanks!
But sorry, I think i have not clearly defined my question & requirements earlier.

Currently I'm deploying the following components in weblogic 8:
1) Application EAR (contains dynamic files like jsps & servlets)
2) Web Application (deployed as an exploded directory, containing static html files)

Consideration Points:
Pt A) It works in a single server (i.e. a non-clustered environment). When updated, the static html file changes are reflected immediately on the JSP.

Pt B) However when it's deployed in a clustered environment, the update would not be reflected unless the static web application is redeployed. This is unacceptable as there's this requirement to update the html changes on a regular basics by end-users and they do not know about weblogic deployment.

The following's the codes extracts of one of the jsps that's residing in the EAR file:

<body style="MARGIN: 0px;margin-left: 0px">
 <%
      ServletContext sc= application.getContext("/xxx_static/");
      RequestDispatcher rd = null;
      rd = sc.getRequestDispatcher("/aaa/home.htm"); // "/aaa/home.htm" resides in Web Application's exploded dir
      rd.include(request, response);
 %>

Is there any way to ensure that this kind of static files can be refreshed without redeploying in Weblogic's clustered environment, i.e. user just need to refresh web browser to see the html changes instantly (to achieve Pt A in a clustered environment)?

0
 
rama_krishna580Commented:
Hi,

Now at this situation, the best and easy solution is you write a BUILD.XML file for the deployment and before that locate the deployment location and delete the EAR/JAR/WAR files and re-deploy using this Ant-Build XML file. It will be easy for you to maintain the application changes and with latest update changes in side the application(s). When ever you change any thing you need to just run the build.xml file then it will do every thing for you.

So you go for Build.xml file ....

best of luck...
R.K
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now