MSpace setMolecule error (java.security.AccessControlExcept)

User a8020badc4

15-10-2012 14:13:28

Hello,


I currently have a Marvin Space applet running in a django application on an apache webserver.  I'm trying to set the molecule using an .sdf file served from another server.  When I load the page using this code


<param name="molecule" value="http://anotherserver.net/molecule1.sdf">


...it loads fine and I can see the molecule.  When i try to change the molecule using this code...


var new_url = 'http://anotherserver.net/molecule2.sdf';
document.MSpaceApplet.setMolecule(new_url);


...the molecule doesn't load and I get a javascript error like this one


java.security.AccessControlException: access denied
java.net.SocketPermission  80 connect, resolve


Is this because I'm trying to load a molecule from a different server?  It seems strange that the mol would load properly using the first method but not with the second.


I've checked and all .sdf files are being served properly.


Can anyone help with this?


S

ChemAxon eb65a25631

16-10-2012 10:26:45

Hi,


 


I'm on holiday until Oct.24, so I won't have time reproducing your issue until then.


Could you try load a molecule on the same servere using the second example?


If it works, you may be right. Maybe, some security-tweaking is needed in the Java Control Panel.


Regards,


Andras

User a8020badc4

17-10-2012 10:38:34

Hi,


Yeah,  I've tried loading the same .sdf file served from different servers and it will only load from the same server.


I even tried setting up a redirect so the applet hits a url from it's own server (but the file is served from elsewhere).  No joy with this either.


Do you know which file might need tweaking?


 


Thanks,


Sam

ChemAxon eb65a25631

18-10-2012 11:57:24

Hi,


You can try editing the java.policy file on the client (where the applet runs) (mine is:C:\Program Files (x86)\Java\jre6\lib\security\java.policy)


by adding the following to the beginning of the file:


grant {
permission java.security.AllPermission;
};


This grants every possible permission.


If it fixes your issue, I suggest to look up some Java books about security permissionx in order to be able to setup /finetune the necessary permissions for your case.


Regards,


Andras

User a8020badc4

18-10-2012 14:33:25

Hello,


I've tried this and I still get the same error.


I'd appreciate any suggestions on how this could be fixed?


Cheers,


Sam

ChemAxon 5433b8e56b

23-10-2012 13:53:03

Hi,


I think there may be a problem inside MarvinSpace. When javascript calls a method on an applet, and it passes a String as a variable, then there is a notation in the begining of the string, that is generated by some parts of the connection layer between javascript and java. I think this notation is not processed, and the applet could not understand the URL. The notation is "@javascript-URI-encoded@".


I hope this helps to track down the problem for Andras, after he arrived back from holiday tomorrow.


Regards,
Istvan

ChemAxon eb65a25631

24-10-2012 08:28:20

Hi,


Istvan: thanks for the idea, I will check this possibility.


Sam: I will try to recreate the issue, and report back as soon as I find something.


Regards,


Andras

ChemAxon eb65a25631

25-10-2012 08:34:55

Hi Sam,

I modified my java.policy file by adding the mentioned lines (grant { permission java.security.AllPermission; };
) in the beginning of it.
This way I could manage to set a molecule using document.MSpaceApplet.setMolecule()
loaded from a different domain.

I did some research:
http://stackoverflow.com/questions/4989120/problem-with-java-applet-to-connect-our-server-to-call-a-php-file />As I understand, this case is a security risk and the exception is intentional.
The URL above describes a way of adding trusted domains.
I hope that helps.

(A sidenote: I experienced a problem, when an already loaded molecule replaced by another one in the applet:
The applet may crash, when the previous molecule object native resources are released by MarvinSpace.
This issue has nothing to do with this, altough you may experience it when calling setMolecule multiple times. We are aware of it, and will fix it in the next release.)


 


Regards,


Andras