persistence@glassfish.java.net

Re: New persistence.xml struture

From: Michael Bouschen <Michael.Bouschen_at_Sun.COM>
Date: Wed, 26 Oct 2005 15:54:26 +0200

Hi Tom,

sorry, the second attachment (stacktrace2.txt) of my previous mail does
not show the correct stacktrace. Attached you find the right one.

Regards Michael

> Hi Tom,
>
> today I updated the persistence.xml file in my containerless test
> example according to the syntax of the latest packaging proposal.
>
> I have two questions/issues. Do you want me to file issues in the
> glassfish issue tracker system for the two?
>
> (1) I need to include namespace uri in the top most element:
> <persistence xmlns="urn:ejb3-namespace">
> Otherwise, I get a NPE in PersistenceUnitProcessor.processPersistenceXML
> (see attached stacktrace in stacktrace1.txt). The code expects to get a
> list of PersistentUnitInfos from the context handler of the XMLReader.
> W/o the namespace uri the XML reader does not find any persistence unit
> and the returned list is null. Is it required to include the namespace uri?
>
> Furthermore, I understand the recent packaging proposal discussion there
> is no requirement that a persistent.xml needs to specify at least one
> persistence unit. So the list of PersistentUnitInfos might be empty anyway.
>
> (2) I read the new structure of the persistence.xml file that
> persistence-unit has a required attribute called name:
> <persistence-unit name="containerless">
> The current implementation runs into a NPE for the above line (see
> attached stacktrace in stacktrace2.txt). Instead it accepts a nested
> element called name:
> <persistence-unit>
> <name>containerless</name>
>
> Regards Michael
>
>
>
> ------------------------------------------------------------------------
>
> run:
> [java] java.lang.reflect.InvocationTargetException
> [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> [java] at java.lang.reflect.Method.invoke(Method.java:585)
> [java] at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:141)
> [java] Caused by: java.lang.reflect.InvocationTargetException
> [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> [java] at java.lang.reflect.Method.invoke(Method.java:585)
> [java] at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializerAgent.initializeFromAgent(JavaSECMPInitializerAgent.java:54)
> [java] at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializerAgent.premain(JavaSECMPInitializerAgent.java:47)
> [java] ... 5 more
> [java] Caused by: java.lang.NullPointerException
> [java] at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProcessor.java:166)
> [java] at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.processDirectory(PersistenceUnitProcessor.java:84)
> [java] at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitProcessor.java:132)
> [java] at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.getPersistenceUnits(PersistenceUnitProcessor.java:65)
> [java] at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initPersistenceUnits(JavaSECMPInitializer.java:275)
> [java] at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initialize(JavaSECMPInitializer.java:298)
> [java] at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initializeFromAgent(JavaSECMPInitializer.java:315)
> [java] ... 11 more
> [java] FATAL ERROR in native method: processing of -javaagent failed
> [java] Exception in thread "main"
>
> BUILD SUCCESSFUL
> Total time: 2 seconds
>
>
>
[...]





run:
     [java] java.lang.reflect.InvocationTargetException
     [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [java] at java.lang.reflect.Method.invoke(Method.java:585)
     [java] at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:141)
     [java] Caused by: java.lang.reflect.InvocationTargetException
     [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [java] at java.lang.reflect.Method.invoke(Method.java:585)
     [java] at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializerAgent.initializeFromAgent(JavaSECMPInitializerAgent.java:54)
     [java] at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializerAgent.premain(JavaSECMPInitializerAgent.java:47)
     [java] ... 5 more
     [java] Caused by: java.lang.NullPointerException
     [java] at java.util.Hashtable.get(Hashtable.java:336)
     [java] at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:353)
     [java] at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.callPredeploy(JavaSECMPInitializer.java:140)
     [java] at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initPersistenceUnits(JavaSECMPInitializer.java:279)
     [java] at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initialize(JavaSECMPInitializer.java:298)
     [java] FATAL ERROR in native method: processing of -javaagent failed
     [java] at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initializeFromAgent(JavaSECMPInitializer.java:315)
     [java] ... 11 more
     [java] Exception in thread "main"

BUILD SUCCESSFUL
Total time: 2 seconds