File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Making changes in an XML file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Making changes in an XML file" Watch "Making changes in an XML file" New topic
Author

Making changes in an XML file

Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 627
Hi All,

If we make a change in an XML file, we need not do any recompilation obviously and that's why we use XML files but we do have to restart the server right? Is there any way we don't have to even restart the server?

Thanks.
[ October 20, 2008: Message edited by: Arjun Reddy ]

Be Humble... Be Nice.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61434
    
  67

What XML file(s) are you speaking of?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 627
Say web.xml or strutsconfig.xml or log4j.properties file.. anything.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61434
    
  67

You don't generally need to restart the server (except for Log4J which may depend on where you put the config), but you'll need to restart the web application.
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
You can make a mechanism in your application to keep on looking for changes in the XML file and reload it when it changes. Or create a simple servlet/jsp to notify about the changes in XML to reload that instead of keep on looking for changes.


My Blog
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61434
    
  67

Originally posted by Vinod K Singh:
You can make a mechanism in your application to keep on looking for changes in the XML file and reload it when it changes. Or create a simple servlet/jsp to notify about the changes in XML to reload that instead of keep on looking for changes.

You cannot reload the deployment descriptor or other config files under code control.
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
Originally posted by Bear Bibeault:

You cannot reload the deployment descriptor or other config files under code control.


Thats true for deployment descriptor. But one can load other application specific configuration files and refresh the values at runtime.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61434
    
  67

Those do not appear to be the type of files that the poster is asking about.
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
Say web.xml or strutsconfig.xml or log4j.properties file.. anything.

Not exactly. He is too general, see the anything in his message.
Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 627
Can we use tools like Cruise Control so that we can make changes in the XML file but need not restart the server?

Thanks.
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1527
Originally posted by Arjun Reddy:
Can we use tools like Cruise Control so that we can make changes in the XML file but need not restart the server?

Thanks.


Depends. There are other major reasons for why should you need a cruise control. Questions pertaining to it would go there.
[ October 21, 2008: Message edited by: Akhilesh Trivedi ]

Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
Cruise Control is a continuous build tool, it has nothing to do with applications or servers.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Making changes in an XML file