Marvin Firewall error message when using Marvin applet

User 7ecde2a58a

28-03-2006 11:00:56

Hello everyone,


this is the first time I am trying out Marvin.


My goal: Using MSketch within a HTML page to draw a structure, then press a button and get the corresponing INChI code with an text input field.


For this I am using the MSketch.getMol() function and the Java/Javascript communication.





My problem: Internet Explorer works fine. But with Firefox I get a firewall error message from Marvin saying:





'Marvin cannot load a module, a template or a molecule file'


'One of the following two possibilities might have caused the problem:


* The file and Marvin are not on the same server. From security reasons, Java applets can only access files from their host web site.


* You are behind a firewall which does not proxy DNS correctly or at all. Netscape Navigator 4.01 and later versions do not trust in such misconfigured proxies by default, so applets cannot connect back to their host web site'





I assume, there is a .dll file or something missing, which is loaded from chemaxxon for exporting INChI code.


The error message suggests a workaround editing the preferences files for the browser, which didnt work for me.





Any suggestions?

ChemAxon 7c2d26e5cf

28-03-2006 15:26:04

Hi Olivier,


Have you managed import/export a structure in InChi format, inside Marvin (in Marvin's Edit Source window)? Does this error occure only at Java - JavaScript communication?


Please check the Java Console. Do you find any (error) message there?





Are you sure you refer correctly to your html page? Marvin applets have to be loaded through HTTP protocol: "http://myserver/path/something.html"


If the URL starts with the "file://" prefix, a few resources can not load in.


Which Java version runs in your IE and in your Firefox? Which Marvin version do you use?

User 7ecde2a58a

29-03-2006 06:42:47

Hello Tamas,





wel, the export function for inchi inside Marvin using the menu edit->source and then Format in the new window works fine.





I do indeed get an error message in the Java Consoloe saying:


'java.lang.SecurityException: Unable to create temporary file


at java.io.File.checkAndCreate(Unknown Source)


at java.io.File.createTempFile(Unknown Source)


at java.io.File.createTempFile(Unknown Source)


at chemaxon.marvin.modules.InchiExport.convert(Unknown Source)


at chemaxon.struc.Molecule.a(Unknown Source)


at chemaxon.struc.Molecule.exportToObject(Unknown Source)


at chemaxon.struc.Molecule.exportToFormat(Unknown Source)


at chemaxon.struc.Molecule.toFormat(Unknown Source)


at JMSketch.getMol(Unknown Source) ...'





I added the applet into the html page by using the code posted on your website:


<script LANGUAGE="JavaScript1.1" SRC="../../marvin.js"></script>


<script LANGUAGE="JavaScript1.1">


<!--


// marvin_jvm = "builtin"; // "builtin" or "plugin"


// marvin_gui = "awt"; // "awt" or "swing"


msketch_begin("../..", 460, 380); // arguments: CODEBASE, WIDTH, HEIGHT


msketch_end();


//-->


</script>





and not the actual <applet> tag


I am using the latest Marvin version, Firefox 1.0.6 and and IE 6

ChemAxon 7c2d26e5cf

29-03-2006 21:33:01

Hi Olivier,


Probably, it is a Firefox bug. I have also managed to reproduce it with Firefox 1.5.


It seems that the browser does not let the signed applet write a file to the local drive if the request is recieved from JavaScript.


Thanks for the bug report. We will check how to solve this problem.

User e34a92cce5

29-11-2006 15:21:28

I am getting the same error message on IE when I am trying to load an SDF file for displaying in a web applet. Any suggestions?


Renju

ChemAxon 7c2d26e5cf

29-11-2006 15:42:20

How did you try to load the SD file?


Tamas

User e34a92cce5

29-11-2006 17:24:25

Using a Marvin script similar to thge one listed here :


http://www.chemaxon.com/marvin/doc/dev/example-view2.6.html





The strange thing is that I don't get this error when I upload files from some PCs. They seem to be arbitrary when it comes to falshing this error. The web server hosting Marvin stores the sdf file as well.





Code:
   }


elseif($HTTP_POST_VARS['submit'])


   {


     if (!is_uploaded_file($HTTP_POST_FILES['file']['tmp_name']))


      {


          $error = "You did not upload a file!";


          echo $error;


       unlink($HTTP_POST_FILES['file']['tmp_name']);


       }


    else


      {








       copy($HTTP_POST_FILES['file']['tmp_name'],$tempfiles.$HTTP_POST_FILES['file']['name']);











      $srcfile = $mainsite."outputfiles/uploadfiles/".$HTTP_POST_FILES['file']['name'];


?>





    <script LANGUAGE="JavaScript1.1" SRC="marvin_new/marvin.js"></script>


   <script LANGUAGE="JavaScript1.1">





   // number of structures in the SD file


   var max = 500;





   var col = 5;


   var vcol = 5;


   var vrow = 3;


   if(max < 2) {


       col = 1;


       row = 1;


   } else {


       row = Math.floor((max + 1) / col);





   }


   if(vcol > vcol) {


       vcol = vcol;


   }


   if(vrow > row) {


       vrow = row;


   }


   mview_name="MView"


   mview_begin("marvin_new",650,400);


   mview_param("editable",2);


   if(max > 1) {


       mview_param("rows",row)


       mview_param("cols",col)


       mview_param("visibleCols",vcol)


       mview_param("visibleRows",vrow)


       mview_param("border",1)


       mview_param("layout",":2:1:M:1:0:1:1:c:b:1:1:L:0:0:1:1:c:n:0:1")


       mview_param("param",":M:200:200:L:10b")


       for(i=0;i<(row*col);i++) {


           mview_param("cell"+i,"||"+(i+1))


       }


   }


   mview_param("mol","<? echo $srcfile ?>")


   mview_end()


   </script>





<?


      }


   }


?>


ChemAxon 7c2d26e5cf

30-11-2006 18:29:17

Probably the encoding of the molecule source is missing.


JavaScript can not accept special characters (like ' or "). Wrong end row characters can cause also problem.


See the following topic about encoding, probably it helps:


http://www.chemaxon.com/forum/ftopic1877.html

User e34a92cce5

01-12-2006 02:58:59

But if that is the case, why would it work from some PC stations and not from others? The error message does not come up when I upload files from my PC as opposed to someone else's PC. Does it havew anything to do with client configuration? Is there something in IE preferences that needs to be changed.


Renju

ChemAxon 7c2d26e5cf

01-12-2006 12:28:12

Probably, there are different operating system on different machines.


Until most operating system uses \n as EOL (enf of line character), Windows uses \r\n.


When you upload a molecule file to the server and give its source as input to the applet, you have to convert each \r\n to \n (since Java uses also '\n').





By the way, take care to use HTTP protocol to access applet examples. If the codebase starts with "file://..." the applet can drop SecurityExceptions. It means a web server is needed for running applet examples.

User e34a92cce5

01-12-2006 16:36:24

All client machines run windowsXP. I don't think it is due to OS differences.


Renju

ChemAxon 7c2d26e5cf

01-12-2006 16:52:09

Quote:
All client machines run windowsXP. I don't think it is due to OS differences.
That's why \r-s should be removed from mol strings (before applet receives it).

User e34a92cce5

01-12-2006 18:35:52

I have attached the SDF file that I have been getting errors with. Pls let me know if you see anu issues there with the line endings

ChemAxon 7c2d26e5cf

05-12-2006 14:04:37

Yes, EOLs are \r\n in this file.


Convert molecule source for JavaScript (before pass it to applet):


1. Remove \r characters.


2. Replace special characters with its encoded versions for JavaScript:


from \n to \\n


from " to \\"