Is There a Fix for COMSOL Script Null Pointer Java Error?

  • Thread starter Thread starter py_engineer
  • Start date Start date
  • Tags Tags
    Comsol Issues
Click For Summary

Discussion Overview

The discussion revolves around troubleshooting a Java Null Pointer Exception encountered while running a COMSOL Script. Participants explore potential causes and solutions related to the script's execution, particularly in the context of running simulations on a remote server.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant shares a script and reports a Null Pointer Exception error when executing it, seeking assistance.
  • Another participant suggests that the error might originate from an issue "somewhere else," implying that the script may not be the sole cause of the problem.
  • A third participant identifies that the error was due to attempting to run COMSOL in the background without proper graphics capability, recommending the use of 'comsol batch filename' instead of 'comsol script filename' to avoid the progress window issue.
  • One participant expresses frustration about recurring errors, indicating a personal struggle with the software.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the source of the error, with multiple viewpoints on potential causes and solutions remaining present in the discussion.

Contextual Notes

The discussion highlights limitations related to running COMSOL on remote servers, particularly concerning graphical output requirements and error handling in scripts.

py_engineer
Messages
11
Reaction score
0
Hi,

Is there anyone who can help me with COMSOL Script?

Is there anything wrong with this statement:

flclear fem

g6=rect2(1.0E-6,11.0E-6,'base','corner','pos',[0,0]);

clear s
s.objs={g6};
s.name={'CO1'};
s.tags={'g6'};

fem.draw=struct('s',s);
fem.geom=geomcsg(fem);

fem.mesh=meshinit(fem,'hauto',5);

---------------------

However, when I run this, I get this f..#@>*^& null pointer Java error! :(

Error: java.lang.NullPointerException
at com.femlab.server.MlProgressDlg.runAndWait(Unknown Source)

Error in built-in function javaMethod.
meshinitaux 67 MeshRun.smartRunner(report, loopTime);
meshinit 351 varargout = meshinitaux(fem,'meshinit',varargin{:});
comsol_DLPH_basefile 116 fem.mesh=meshinit(fem.geom,'hauto',5)
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
at com.femlab.jline.ConsoleReader.readBinding(Unknown Source)
at com.femlab.jline.ConsoleReader.readLine(Unknown Source)
at com.femlab.jline.ConsoleReader.readLine(Unknown Source)
at com.femlab.script.Terminal.a(Unknown Source)
at com.femlab.script.Terminal.b(Unknown Source)
at com.femlab.script.Terminal.main(Unknown Source)

--------------------------

Any help would be greatly appreciated!

Thanks!
 
Physics news on Phys.org
...got a geometry and a mesh out of it so perhaps there is an error "somewhere else"?
 
Ok, I got it, that wasn't too difficult, but it took me so long!

So I was trying to run COMSOL in the background. But 'comsol script filename' tries to open a progress window, and this makes the simulation crash since I was running this on a remote server with no graphics capability.. To avoid that, you just do 'comsol batch filename'..
 
An error keep repeating myself very often :blushing: .
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
5K