3 Replies Latest reply on Feb 26, 2017 1:26 AM by Anup Dey

    org.eclipse.persistence.jaxb.JAXBContext creation issues

    leor amikam Newbie

      Running jboss eap7.  Migrating from WLS. I have an ejb project that uses eclipselink Moxy.  Inside an EJB, I have a static initializer:


          private static org.eclipse.persistence.jaxb.JAXBContext jaxbContexL1;


          static {

             jaxbContexL1 =  JAXBContextFactory.createContext(new Class[] {Level1PayloadType.class}, null);



      I then reference the context in a method, and that works fine.  However, in the method, I then have to create a context for another class at runtime. Example:


      Object val;
      Class cls = val.getClass();



                    org.eclipse.persistence.jaxb.JAXBContext jaxbContext =




      This generates the error:  com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to org.eclipse.persistence.jaxb.JAXBContext

      I have the property set in jax.properties file in the ejb.  I am assuming this is a classloader issue, and not sure how to get correct libs to load.