Albert, Abe is our resident expert on Serp. Since he's been busy with other projects, I will copy him on this note to see if he has some ideas on the classloaders for the Serp calls.
Kevin On 9/12/07, Albert Lee (JIRA) <[EMAIL PROTECTED]> wrote: > > > [ > https://issues.apache.org/jira/browse/OPENJPA-367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12526849] > > Albert Lee commented on OPENJPA-367: > ------------------------------------ > > From initial investigation, here is the call stack that shows the call > path to CFMetaDataParser.classForName() > > CFMetaDataParser.classForName(String, String, boolean, ClassLoader) > line: 307 > XMLPersistenceMetaDataParser(CFMetaDataParser).classForName(String, > boolean) line: 285 > XMLPersistenceMetaDataParser.classForName(String) line: 1679 > XMLPersistenceMetaDataParser.startClass(String, Attributes) line: 727 > XMLPersistenceMetaDataParser(CFMetaDataParser).startElement(String, > Attributes) line: 108 > XMLPersistenceMetaDataParser(XMLMetaDataParser).startElement(String, > String, String, Attributes) line: 432 > SAXParserImpl$JAXPSAXParser(AbstractSAXParser).startElement(QName, > XMLAttributes, Augmentations) line: not available > XMLSchemaValidator.startElement(QName, XMLAttributes, Augmentations) > line: not available > XMLNSDocumentScannerImpl.scanStartElement() line: not available > > XMLNSDocumentScannerImpl$NSContentDispatcher(XMLDocumentFragmentScannerImpl$FragmentContentDispatcher).dispatch(boolean) > line: not available > > XMLNSDocumentScannerImpl(XMLDocumentFragmentScannerImpl).scanDocument(boolean) > line: not available > XIncludeAwareParserConfiguration(XML11Configuration).parse(boolean) > line: not available > XIncludeAwareParserConfiguration(XML11Configuration).parse(XMLInputSource) > line: not available > SAXParserImpl$JAXPSAXParser(XMLParser).parse(XMLInputSource) line: not > available > SAXParserImpl$JAXPSAXParser(AbstractSAXParser).parse(InputSource) line: > not available > SAXParserImpl.parse(InputSource, DefaultHandler) line: not available > XMLPersistenceMetaDataParser(XMLMetaDataParser).parseNewResource(Reader, > String) line: 376 > XMLPersistenceMetaDataParser(XMLMetaDataParser).parse(MetaDataIterator, > boolean) line: 318 > XMLPersistenceMetaDataParser(XMLMetaDataParser).parse(MetaDataIterator) > line: 295 > XMLPersistenceMetaDataParser(XMLMetaDataParser).parse(URL) line: 268 > PersistenceMetaDataFactory.parseXML(URL, Class, int, ClassLoader) line: > 247 > PersistenceMetaDataFactory.load(Class, int, ClassLoader) line: 198 > MetaDataRepository.getMetaDataInternal(Class, ClassLoader) line: 470 > MetaDataRepository.getMetaData(Class, ClassLoader, boolean) line: 290 > PCEnhancer.<init>(OpenJPAConfiguration, BCClass, MetaDataRepository, > ClassLoader) line: 242 > PCEnhancer.run(OpenJPAConfiguration, String[], PCEnhancer$Flags, > MetaDataRepository, BytecodeWriter, ClassLoader) line: 4349 > PCEnhancer.run(OpenJPAConfiguration, String[], Options) line: 4296 > PCEnhancer.main(String[]) line: 4268 > > In the failing case, serp.Strings.toClass() method returns a different > Class object from the Class object used by the MetaDataRepository, as a > result, the look up of the meta data from the MetaDataRepository._meta map > will not find the meta data, even there is one in the _meta map with a > different Class object key. > > If a target is passed to the enhencer, serp.Strings.toClass() returns the > same Class object, hence the look up in the MetaDataRepository succeeded. > > This implies serp returns a entity Class object using a different > classloader. From what I notice, both calls (pass & fail cases) to the > serp.Strings.toClass() method uses the same TemporaryClassLoader. > > Since I have no access to the Serp code, I don't know what Serp does and > what is the difference that cause the failure. > > I am looking for someone who can shred some light into this problem. > > Thanks. > Albert Lee. > > > PCEnhancer does not find meta data for entities using pure XML > annotation > > > ------------------------------------------------------------------------- > > > > Key: OPENJPA-367 > > URL: https://issues.apache.org/jira/browse/OPENJPA-367 > > Project: OpenJPA > > Issue Type: Bug > > Components: kernel > > Affects Versions: 1.0.0 > > Environment: All platforms > > Reporter: Albert Lee > > Attachments: OPENJPA-367.test.jar > > > > > > When an entity is defined using pure XML (i.e. no annotation in the > entity class), the enhancer does not recognized the meta data and no > enhancing will take place: E.g. > > ----------------------------------------- > > C:\temp\test>runPcEnhancer.bat > > C:\temp\test>java -cp C:\temp\test\;C:\temp\test\openjpa- > 1.1.0-SNAPSHOT.jar > ;C:\temp\test\utils.jar;C:\temp\test\geronimo-jpa_3.0_spec-1.0.jar > ;C:\temp\test\geronimo-jta_1.1_spec-1.1.jar > org.apache.openjpa.enhance.PCEnhancer > > 15 EntityUnit_JSE TRACE [main] openjpa.Runtime - Setting the > following properties from "file:/C:/temp/test/META-INF/persistence.xml" into > configuration: {openjpa.Id=EntityUnit_JSE, openjpa.Log=DefaultLevel=TRACE, > openjpa.MetaDataFactory=jpa(Resources=META-INF/jpamappings.xml, Types= > test.XMLDatatypeSupportTestEntity)} > > 31 EntityUnit_JSE TRACE [main] openjpa.Runtime - No cache marshaller > found for id org.apache.openjpa.conf.MetaDataCacheMaintenance. > > 47 EntityUnit_JSE INFO [main] openjpa.Tool - No targets were > given. Running on all classes in your persistent classes list, or all > metadata files in classpath directories if you have not listed your > persistent classes. Use -help to display tool usage information. > > 62 EntityUnit_JSE TRACE [main] openjpa.MetaData - Scanning resource > "META-INF/jpamappings.xml" for persistent types. > > 62 EntityUnit_JSE TRACE [main] openjpa.MetaData - Scan of > "META-INF/jpamappings.xml" found persistent types [Ljava.lang.String > ;@3a183a18. > > 62 EntityUnit_JSE TRACE [main] openjpa.MetaData - Mapping resource > location "file:/C:/temp/test/META-INF/jpamappings.xml" to persistent types > "[test.XMLDatatypeSupportTestEntity]". > > 62 EntityUnit_JSE TRACE [main] openjpa.MetaData - Scanning resource > "META-INF/orm.xml" for persistent types. > > 62 EntityUnit_JSE TRACE [main] openjpa.MetaData - > parsePersistentTypeNames() found [test.XMLDatatypeSupportTestEntity]. > > 62 EntityUnit_JSE TRACE [main] openjpa.MetaData - Found 1 classes > with metadata in 15 milliseconds. > > 62 EntityUnit_JSE TRACE [main] openjpa.Tool - Enhancer running on > type "test.XMLDatatypeSupportTestEntity". > > 93 EntityUnit_JSE TRACE [main] openjpa.MetaData - Loading metadata > for "class test.XMLDatatypeSupportTestEntity" under mode "[META]". > > 125 EntityUnit_JSE TRACE [main] openjpa.MetaData - Parsing resource > "file:/C:/temp/test/META-INF/jpamappings.xml". > > 156 EntityUnit_JSE TRACE [main] openjpa.MetaData - Parsing class " > test.XMLDatatypeSupportTestEntity". > > 172 EntityUnit_JSE TRACE [main] openjpa.MetaData - Generating default > metadata for type "test.XMLDatatypeSupportTestEntity". > > 172 EntityUnit_JSE TRACE [main] openjpa.MetaData - Using reflection > for metadata generation. > > 187 EntityUnit_JSE TRACE [main] openjpa.MetaData - Parsing class " > test.XMLDatatypeSupportTestEntity". > > 187 EntityUnit_JSE TRACE [main] openjpa.MetaData - Parsing package " > test.XMLDatatypeSupportTestEntity". > > 187 EntityUnit_JSE TRACE [main] openjpa.MetaData - Finished parsing > metadata resource "file:/C:/temp/test/META-INF/jpamappings.xml". > > 187 EntityUnit_JSE TRACE [main] openjpa.MetaData - Parsing class " > test.XMLDatatypeSupportTestEntity". > > 187 EntityUnit_JSE TRACE [main] openjpa.Enhance - Enhancing type > "class test.XMLDatatypeSupportTestEntity". > > 203 EntityUnit_JSE WARN [main] openjpa.Enhance - Type "class > test.XMLDatatypeSupportTestEntity" has no metadata; enhancing as > persistence aware. If you intended for "class > test.XMLDatatypeSupportTestEntity" to be persistence-capable, then this > means that OpenJPA could not find any metadata for "class > test.XMLDatatypeSupportTestEntity". This can happen if the directory > containing your metadata is not in your CLASSPATH, or if your metadata files > are not named properly. See the documentation on metadata placement for more > information. > > 203 EntityUnit_JSE TRACE [main] openjpa.Tool - The class does not > have metadata - enhanced as persistence-aware. > > ----------------------------------------- > > However if the target is specified, the enhancement will occur, E.g. > > ----------------------------------------- > > C:\temp\test>runPcEnhancer.bat test.XMLDatatypeSupportTestEntity > > C:\temp\test>java -cp C:\temp\test\;C:\temp\test\openjpa- > 1.1.0-SNAPSHOT.jar > ;C:\temp\test\utils.jar;C:\temp\test\geronimo-jpa_3.0_spec-1.0.jar > ;C:\temp\test\geronimo-jta_1.1_spec-1.1.jar > org.apache.openjpa.enhance.PCEnhancer test.XMLDatatypeSupportTestEntity > > 15 EntityUnit_JSE TRACE [main] openjpa.Runtime - Setting the > following properties from "file:/C:/temp/test/META-INF/persistence.xml" into > configuration: {openjpa.Id=EntityUnit_JSE, openjpa.Log=DefaultLevel=TRACE, > openjpa.MetaDataFactory=jpa(Resources=META-INF/jpamappings.xml, Types= > test.XMLDatatypeSupportTestEntity)} > > 47 EntityUnit_JSE TRACE [main] openjpa.Runtime - No cache marshaller > found for id org.apache.openjpa.conf.MetaDataCacheMaintenance. > > 78 EntityUnit_JSE TRACE [main] openjpa.Runtime - No cache marshaller > found for id org.apache.openjpa.conf.MetaDataCacheMaintenance. > > 94 EntityUnit_JSE TRACE [main] openjpa.Tool - Enhancer running on > type "class test.XMLDatatypeSupportTestEntity". > > 125 EntityUnit_JSE TRACE [main] openjpa.MetaData - Loading metadata > for "class test.XMLDatatypeSupportTestEntity" under mode "[META]". > > 125 EntityUnit_JSE TRACE [main] openjpa.MetaData - Scanning resource > "META-INF/jpamappings.xml" for persistent types. > > 125 EntityUnit_JSE TRACE [main] openjpa.MetaData - Scan of > "META-INF/jpamappings.xml" found persistent types [Ljava.lang.String > ;@20962096. > > 140 EntityUnit_JSE TRACE [main] openjpa.MetaData - Mapping resource > location "file:/C:/temp/test/META-INF/jpamappings.xml" to persistent types > "[test.XMLDatatypeSupportTestEntity]". > > 140 EntityUnit_JSE TRACE [main] openjpa.MetaData - Scanning resource > "META-INF/orm.xml" for persistent types. > > 140 EntityUnit_JSE TRACE [main] openjpa.MetaData - > parsePersistentTypeNames() found [test.XMLDatatypeSupportTestEntity]. > > 140 EntityUnit_JSE TRACE [main] openjpa.MetaData - Found 1 classes > with metadata in 15 milliseconds. > > 156 EntityUnit_JSE TRACE [main] openjpa.MetaData - Parsing resource > "file:/C:/temp/test/META-INF/jpamappings.xml". > > 187 EntityUnit_JSE TRACE [main] openjpa.MetaData - Parsing class " > test.XMLDatatypeSupportTestEntity". > > 187 EntityUnit_JSE TRACE [main] openjpa.MetaData - Generating default > metadata for type "test.XMLDatatypeSupportTestEntity". > > 187 EntityUnit_JSE TRACE [main] openjpa.MetaData - Using reflection > for metadata generation. > > 203 EntityUnit_JSE TRACE [main] openjpa.MetaData - Parsing class " > test.XMLDatatypeSupportTestEntity". > > 219 EntityUnit_JSE TRACE [main] openjpa.MetaData - Finished parsing > metadata resource "file:/C:/temp/test/META-INF/jpamappings.xml". > > 219 EntityUnit_JSE TRACE [main] openjpa.MetaData - Set > persistence-capable superclass of "test.XMLDatatypeSupportTestEntity" to > "null". > > 219 EntityUnit_JSE TRACE [main] openjpa.MetaData - Resolving metadata > for "[EMAIL PROTECTED]". > > 219 EntityUnit_JSE TRACE [main] openjpa.MetaData - Resolving field > "[EMAIL PROTECTED]". > > 219 EntityUnit_JSE TRACE [main] openjpa.MetaData - Resolving field > "[EMAIL PROTECTED]". > > 250 EntityUnit_JSE TRACE [main] openjpa.MetaData - Preparing mapping > for "test.XMLDatatypeSupportTestEntity". > > 250 EntityUnit_JSE TRACE [main] openjpa.MetaData - Resolving mapping > for "[EMAIL PROTECTED]". > > 250 EntityUnit_JSE TRACE [main] openjpa.Enhance - Enhancing type > "class test.XMLDatatypeSupportTestEntity". > > 312 EntityUnit_JSE TRACE [main] openjpa.MetaData - Clearing metadata > repository "[EMAIL PROTECTED]". > > ----------------------------------------- > > -- > This message is automatically generated by JIRA. > - > You can reply to this email to add a comment to the issue online. > >
