web stats
Mirth Community - View Single Post - NoSuchMethodError using JPA
View Single Post
  #1  
Old 07-19-2016, 12:48 AM
rafraider rafraider is offline
Mirth Newb
 
Join Date: Jul 2016
Posts: 6
rafraider is on a distinguished road
Default NoSuchMethodError using JPA

Mirth Connect 3.4.1
Windows Server 2008 R2
Java 1.8_92

Hi,

i have written a java library that is creating a PDF. It's a dump of all data of a patient in our database.
In that library i'm using the eclipselink java persistence api (JPA).

I created a new resource containing my library and all dependent libraries:
commons-lang3-3.4
eclipselink
itextpdf-5.5.9
javax.persistence_2.1.1.v201509150925
jcifs-1.3.18
mysql-connector-java-5.1.23-bin
org.eclipse.persistence.jpars_2.6.3.v20160428-59c81c5

The very first time i try to create a query, a NoSuchMethodError is thrown by the entity manager.

The mysterious thing is:
I testet the instance of the variable with reflection. The instance of the variable is definitely a org.eclipse.persistence.internal.jpa.EntityManager Impl

I can run the process on my local pc or even on the server via command line and there is no problem. There is a main method creating some test documents.

I know that Rhino is using a class loader, but maybe there's a problem with using interfaces?
The variable is an interface javax.persistence.EntityManager and the instance is the EntityMangerImpl. When i try to call the method of the interface Rhino can not find the method of the implementation instance?

Or is there maybe a conflict with the persistence library which Mirth Connect is using?

The exception:
Code:
[2016-07-15 12:18:22,250]  ERROR (com.mirth.connect.connectors.js.JavaScriptDispatcher:193): Error evaluating JavaScript Writer (JavaScript Writer "..." on channel ...).
java.lang.NoSuchMethodError: javax.persistence.EntityManager.createNamedQuery(Ljava/lang/String;Ljava/lang/Class;)Ljavax/persistence/TypedQuery;
	at ....getPatient(....java:50)
	at ....createDocument(....java:680)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
	at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225)
	at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1479)
	at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:815)
	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109)
	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3280)
	at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:120)
	at com.mirth.connect.server.util.javascript.JavaScriptTask.executeScript(JavaScriptTask.java:142)
	at com.mirth.connect.connectors.js.JavaScriptDispatcher$JavaScriptDispatcherTask.doCall(JavaScriptDispatcher.java:149)
	at com.mirth.connect.connectors.js.JavaScriptDispatcher$JavaScriptDispatcherTask.doCall(JavaScriptDispatcher.java:122)
	at com.mirth.connect.server.util.javascript.JavaScriptTask.call(JavaScriptTask.java:113)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

Last edited by rafraider; 07-19-2016 at 04:42 AM.
Reply With Quote