Remotely deploy war file to Tomcat using java code -


i'm trying deploy restful web service web server tomcat 8 eclipse.

i tried using httpclient using code second answer of post: tomcat: remote programmatic deploy? exception java.net.socketexception: connection reset peer: socket write error.

i tried httpurlconnection using code first answer of post: how upload, download file tomcat server username,password in swing error.

what reason? there way? thank you.

... in different machine. can use tomcat manager deploy web service java code http put request.

in order possible, deployment folder need accessible http server or web application. that's bad idea security reasons.

you can still programmatically java (or other language) calling of many utilities file transfers: ftp, scp, networked file system, etc.

note after have copied artifact (eg war file) tomcat host, can tell tomcat deploy remotely via deployment manager url. documentation:

in example web application located in directory /path/to/foo on tomcat server deployed web application context named /footoo.

http://localhost:8080/manager/text/deploy?path=/footoo&war=file:/path/to/foo

in example ".war" file /path/to/bar.war on tomcat server deployed web application context named /bar. notice there no path parameter context path defaults name of web application archive file without ".war" extension.

http://localhost:8080/manager/text/deploy?war=jar:file:/path/to/bar.war!/

your code copy artifact via scp (or whatever) , if successful call manager url appropriate arguments. 2 step process in single code run.


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -