0

Tomcat HotDeploy from ZK-GUI

asked 2014-06-23 14:20:40 +0800

IngoB gravatar image IngoB flag of Germany
256 6

updated 2014-06-23 14:27:36 +0800

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

delete flag offensive retag edit

6 Answers

Sort by ยป oldest newest most voted
0

answered 2014-06-23 14:45:50 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

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

link publish delete flag offensive edit
0

answered 2014-06-23 15:07:30 +0800

IngoB gravatar image IngoB flag of Germany
256 6

Yes, I know. But! uploading an update and telling the customer to reboot is MUCH easier, than to discuss how to shutdown/deploy/startup on linux :p

link publish delete flag offensive edit
0

answered 2014-06-23 16:05:36 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2014-06-23 16:06:13 +0800

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

link publish delete flag offensive edit
0

answered 2014-06-23 16:09:05 +0800

IngoB gravatar image IngoB flag of Germany
256 6

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 :<

link publish delete flag offensive edit
0

answered 2014-06-24 02:47:59 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

You can try to invoke ant build to move the file, or restart server with ant.

link publish delete flag offensive edit
0

answered 2014-06-26 07:43:27 +0800

IngoB gravatar image IngoB flag of Germany
256 6

There was a problem with my tomcat configuration and auto-deploy. Now its working, thanks for your input :)

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-06-23 14:20:40 +0800

Seen: 19 times

Last updated: Jun 26 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More