4

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.persistence.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.

2
  • 1
    Probable dup of stackoverflow.com/questions/4376565/java-jpa-class-for-matlab. What are the odds of two Matlab/JPA/Eclipse/classpath questions in 24 hours? Do you work with Reilly? (Summary: put the eclipselink and your user JARs on the static classpath, too.) Commented Dec 8, 2010 at 18:54
  • I tried jarring up the code that I was working with (I had previously been pointing to the bin folder directly) along with the META-INF folder at the top level. I put this as the very first thing on the static classpath (in classpath.txt) along with a number of other jars that it is dependant on (including eclipselink). Unfortunately I got the same error. Commented Dec 9, 2010 at 15:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.