-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
I want an "Update Feature" in my GUI. So I thought to upload a WAR-File via ZK Fileupload and then replace the "old" WAR File on-the-fly in the Tomcat Webapps directory to deploy it (and restart the server).
The upload is working, but the copying of the file to the webapps folder is not working. If I do it manually it works ( "mv new_app.war app.war" ).
I tried it with "apache.common.io" and "1.7 java", same result: No error, nevertheless no copied file!
String realPath = Executions.getCurrent().getDesktop().getWebApp().getRealPath("/");
File destFile = new File(realPath.substring(1, realPath.lastIndexOf("/")) + "/app.war");
FileUtils.copyFile(myUploadedFile, destFile);
...
Files.move(myUploadedFile.toPath(), destFile.toPath(), StandardCopyOption.ATOMIC_MOVE, StandardCopyOption.REPLACE_EXISTING);
Any Idea?
Linux / ZK 7.0.2 EE / Mozilla FF 30.0
I would NOT do that. Tomcat is not build for hot-deployment !!
This should work 3 or 4 times dependent of the memory that Tomcat uses. By next 'hot-deployment' you will get 100% a 'Perm Gem' error.
best Stephan
if it's possible to write a little java command tool as an observer who will oberserve if it's a new war is uploaded. And than it calls a sh-script?
best Stephan
The upload is working fine. I save the uploaded file in a tmp directory. The only problem is, that i can't get the file copied to my webapps folder. there is no error, nothing, but the file is still not there :<
You can try to invoke ant build to move the file, or restart server with ant.
Asked: 2014-06-23 14:20:40 +0800
Seen: 19 times
Last updated: Jun 26 '14