web stats
Mirth Community - View Single Post - NoSuchMethodError using JPA
View Single Post
Old 07-21-2016, 02:32 AM
rafraider rafraider is offline
Mirth Newb
Join Date: Jul 2016
Posts: 6
rafraider is on a distinguished road

Originally Posted by narupley View Post
We did add a way to do this though. In JavaScript you can call ContextFactory.getIsolatedClassLoader() to get a ClassLoader that only includes the resources you have set on that specific connector, and does not include the overall server classloader as a parent. With that you can call loadClass directly. You can create instances with newInstance or by getting the Constructor first. Commons Lang also includes a ConstructorUtils class.
It woul be nice, if i could use it, but the code of the JavaScript part looks like this:

var internalId = parseInt($("internalId"));
var documentCreator = new Packages.mypackage.DocumentCreator(internalId);

try {
} catch (err) {
There are many obstacles with that kind of class loading policy.
  1. when writing own class libraries you have to know all the hundreds of libraries the mirth connect server is using.
  2. you have to load every conflicting class with isolated class loader
  3. you have to write the process of your use cases in the javascript part
  4. need a lot of programming skills
  5. maintanance is hard

My suggestions:
  1. the first classloader should be the isolated class loader. In this case writing independent libraries would be easy.
  2. maybe add an option to channels or to destination connectors, which allows to configure which class loader should be used

i wanted the JavaScript code to be as little as possible. The whole process is done in Java. I can't load the class in Java via isolatedClassLoader.
the library i have writen is already compiled using the javax.persistence.EntityManager interface.

Is it possible to overload the global loaded EntityManager interface of mirth connect in the javascript code?

Last edited by rafraider; 07-22-2016 at 01:23 AM.
Reply With Quote