Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
Im using JPF to develop an application that have a plugin architecture.
The problem come when im trying to use JPA (Java Persistence API).
To develop a JPA application they need to create a folder named META-INF, and a file named persistence.xml in this folder.
In a normal java application we put the META-INF folder in the default directory, and all is OK, but in a JPF architecture, the situations is more confusing..
Thanks to everyone!!
PD: Sorry with my english, I'm spanish
The solution depends on how they try to load that file. If they load it from the classpath, then you can add that custom folder to the classpath using your plugin.xml file and then that library should be able to find it just fine. An example of adding a folder to the classpath is included below. Please note that you should only have one "runtime" section, so just add the "library" section below to your existing runtime section.
<library id="META-INF" path="META-INF/" type="resources">
<export prefix="*" />
Once you make that declaration, then just create the META-INF folder in the root of your plugin's folder.
Thanks for the reply.
The application load the META-INF/persistene.xml directly from the classpath.
I think that JPF only load class files from the classpath, and trunk all files that no have .class extension..
JPF will in fact load files from the classpath besides .class files. That is what the type="resources" part does instead of the normal type="code". We are using this to load all types of files extensively in our application without any problems. If this does not work for you then there might be some other problem. Sometimes it can be tricky when working with 3rd party libraries, which might require you to set the current context class loader to be the JPF class loader for your plugin. You can get your plugin class loader from the PluginManager class and then use code like the following to set the context class loader before calling a 3rd party library:
THANKS, THANKS ... IT WORKS.. XD
I´ve changed the ContextClassLoader, and load correctly the META-INF/persistence.xml file.
Thank you very much..