persistence@glassfish.java.net

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

From: Sanjeeb Kumar Sahoo <Sanjeeb.Sahoo_at_Sun.COM>
Date: Tue, 14 Mar 2006 07:32:56 +0530

Hi Tom,

Marina and Mitesh are right. entities.jar can not be embedded inside
persistence.jar. jar files can only be put inside WEB-INF/lib or in ear
file. I hope, by now, you have resolved the issue.

Thanks,
Sahoo
Marina Vatkina wrote:

>Tom,
>
>It's not allowed to package a jar into an ejb-jar, only into a
>war.
>
>Run a verifier to identify any such problems.
>
>regards,
>-marina
>
>Tom Ware wrote On 03/13/06 13:31,:
>
>
>>Ok, Thanks, we've got the right logger changed. Here is our error message:
>>
>>[#|2006-03-13T16:28:29.265-0500|FINE|sun-appserver-pe9.0|javax.enterprise.system.core.classloading|_ThreadID=16;_ThreadName=Thread-30;ClassName=PersistenceUnitLoaderImpl$PersistenceUnitInfoImpl;MethodName=initJarFiles;C:\GlassFish\glassfish\domains\domain1\applications\j2ee-apps\blog5\lib\entities_jar;_RequestID=b62677c2-e048-409b-b4b4-d5441b1ecac1;|jarFile
>>=
>>C:\GlassFish\glassfish\domains\domain1\applications\j2ee-apps\blog5\lib\entities_jar
>>does not exist|#]
>>
>>Currently, the entities.jar file is actually contained within the
>>persistence.jar file and therefore doesn't appear directly in the
>>GlassFish\glassfish\domains\domain1\applications\j2ee-apps\blog5\lib
>>directory. Should we be deploying with entities.jar at the same lavel
>>as persistence.jar?
>>
>>-Tom
>>
>>Mitesh Meswani wrote:
>>
>>
>>
>>
>>>Tom Ware wrote:
>>>
>>>
>>>
>>>
>>>
>>>>Hi Mitesh,
>>>>
>>>>Looking at the code below, I would expect to see a logged message of
>>>>the form: "jarFile = {0} does not exist" in our log if there was an
>>>>issue with the URL we are providing.
>>>>
>>>>We configured logging to be FINE in our admin console and still
>>>>cannot see that message. Is there anything special we should to in
>>>>order to see that logging message?
>>>>
>>>>
>>>>
>>>>
>>>The logger used to log that message is classloader. Is that the logger
>>>you changed the level for?
>>>
>>>Thanks,.
>>>Mitesh
>>>
>>>
>>>
>>>
>>>
>>>>-Tom
>>>>
>>>>Mitesh Meswani wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>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
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>
>>