persistence@glassfish.java.net

Re: entity-persistence CTS Issue - persistence xml with <mapping-file>

From: Mitesh Meswani <mitesh.meswani_at_Sun.COM>
Date: Mon, 13 Mar 2006 12:43:06 -0800

Hi Tom,

I have not yet looked into the ear. Meanwhile, here is the code from
PersistenceunitInfoImpl that creates the list that getJarFileUrls()
return.

Thanks,
Mitesh

  private List<URL> _getJarFiles() {
        List<String> jarFileNames = new ArrayList<String>(
                persistenceUnitDescriptor.getJarFiles());
        List<URL> jarFiles = new ArrayList<URL>(jarFileNames.size() + 1);
        String absolutePuRoot = getAbsolutePuRootFile().getAbsolutePath();
        for (String jarFileName : jarFileNames) {
            String nativeJarFileName = jarFileName.replace('/',
                    File.separatorChar);
            // only components are exploded, hence first look for
original archives.
            File jarFile = new File(new
File(absolutePuRoot).getParentFile(),
                    nativeJarFileName);
            if (!jarFile.exists()) {
                // if the referenced jar is itself a component, then
                // it might have been exploded, hence let's see
                // if that is the case.
                jarFile = new File(new File(absolutePuRoot).getParentFile(),
                        FileUtils.makeFriendlyFileName(nativeJarFileName));
            }
            if (jarFile.exists()) {
                try {
                    jarFiles.add(jarFile.toURI().toURL());
                } catch (MalformedURLException e) {
                    throw new RuntimeException(e);
                }
            } else {
                // TODO: Should be a caught by verifier.
                PersistenceUnitInfoImpl.logger.logp(Level.FINE,
                        "PersistenceUnitLoaderImpl$PersistenceUnitInfoImpl",
                        "initJarFiles", "jarFile = {0} does not exist",
                        jarFile);
            }
        }
        return jarFiles;
    }



Tom Ware wrote:
> Hi all,
>
> Hopefully someone can help us out. We are debugging a CTS issue in
> the entity-persistence module and we are seeing the following problem:
>
> We are deploying the attached ear file and trying to make use of the
> persistence unit defined in persistence.jar. When we call
> getJarFileUrls() on the PersitenceUnitInfo instance we are given in
> createContainerEntityManagerFactory(), we get an empty list. How
> build our ear and write our persistence.xml file so the result of
> getJarFileUrls() includes a URL to entities.jar?
>
> -Tom