开发者

Using eclipselink in Java code run from MATLAB

开发者 https://www.devze.com 2023-01-29 07:05 出处:网络
I am trying to provide an interface that I can call from MATLAB to access the contents of a database. I already have an existing Java interface that uses eclipselink to connect to the database and I w

I am trying to provide an interface that I can call from MATLAB to access the contents of a database. I already have an existing Java interface that uses eclipselink to connect to the database and I would like to re-use it. I wrote a class to provide this and it works properly when I call it straight from Java, but when I try to call it from MATLAB I get the following exception:

javax.开发者_如何学Gopersistence.PersistenceException: No Perisistence provider for EntityManager named DatabaseConnection

Usually this exception occurs when I do not have the META-INF folder with the persistence.xml on the classpath properly, but I have tried putting the base folder that contains the META-INF folder on both the dynamic and static MATLAB javaclasspaths with no success. Again, this exact code (including the persistence.xml) work fine when run from java. Does anyone know what I am missing?

The one main difference that I was able to track down from what occurs when I run the java code is that MATLAB is using a OSGI classloader (felix) rather than the default classloader that Java uses, but I haven't figured out what difference that makes to finding the persistence.xml.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号