tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anthony Fryer <>
Subject Re: Use single JAXBContext for multiple web services
Date Sun, 15 Jun 2014 11:25:51 GMT
I implemented using the ResourceAsService wrapper as you suggested and it
works.  I think that ResourceAsService could be useful enough to be included
in tomee.

My ResourceAsService class is....

public class ResourceAsService {
	private String resourceId;

	public String getResourceId() {
		return resourceId;

	public void setResourceId(String resourceId) {
		this.resourceId = resourceId;
	public Object get() throws Exception {
		if (resourceId == null) {
			throw new IllegalArgumentException("Please specify a resourceId");
+ resourceId);


My resources.xml now looks like this...

   <Resource id="myJAXBContextResource"

   <Service id="myJAXBContextService"
class-name="" factory-name="get">
      resourceId = myJAXBContextResource
   <Service id="myJAXBDataBinding"
class-name="org.apache.cxf.jaxb.JAXBDataBinding" constructor="jaxbContext">
      jaxbContext = $myJAXBContextService

And my GlobalJAXBContext class has gone back to this...

public class GlobalJAXBContext {
	public static JAXBContext getJAXBContext() {
		try {
			return JAXBContext.newInstance(new Class[] {
		} catch (JAXBException e) {
		return null;

and everything boots up quickly like before.  Thanks for the suggestion.

As for documentation...i would if i get time from my project.  Is there
documention on how to contribute?

View this message in context:
Sent from the OpenEJB User mailing list archive at

View raw message