0

Do you now if there is any way of uploading files using MBean? In particular, I want to be able to upload a file which is stored on my local machine to the application which is running on the remote server.

I couldn't find any info source having this information unfortunately. Ideally it should be BROWSE button which you can click and specify file you'd like to upload.

The other alternative I was thinking about is to copy and paste the content of the file into the TextArea of the MBean but it looks like you can't have a TextArea for some reason... just an ordinary input text field :/ Hence the length is very limited and the content is not readable.

Serge Mask
  • 1,331
  • 1
  • 9
  • 6

1 Answers1

2

Uploading a file is completely out of scope for JMX, which is intended to provide remote administration capabilities.

It is; however, not impossible.

Since you can send data in a JMX request, you could write a bean that accepts input and writes it to a file. You will need to do something like this:

  1. Create an object to hold the file data (maybe parts of the file, this will depend on the file size).
  2. Remotely invoke the bean with a file name.
  3. Have the bean return an identifier to associate with the input for the file.
  4. Itteratively invoke the bean to write the file data. Each of these messages will include the identifier which was returned in step 3 (so the remote bean knows to which file the data should be written - in case of multiple concurrent uploads).
  5. Remotely invoke the bean to tell it that the upload is complete. Again, include the identifier from step 3.
DwB
  • 37,124
  • 11
  • 56
  • 82