0 Replies Latest reply on Mar 18, 2008 12:23 PM by Ales Justin

    Pb deploying vfs file

    Ales Justin Master

      It's this piece of code in PersistenceUnitParsingDeployer that doesn't like your virtual file:

       protected PersistenceUnitsMetaData parse(VFSDeploymentUnit unit, VirtualFile file, PersistenceUnitsMetaData root)
       throws Exception
       VirtualFile persistenceRoot = file.getParent().getParent();
       // We can't pass in a VFS url.
       //URL persistenceUnitRootUrl = persistenceRoot.toURL();
       // FIXME: is this a supported hack?
       // This introduces severe regression, will go the jar: url way (EJB-326)
       //URL persistenceUnitRootUrl = new URL("jarjar:" + persistenceRoot.getHandler().toURL());
       // http://opensource.atlassian.com/projects/hibernate/browse/EJB-326
       URL persistenceUnitRootUrl = persistenceRoot.getHandler().toURL();
       assert persistenceUnitRootUrl.getProtocol().equals("jar") || persistenceUnitRootUrl.getProtocol().equals("file") : "expected a jar or file url, but was " + persistenceUnitRootUrl;
       URL persistenceXmlUrl = file.toURL();
       PersistenceUnitsMetaData metaData = new PersistenceUnitsMetaData(persistenceUnitRootUrl, PersistenceXmlLoader.deploy(persistenceXmlUrl, new HashMap<String, String>(),
       new EJB3DTDEntityResolver(), PersistenceUnitTransactionType.JTA));
       log.info("Found persistence units " + metaData);
       // FIXME: if in EAR then unscoped else scoped
       return metaData;

      See the assert for the problem/cause.

      Dunno what else you could do than to fix how this PUPD handles this kind of urls.
      e.g. change this deployer, since it's just one of the aspects in the new aspectized deployers :-)