public MeemContent load(MeemPath meemPath) { if (DEBUG) { logger.info("Loading content for " + meemPath); } MeemContent meemContent = new MeemContent(); // This classloader change is to allows classes loaded by eclipse to perform Class.forName() ClassLoader previousClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); try { EntityManager em = PersistenceContext.instance().getEntityManager(); em.getTransaction().begin(); @SuppressWarnings("unchecked") List<ContentEntity> content = em.createNamedQuery("Content.selectForMeem") .setParameter(1, meemPath.getLocation()) .getResultList(); for (ContentEntity contentItem : content) { meemContent.addPersistentField( contentItem.getWedgeName(), contentItem.getName(), contentItem.getValue()); } em.getTransaction().commit(); } catch (Exception e) { logger.log(Level.INFO, "Exception while loading MeemContent " + meemPath.toString(), e); } finally { PersistenceContext.instance().release(); } } finally { Thread.currentThread().setContextClassLoader(previousClassLoader); } return meemContent; }