How do you prevent Liberty from deleting the expanded folder after a restart

1.4k Views Asked by At

my server.xml has

< applicationManager autoExpand="true" / >
...
< application context-root="BaseX" id="BaseX" name="BaseX" type="war" location="C:\Program Files\BaseX.war" / >

when I start the application

server start myapp

the whole expanded folder is deleted and recreated. WebSphere\Liberty\usr\servers\myapp\apps\expanded\BaseX.war

since BaseX.war is my database i loose all the data with it after a simple re-start (stop and start)

1

There are 1 best solutions below

6
On BEST ANSWER

The best way to achieve this right now is to deploy your application as an expanded WAR rather than as an archive. Instead of the WAR archive c:\Program Files\BaseX.war, you would have a directory c:\Program Files\BaseX.war that contains the expanded BaseX.war file. In this case, the application would run directly from that directory and would not be expanded into apps/expanded.

You could also turn off expansion of applications by setting autoExpand to false on the applicationManager element, but that's likely not a good solution for you because you're writing directly to the application. If you followed this path, you would probably need to change the application to write data to a different location.