Skip to main content

cli remote deploy

4 replies [Last post]
mlaporta
Offline
Joined: 2007-04-02

I try to use mobicents-cli ant tasks to deploy a deployable unit to a remote mobicents server. I have property jnpHost set to 10.4.201.170 here the client side :

deploy-ra:
Installing DUs
26-giu-2007 14.04.23 org.mobicents.ant.tasks.InstallTask run
AVVERTENZA: Bad result: slee:name=DeploymentMBean.install

javax.slee.management.DeploymentException: Error retrieving file from URL=[file:
/D:/workspace.jslee3/sipra/stage/sip-ra-type.jar] to local storage
26-giu-2007 14.04.23 org.mobicents.ant.tasks.InstallTask run
AVVERTENZA: Bad result: slee:name=DeploymentMBean.install

javax.slee.management.DeploymentException: Error retrieving file from URL=[file:
/D:/workspace.jslee3/sipra/stage/sip-local-ra.jar] to local storage

Here the server side

12:53:21,069 INFO [DeploymentMBeanImpl] Deploying file:/D:/workspace.jslee3/sipra/stage/sip-local-ra.jar

What happen here is clear, the file is search locally. Mobicents cli should have some mechanism to upload/copy the deployable-unit to jboss deploy directory like management-console do. The difference is that the DeployableUnitsInstallService from management-console is a servlet using commons-fileupload with easy access to jboss context,properties and so on.

Is there any suggestions to solve this problem ?

Michele

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ivelin
Offline
Joined: 2003-07-13

can you elaborate a bit further. Both the management console servlet and the CLI should defer to a deployment MBean. Where does the actual difference in file location occur?

mlaporta
Offline
Joined: 2007-04-02

management-console class org.mobicents.slee.container.management.console.server.deployableunits.DeployableUnitsInstallService
[i]
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/plain");
PrintWriter out = response.getWriter();
try {
DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);

List items = upload.parseRequest(request);
Iterator iter = items.iterator();

while (iter.hasNext()) {
FileItem item = (FileItem) iter.next();

if (! item.isFormField()) {
String fileName = new File(item.getName()).getName();

File uploadedFile = new File(System.getProperty("jboss.server.temp.dir") + File.separator + fileName);
item.write(uploadedFile);

sleeConnection.getSleeManagementMBeanUtils().getDeploymentMBeanUtils().install(uploadedFile.toURL().toString());
uploadedFile.delete();
}
}
out.print(DeployableUnitsService.SUCCESS_CODE);
} catch (Exception e) {
e.printStackTrace();
out.print(e.getMessage());
}
}
[/i]

mobicents class
org.mobicents.slee.container.management.DeploymentManager
[i]
static File retrieveFile(URL url, File localDstDir)
throws NullPointerException, IOException {
if (url == null)
throw new NullPointerException("NULL url");
if (localDstDir == null)
throw new NullPointerException("NULL file");

File destFile = new File(localDstDir, (new File(url.getFile()))
.getName());
InputStream is = url.openStream();
OutputStream os = new FileOutputStream(destFile);

//copy the file locally
pipeStream(is, os);

return destFile;
}
[/i]

The difference is that DeployableUnitsInstallService use ServletFileUpload to process file uploads and copy them to jboss.server.temp.dir while DeploymentManager try to resolve the file url locally (retrieveFile url /D:/workspace.jslee3/sipra/stage/sip-ra-type.jar) so using a remote mobicents provokes an
[i]"Error retrieving file from URL=[/D:/workspace.jslee3/sipra/stage/sip-ra-type.jar] to local storage[/i] because file hasn't been uploaded but lookup in the local file system.

I hope it's enough clean now.

Michele

baranowb
Offline
Joined: 2006-01-09

yup, that because "file://" is propably passed or it is default protocol. Thus url class resolves it localy: http://www.cafeaulait.org/course/week12/09.html

See:
DeploymentManager.deployAllUnitsAtLocation(String sourceUrlStr,
String destinationPath, String classpathDirectoryStr,
ComponentContainer componentContainer) throws NullPointerException,
DeploymentException { ...}

and
http://kickjava.com/src/java/net/URL.java.htm
http://kickjava.com/src/java/net/URI.java.htm <-- parseURI

mlaporta
Offline
Joined: 2007-04-02

For me is clear.Do you have any suggestions of what kind of improvements can be develop to solve this?
Maybe gett DeploymentMBean from client via jmx and set a byte array of the file to upload?