You can do this using JMX.
find the J2eeDeployer service
DefaultDomain:service=J2eeDeployer on 2.4
JBOSS-SYSTEM:service=J2eeDeployer on 3.0 alpha
jboss.j2ee:service=J2eeDeployer on 3.0 current CVS
(confusing? - the last one is best, I digress)
click on it and find the deploy operation.
Type in http://another.remote.machine/myApplication.jar
and press deploy.
This generates the request
This uses the html (sic! should be http) adaptor
provided by Sun.
In 3.0 there's also an RMI JMX adaptor.
You can write jmx adaptors using whatever
protocol you desire.
I'm waiting for
Thank you so much. I just did that.
I am talking about doing it programmingly. There two approach I could use from here:
1. parameterize the ip of AppServer and target machine but keep other things of the URL exactly the same;
2. get remote reference of this J2eeDeployer() and pass the file the I want to deploy.
It seems second choice is more elegant, but I don't how to get the remote reference of J2eeDeployer. Do you know how or any other suggestions?
You talked about JMX adaptors and RMI JMX adaptor, could you shed some light on this approach? I am only interested in programming approach. Thank you.
Programatically it is easy you are just an http client
like a browser.
WARNING: Completely untested code, not even proof read
let alone compiled, but it has the basic idea.
String theRequestURL = formatURL(jbossServer, deploymentURL);
URL url = new URL(theRequestURL);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
if (conn.getResponseCode() != HTTPURLConnection.HTTP_OK)
You probably want to do a more graceful disconnect.
Thanks again. I see what you are saying.
I just want to verify with you that the my URL construction is right:
My another qustion would be where in the URL could I put in id/password?
Oops forget to answer the second part of your question.
There is some example code in the 3.0 testsuite for
the jmx adaptor.
One part includes hot-deploying of the new 3.0 services.
Another probably of more interest to you
Registers a ConnectionFactoryLoader
Uses that to create new DataSource
Then deploys a session bean. Although it does it from
a local file, the idea is the same.
Just use a remote server name in the link below
and deploy an http url.
If you know JMX it shouldn't be hard
to figure-out how to do this for the J2eeDeployer.
User name and password is rubbish over http.
which is nearly what gets sent over the network.
Of course you could always use ssl, but I don't
think Sun's http adaptor supports that.
I could be wrong??
What about a webapp on JBoss that
uses ssl and proxies the requests.
You really need to make sure port 8082 cannot be
accessed externally. Otherwise someone could do
some real damage!
I think I'll stop the naming service :-(
The rmi or ejb adaptor gives better security options.
But security isn't really my forte.
Ok, whats the escape character to turn of smilies.
That should be colon p, not :P
I see capitals ;-)
Thank you so much.
Now I have to think about how I really want to implement the tool.
I could install my RMI/SSL server to copy the files over to the target host and deploy it, but problem is this pre-requisite is really an over-kill only for file transfer which is not smart. I was expecting JBoss could provide client side API that allow users to do deployment, something like:
deploy(appServerURL, targetFileURL, userName, password);
then JBoss takes care about SSL and user authentication, which is not that hard to do. If Jboss need me to contribute this part, I would like to do it.
You might want to get some input
from the security forum about how best to do the
security. Everybody's got there own preferred methods,
so make it flexible.
Have a look at broadening the scope into creating
some nice (remote) admin tools using the
RMI or EJB adaptor.
If you're going to take this on I'd ask around first
to see what other people are doing, its always useful to get other peoples input and ideas. It avoids
duplication as well.
This has gone a bit off-topic for the EJB forum.
It's over an hour since I mentioned session