JAXBContextFactory Not Found [message #642854] |
Thu, 02 December 2010 19:41  |
Eclipse User |
|
|
|
Hi,
I wrote a webservice that has some data model classes and I'm using JAXB to generate the XML from those classes in the responses. Initially the model classes were part of the webservice project and included in the war in the WEB-INF/classes directory. I want to be able to reuse the model classes for my client code, so I refactored them out into a separate project that builds a jar that the webservice project now depends on.
Initially I had a jaxb.properties file in my war project classpath which I moved it to the jar file project as well. It has this entry:
javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
I'm deploying to Glassfish v3 which is supposed to use EclipseLink as its JAXB implementation by default.
The problem is when I deploy the war with the model classes jar, I get this exception:
javax.ws.rs.WebApplicationException: javax.xml.bind.JAXBException
- with linked exception:
[java.lang.ClassNotFoundException: org.eclipse.persistence.jaxb.JAXBContextFactory]
at com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.writeTo(AbstractRootElementProvider.java:151)
It doesn't seem to matter if I have a jaxb.properties file in my classpath or not (I've added it to the war, jar and neither).
I'm using Maven so my initial war pom.xml had this dependency:
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.2.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
When I created the jar project I included the dependency in its pom.xml and removed it from the war's. When that didn't work, I added it back into the war's but still get the same error.
I'm so confused. Since the dependency is "provided" it's never included in the war regardless of which project pom its in. It shouldn't make a difference to how Glassfish finds it, should it?
Any advice on this is greatly appreciated as I have no ideas what could be causing the problem.
Thanks!
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04908 seconds