Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

COMSOL API and Eclipse

Please login with a confirmed email address before reporting spam

Hello all,

I'm trying to get COMSOL API working with JavaSE 1.8 in Eclipse.

Following the directions in the COMSOL API documentation I've created a project and imported the *.jar from COMSOL/COMSOL50/Multiphysics/plugins as an external library. I have also copied the test code which I'll reproduce bellow.

package comsol_test_2;

import com.comsol.model.*;
import com.comsol.model.util.*;

public class hello_world {
public static void main(String[] args)
{
run();
}
public static Model run()
{
Model model= ModelUtil.create("Model");
model.modelNode().create("comp1");
model.geom().create("geom1", 3);
model.geom("geom1").feature().create("blk1","Block");
model.geom("geom1").feature("blk1").set("size", new String[]{"0.1", "0.2", "0.5"});
model.geom("geom1").run("fin");
return model;
}

}


However, when I try and run the test code I get a bunch of java.IOExceptions like the following:

java.io.IOException: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher
at javax.crypto.CipherInputStream.close(CipherInputStream.java:321)
at com.comsol.model.util.BuilderUtil.getBuilderFileType(Unknown Source)
at com.comsol.model.util.BuilderUtil.loadGeneralDesgin(Unknown Source)
at com.comsol.design.util.BuilderContributor.a(Unknown Source)
at com.comsol.design.util.BuilderContributor.getBuilders(Unknown Source)
at com.comsol.design.migration.DeployedMigrationHelper.getMigrationHelpers(Unknown Source)
at com.comsol.migration.g.e(Unknown Source)
at com.comsol.migration.e.d(Unknown Source)
at com.comsol.migration.e.f(Unknown Source)
at com.comsol.model.util.ModelInternalUtil.create(Unknown Source)
at com.comsol.model.util.ModelInternalUtil.create(Unknown Source)
at com.comsol.model.util.ModelUtil$1.a(Unknown Source)
at com.comsol.model.util.ModelUtil$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.comsol.model.util.ModelUtil.create(Unknown Source)
at comsol_test_2.hell_world.run(hell_world.java:13)
at comsol_test_2.hell_world.main(hell_world.java:9)
Caused by: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:913)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:824)
at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:436)
at javax.crypto.Cipher.doFinal(Cipher.java:2048)
at javax.crypto.CipherInputStream.close(CipherInputStream.java:314)

Any help would be appreciated.

0 Replies Last Post Apr 21, 2015, 6:07 p.m. EDT
COMSOL Moderator

Hello Duncan McGregor

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.