Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] JPA: Toplink / Eclipselink works in Netbeans, not as standalone .JAR

Since it is your own application server, I am not sure how the classloader architecture works, but I can describe a bit about how Persitence.createEMF() works, and perhaps you can find the problem.

When you call Persistence.createEntityManagerFactory(), the Persistence class will go out searching for a Persistence provider service by getting a resources from the classloader via ClassLoader.getResources(). It looks for a file in "META-INF\services\" called "javax.persistence.spi.PersistenceProvider". That file will contain the names of one or more classes that can provide the persistence service. The persistence class will then iterate through all the classes that it finds and ask them in turn to create an EntityManagerFactory. When it finds one that returns an EntityManagerFactory, it returns that EMF.

If I were going to debug this, I would start by looking what services files are available to the classloader you are using by asking that classloader for those resources. If you do not get the one from the eclipselink.jar, that is likely your problem. If you do, then we'll have to debug further.

-Tom

dyamanoha wrote:
!! Sorry if this is a duplicate post, I accidentally logged in under a
different account ant it was saying that there had been no post yet. !!

Hey Tom, thanks for the reply


tware wrote:
What application server are you running?  What version?  Is EclipseLink
installed?


We're trying to run our own game server. This application that we're trying
to start up _is_ the server.


tware wrote:
Based on your error message, it looks like you have TopLink Essentials but
not EclipseLink.

org.eclipse.persistence.jpa.PersistenceProvider is the EclipseLink
persistence provider and EclipseLink will need to be available to your app server to allow you to use it.


Reexamining the jar tf, I found that, indeed, I have the bytecode you
referenced above.

jar tf gatewayserver.jar (output):

META-INF/
META-INF/MANIFEST.MF
...
META-INF/persistence.xml
META-INF/maven/
META-INF/maven/com.novel.tech1/
META-INF/maven/com.novel.tech1/gatewayserver/
META-INF/maven/com.novel.tech1/gatewayserver/pom.xml
META-INF/maven/com.novel.tech1/gatewayserver/pom.properties
...
org/eclipse/persistence/jpa/PersistenceProvider.class


Here's a reference to how we're attempting to load the pu (The last line of
the class method should be the only relevant one).  Once again, this works
from within the netbeans ide, but fails to run as a standalone jar.

http://pastebin.com/XEEXbGBK




Back to the top