I use Hibernate in an extension-like server-side application, and I put my binaries to the Extensions folder of the server application. The problem is, that if I run the server, the root folder is the root folder of the server application, and not the root of the binaries. Thus, Hibernate searches the config file in that folder, and it tries to find the classes from that folder. I guess this is related to the JVM, as the server launches it. The config file is not a problem though, because I can just copy my config files there, but all the paths gone invalid. As a result, in my generated mapping file, I have a class org.gmate.data.SomeClass.java, but it won't find it.
My question: Is there any way, solution or开发者_开发知识库 workaround, that I can set the root folder of Hibernate to be the Extension folder, so it starts to get the classes from there?
Thanks for all the replies in advance, gmate
I finally found the solution for my problem. The problem was not the assumed root folder as I thought, but the Class Loader that the server uses. As it was in my Extensions folder, a CustomClassLoader loaded my classes. and they did not appear in the classpath. As I moved my clsses into a jar file, and added that jar file to the classpath, I managed to use hibernate. Adding the Extension folder to the classpath resulted in loading these classes with SystemClassLoader, but then the advantages of the Custom ClassLoader dissappeared.
精彩评论