[jboss-jira] [JBoss JIRA] (AS7-5062) PersistenceUnitRootURL for JPA providers may not be spec compliant

Craig Ringer (JIRA) jira-events at lists.jboss.org
Fri Jul 6 06:46:12 EDT 2012


    [ https://issues.jboss.org/browse/AS7-5062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12704773#comment-12704773 ] 

Craig Ringer commented on AS7-5062:
-----------------------------------

It looks like EclipseLink can't use its generic Jar handler because VirtualJarInputStream.read(byte[], int, int) returns -1 when the first read is attempted with params off=0, len=30 by JarInputStream.

That EOF appears to arise because VFSUtils$1.read(), which is the anonymous InputStream subclass VFSUtils.EMPTY_STREAM, always returns -1 .

The VirtualJarInputStream for "/content/nymm-entitydeploy.war" (one of my Arquillian integration tests tests) has a `root'  VirtualFile member with path "/content/nymm-entitydeploy.war/WEB-INF/classes", as you'd expect.

I'm not sure why the VirtualJarInputStream wraps a VFSUtils.EMPTY_STREAM yet and I'm out of time for today. Hope this delving is of some utility.


{code}
VFSUtils$1.read() line: 786	
VFSUtils$1(InputStream).read(byte[], int, int) line: 170	
VirtualJarInputStream.read(byte[], int, int) line: 149	
PushbackInputStream(FilterInputStream).read(byte[], int, int) line: 133	
PushbackInputStream.read(byte[], int, int) line: 186	
JarInputStream(ZipInputStream).readFully(byte[], int, int) line: 424	
JarInputStream(ZipInputStream).readLOC() line: 277	
JarInputStream(ZipInputStream).getNextEntry() line: 121	
JarInputStream.getNextEntry() line: 142	
ArchiveFactoryImpl.isJarInputStream(URL) line: 143	
ArchiveFactoryImpl.createArchive(URL, String, Map) line: 118	
ArchiveFactoryImpl.createArchive(URL, Map) line: 58	
PersistenceUnitProcessor.getClassNamesFromURL(URL, ClassLoader, Map) line: 425	
MetadataProcessor.initPersistenceUnitClasses() line: 298	
MetadataProcessor.processEntityMappings(PersistenceUnitProcessor$Mode) line: 515	
PersistenceUnitProcessor.processORMetadata(MetadataProcessor, boolean, PersistenceUnitProcessor$Mode) line: 546	
EntityManagerSetupImpl.predeploy(PersistenceUnitInfo, Map) line: 1469	
PersistenceProvider.createContainerEntityManagerFactory(PersistenceUnitInfo, Map) line: 208	
PersistenceUnitServiceImpl.createContainerEntityManagerFactory() line: 162	
PersistenceUnitServiceImpl.start(StartContext) line: 85	
ServiceControllerImpl$StartTask.startService(Service<? extends S>, StartContext) line: 1811	
ServiceControllerImpl$StartTask.run() line: 1746	
ServiceContainerImpl$ContainerExecutor(ThreadPoolExecutor).runWorker(ThreadPoolExecutor$Worker) line: 1110	
ThreadPoolExecutor$Worker.run() line: 603	
ServiceContainerImpl$ServiceThread(Thread).run() line: 722		
{code}
                
> PersistenceUnitRootURL for JPA providers may not be spec compliant
> ------------------------------------------------------------------
>
>                 Key: AS7-5062
>                 URL: https://issues.jboss.org/browse/AS7-5062
>             Project: Application Server 7
>          Issue Type: Bug
>          Components: JPA / Hibernate
>    Affects Versions: 7.1.1.Final
>         Environment: $ java -version
> java version "1.7.0_03-icedtea"
> OpenJDK Runtime Environment (fedora-2.2.1.fc17.8-x86_64)
> OpenJDK 64-Bit Server VM (build 23.0-b21, mixed mode)
> $ uname -a
> Linux ayaki.localdomain 3.4.2-4.fc17.x86_64 #1 SMP Thu Jun 14 22:22:05 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
>            Reporter: Craig Ringer
>            Assignee: Scott Marlow
>              Labels: compatibility, eclipselink, jpa, spec
>
> Discussion on the EclipseLink bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=383200 ("On JBoss AS 7, EclipseLink doesn't find entity classes unless they're explicitly listed in persistence.xml") suggests that JBoss AS 7 may not be providing a spec-compliant PersistenceUnitRootURL or contents.
> EclipseLink can't scan the contents of a deployment for @Entity annotated classes, so it doesn't find any entities unless they're explicitly named in persistence.xml .
> http://docs.oracle.com/javaee/6/api/javax/persistence/spi/PersistenceUnitInfo.html#getPersistenceUnitRootUrl() states:
> {quote}
> java.net.URL getPersistenceUnitRootUrl()
> Returns the URL for the jar file or directory that is the root of the persistence unit. (If the persistence unit is rooted in the WEB-INF/classes directory, this will be the URL of that directory.) The URL will either be a file: URL referring to a jar file or referring to a directory that contains an exploded jar file, or some other URL from which an InputStream in jar format can be obtained.
> *Returns*: a URL referring to a jar file or directory
> {quote}
> ... and that's what EclipseLink expects. However, for EclipseLink class scanning to function correctly an adapter class must be provided, such as the classes provided here:
> https://community.jboss.org/wiki/HowToUseEclipseLinkWithAS7
> to integrate EclipseLink with JBoss's VFS. 
> It may be worth investigating why this is necessary and whether the current behavior is standards compliant.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list