[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] [MOXy] Putting sessions.xml in alternate location

Hi,

I have been able tell EclipseLink to find the project.xml file anywhere in
the classpath, but now I have a similar problem with the sessions.xml file. 
I would like to move that file away from the root of the classpath also. 
Here is the problem:

I have a common jar file that contains some common classes and EclipseLink
MOXy mappings.  It contains its own sessions.xml file in the root of this
jar.

I have an application that contains its own specific classes and EclipseLink
MOXy mappings.  It contains its own sessions.xml file in the root src/
directory.

During runtime, the two sessions.xml files conflict because they are both at
the root.  I saw in the documentation that is ok to move the sessions.xml
file to a different path.  

However, I am not directly calling SessionManager, so I am not sure how to
pass in this different path.  I am using Spring-WS with a contextPath, which
lets JAXB find the jaxb.properties file.  Then the jaxb.properties file
points to the EclipseLink JAXBContextFactory.  Then JAXB calls
JAXBContextFactory.createContext(String, Classloader), which in turn calls
XMLContext(String, ClassLoader).  Then the factory throws:

Exception [EclipseLink-50000] (Eclipse Persistence Services - 1.0 (Build 1.0
- 20080707)): org.eclipse.persistence.exceptions.JAXBException
Exception Description: The path com.foo.model contains no ObjectFactory or
jaxb.index file and no sessions.xml was found
	at
org.eclipse.persistence.exceptions.JAXBException.noObjectFactoryOrJaxbIndexInPath(JAXBException.java:44)
	... 41 more

I see that XMLContext has another constructor that takes an "xmlResource"
argument that would be used to specify a different sessions.xml path, but
how do I get to it?  Or is there another way that you recommend for solving
this problem?  Otherwise, it seems like I need to build a jar without the
sessions.xml if the jar is going to be reused by others.

Thanks,
Polly
-- 
View this message in context: http://www.nabble.com/-MOXy--Putting-sessions.xml-in-alternate-location-tp18947072p18947072.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.