Using JPA-RS in Equinox (via gemini) [message #1709246] |
Fri, 25 September 2015 04:42  |
Eclipse User |
|
|
|
Hy there,
I managed to create an equinox based applicatoin, that uses gemini to provide PersistenceUnits. I also managed to provide Entities within this PU according to the tutorial in https://wiki.eclipse.org/EclipseLink/Examples/REST/GettingStarted/RestService.
The problem however is, that according to this solution I have to code the entire REST interface myself - thus I found JPA-RS.
Unfortunately I do not seem to manage to get it running in Equinox. I already have a product that starts my equinox env, and jetty is already there as I use REST in other parts.
What have I done so far? I added org.eclipse.persistence.jpars and its dependencies to my run-configuration and started the bundle in my container. Yet I can't access the url. I also failed in finding a tutorial to employ JPA-RS in Euqinox (there is for glassfish etc.). What have I done wrong? Do I need to start by means of an JPARSApplication ??
Thanks a lot!
[Updated on: Tue, 29 September 2015 09:41] by Moderator
|
|
|
|
|
|
Re: Using JPA-RS in an Equinox application [message #1709591 is a reply to message #1709568] |
Tue, 29 September 2015 09:01  |
Eclipse User |
|
|
|
Okay, I think I'll stop now ... too hard to get JPA-RS run with GEMINI .. I found out, however, that the problem lies in the classloading. In
org.eclipse.persistence.jaxb.javamodel.oxm.OXMJavaModelImpl
public JavaClass getClass(Class<?> jClass) {
if (jClass == null) {
return null;
}
String className = jClass.getCanonicalName();
JavaClass cachedClass = this.javaModelClasses.get(className);
if (cachedClass != null) {
return cachedClass;
}
// try actually finding the class, might be concrete
try {
if (jClass.isArray()) {
className = jClass.getName();
}
Class<?> realClass = PrivilegedAccessHelper.getClassForName(className, true, classLoader);
if (realClass != null) {
JavaModelImpl jm = new JavaModelImpl(classLoader);
JavaClassImpl jc = new JavaClassImpl(realClass, jm);
return jc;
}
} catch (Exception e) {
}
return new OXMJavaClassImpl(jClass.getCanonicalName());
}
it will always silently fail to load the XMLElementNillable.class which results in the Exception. I think it would be a good thing to not silently swallow the exception but provide at least the most minimal log output.
The chain of classloaders is far too complicated, yet I do not understand why it it fails to load a class that is co-located to the mentioned class (just in another package).
I would be really glad if someone deeper involved would just give me a very small feedback.
|
|
|
Powered by
FUDForum. Page generated in 0.03603 seconds