Yes, I could not inject the dependency, the CMP2. Thank you, I saw this sample, however, this one just use a CMP, that we did on the previous commit. I would like to do a test that integrates both.
On Wed, Nov 21, 2018 at 2:08 PM Bruno Baptista <[email protected]> wrote: > Well, Kind off... > > Right now when I execute the test I get a null pointer exception. on > line 161, when accessing users. > > Is this for EJB 2.1 CMP EntityBeans (CMP2)? > > I don't think CMP is correctly wired. Making all this in a single test > class is tricky. Especially because all the CMP config was done using XML. > > I suggest you take a look at: > - org.apache.openejb.test.entity.cmp2.model.StorageBean > - > > https://github.com/apache/tomee/blob/master/examples/simple-cmp2/src/test/java/org/superbiz/cmp2/MoviesTest.java > - http://tomee.apache.org/examples/simple-cmp2.html > > I don't know if creating an example wouldn't be simpler than creating a > test inside the container. > > Bruno Baptista > https://twitter.com/brunobat_ > > > On 21/11/18 15:43, Otávio Gonçalves de Santana wrote: > > Thank you, let me put more context on the test that I would like to do. > The > > goal is to test the compatibility between JPA and CMP. > > Thereby I create a User entity that will share among both chests. Then > test > > the MyCmpBean. > > > > Are those steps make sense? > > > > On Wed, Nov 21, 2018 at 11:59 AM Bruno Baptista <[email protected]> > wrote: > > > >> I'll take a look at the PR too. > >> > >> Bruno Baptista > >> https://twitter.com/brunobat_ > >> > >> > >> On 21/11/18 13:40, Otávio Gonçalves de Santana wrote: > >>> Ok thank you Jean-Louis and Jonathan Gaillimore. > >>> > >>> On Wed, Nov 21, 2018 at 11:25 AM Jean-Louis Monteiro < > >>> [email protected]> wrote: > >>> > >>>> Make sure you add the apache headers in there or we won't be able to > >> apply > >>>> your patch > >>>> -- > >>>> Jean-Louis Monteiro > >>>> http://twitter.com/jlouismonteiro > >>>> http://www.tomitribe.com > >>>> > >>>> > >>>> On Wed, Nov 21, 2018 at 2:22 PM Jonathan Gallimore < > >>>> [email protected]> wrote: > >>>> > >>>>> Sure. I'll take a look. > >>>>> > >>>>> On Wed, Nov 21, 2018 at 12:58 PM Otávio Gonçalves de Santana < > >>>>> [email protected]> wrote: > >>>>> > >>>>>> Hey, I would like to add a new test in this case. > >>>>>> I created a test, however, I had an issue to inject the Users > >>>> interface. > >>>>> I > >>>>>> tried multiples way without a good result. > >>>>>> > >>>>>> Can someone help me with this? > >>>>>> https://github.com/apache/tomee/pull/211 > >>>>>> > >>>>>> On Mon, Nov 19, 2018 at 1:07 PM Jonathan Gallimore < > >>>>>> [email protected]> wrote: > >>>>>> > >>>>>>> So the issue here is that when ReadDescriptors tries to unmarshal > >>>>>>> openejb-cmp-orm.xml here: > >>>>>>> > >>>>>>> > >> > https://github.com/apache/tomee/blob/master/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java#L551 > >>>>>>> fails, because JaxbJavaee.unmarshalJavaee() forces a > >>>>>>> http://java.sun.com/xml/ns/javaee namespace, and so you get the > >>>> error > >>>>>>> below: > >>>>>>> > >>>>>>> unexpected element (uri:"http://java.sun.com/xml/ns/javaee", > >>>>>>> local:"entity"). Expected elements are <{ > >>>>>>> http://java.sun.com/xml/ns/persistence/orm}embeddable>,<{ > >>>>>>> http://java.sun.com/xml/ns/persistence/orm}entity>,<{ > >>>>>>> http://java.sun.com/xml/ns/persistence/orm}table-generator>,<{ > >>>>>>> http://java.sun.com/xml/ns/persistence/orm}named-native-query>,<{ > >>>>>>> http://java.sun.com/xml/ns/persistence/orm}sequence-generator>,<{ > >>>>>>> http://java.sun.com/xml/ns/persistence/orm}sql-result-set-mapping > >>>>> ,<{ > >>>>>>> http://java.sun.com/xml/ns/persistence/orm}named-query>,<{ > >>>>>>> http://java.sun.com/xml/ns/persistence/orm}description>,<{ > >>>>>>> > http://java.sun.com/xml/ns/persistence/orm}persistence-unit-metadata > >>>>>> ,<{ > >>>>>>> http://java.sun.com/xml/ns/persistence/orm}catalog>,<{ > >>>>>>> http://java.sun.com/xml/ns/persistence/orm}schema>,<{ > >>>>>>> http://java.sun.com/xml/ns/persistence/orm}access>,<{ > >>>>>>> http://java.sun.com/xml/ns/persistence/orm}mapped-superclass>,<{ > >>>>>>> http://java.sun.com/xml/ns/persistence/orm}package> > >>>>>>> > >>>>>>> My guess is its been broken a while, and is broken in master, > 7.1.x, > >>>>>> 7.0.x, > >>>>>>> 1.7.x and maybe even earlier than that. > >>>>>>> > >>>>>>> I'll merge this PR in and we'll see what the build looks like on > the > >>>>> CI. > >>>>>>> Thanks for the PR Otavio! > >>>>>>> > >>>>>>> Jon > >>>>>>> > >>>>>>> On Mon, Nov 19, 2018 at 12:37 PM Otávio Gonçalves de Santana < > >>>>>>> [email protected]> wrote: > >>>>>>> > >>>>>>>> Hey, sorry I missed this email. > >>>>>>>> It isn't related to Java 11. > >>>>>>>> That is an XML unmarshal error around CMP configuration. > >>>>>>>> > >>>>>>>> On Mon, Nov 19, 2018 at 10:09 AM Jean-Louis Monteiro < > >>>>>>>> [email protected]> wrote: > >>>>>>>> > >>>>>>>>> That's why I was asking for the Java version and the version of > >>>>> TomEE > >>>>>>>>> -- > >>>>>>>>> Jean-Louis Monteiro > >>>>>>>>> http://twitter.com/jlouismonteiro > >>>>>>>>> http://www.tomitribe.com > >>>>>>>>> > >>>>>>>>> > >>>>>>>>> On Mon, Nov 19, 2018 at 12:55 PM Thomas Andraschko < > >>>>>>>>> [email protected]> wrote: > >>>>>>>>> > >>>>>>>>>> Is it related to > >>>>> https://issues.apache.org/jira/browse/TOMEE-2271? > >>>>>>>>>> Am Mo., 19. Nov. 2018 um 12:38 Uhr schrieb Jonathan Gallimore < > >>>>>>>>>> [email protected]>: > >>>>>>>>>> > >>>>>>>>>>> Thanks for providing that extra detail here. I did take a > >>>> look > >>>>> at > >>>>>>>> this > >>>>>>>>>> one, > >>>>>>>>>>> and I'm surprised we haven't run into it before. I'll pick up > >>>>>> your > >>>>>>> PR > >>>>>>>>> and > >>>>>>>>>>> review. > >>>>>>>>>>> > >>>>>>>>>>> Cheers! > >>>>>>>>>>> > >>>>>>>>>>> Jon > >>>>>>>>>>> > >>>>>>>>>>> On Mon, Nov 19, 2018 at 11:33 AM Otávio Gonçalves de Santana > >>>> < > >>>>>>>>>>> [email protected]> wrote: > >>>>>>>>>>> > >>>>>>>>>>>> Sorry, a sent the first one as an accident. > >>>>>>>>>>>> > >>>>>>>>>>>> I’ve created a PR: > >>>> https://github.com/apache/tomee/pull/200 > >>>>>>>>>>>> The error class happened at this class JaxbJavaee.java, > >>>>> because > >>>>>>> of > >>>>>>>>> this > >>>>>>>>>>>> filter: > >>>>>>>>>>>> > >>>>>>>>>>>> final JavaeeNamespaceFilter xmlFilter = new > >>>>>>>>>>>> JavaeeNamespaceFilter(parser.getXMLReader()); > >>>>>>>>>>>> > >>>>>>> xmlFilter.setContentHandler(unmarshaller.getUnmarshallerHandler()); > >>>>>>>>>>>> // unmarshall > >>>>>>>>>>>> source = new SAXSource(xmlFilter, new InputSource(in)); > >>>>>>>>>>>> > >>>>>>>>>>>> Most precise, at this piece of code: > >>>>>>>>>>>> > >>>>>>>>>>>> super.startElement("http://java.sun.com/xml/ns/javaee", > >>>>>>> localName, > >>>>>>>>>>> qname, > >>>>>>>>>>>> atts); > >>>>>>>>>>>> > >>>>>>>>>>>> This is the code file to test: unmarshalling > >>>>>> openejb-cmp-orm.xml > >>>>>>>>>>>> < > >>>>>>>>>>>> > >> > https://github.com/apache/tomee/pull/200/files#diff-78d8a62617e6ef5c7a0567ee4a62711e > >>>>>>>>>>>> < > >>>>>>>>>>>> > >> > https://github.com/apache/tomee/pull/200/files#diff-78d8a62617e6ef5c7a0567ee4a62711e > >>>>>>>>>>>> > >>>>>>>>>>>> > >>>>>>>>>>>> On Mon, Nov 19, 2018 at 8:44 AM Jonathan Gallimore < > >>>>>>>>>>>> [email protected]> wrote: > >>>>>>>>>>>> > >>>>>>>>>>>>> Hey Otavio > >>>>>>>>>>>>> > >>>>>>>>>>>>> Thanks for posting. At what point do you run into this > >>>>>>> exception > >>>>>>>>>> (your > >>>>>>>>>>>>> stacktrace shows the unmarshal, but not where its called > >>>>>> from). > >>>>>>>> If > >>>>>>>>>> you > >>>>>>>>>>>>> have a PR, shoot a link here and I'll be happy to take a > >>>>>> look. > >>>>>>>>>>>>> Jon > >>>>>>>>>>>>> > >>>>>>>>>>>>> On Mon, Nov 19, 2018 at 10:31 AM Otávio Gonçalves de > >>>>> Santana > >>>>>> < > >>>>>>>>>>>>> [email protected]> wrote: > >>>>>>>>>>>>> > >>>>>>>>>>>>>> Hi all. > >>>>>>>>>>>>>> > >>>>>>>>>>>>>> We found an error when using CMP; when the container > >>>>>> starts, > >>>>>>> it > >>>>>>>>>>> returns > >>>>>>>>>>>>> an > >>>>>>>>>>>>>> unmarshal error: > >>>>>>>>>>>>>> > >>>>>>>>>>>>>> > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:662) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:258) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:253) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:120) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > com.sun.xml.bind.v2.runtime.unmarshaller.Loader.childElement(Loader.java:105) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.childElement(StructureLoader.java:262) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:498) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:480) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:150) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >>>>> > org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:551) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > org.apache.openejb.jee.JaxbJavaee$JavaeeNamespaceFilter.startElement(JaxbJavaee.java:291) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1359) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643) > >>>>>>>>>>>>>> at > >>>> org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:357) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:258) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:236) > >>>>>>>>>>>>>> at > >>>>>>>>>>>>>> > >> > com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:288) > >>>>>>>>>>>>>> I found the error at the JavaeeNamespaceFilter that > >>>>>>> initially I > >>>>>>>>> try > >>>>>>>>>>> to > >>>>>>>>>>>>> use > >>>>>>>>>>>>>> either Strategy or Strategy to do a bypass on this > >>>> filter > >>>>>>> when > >>>>>>>> is > >>>>>>>>>>> CMP. > >>>>>>>>>>>>>> However, with a not good result. So, I created a more > >>>>>>>>>> straightforward > >>>>>>>>>>>>>> solution that creates a new method that does not use > >>>> this > >>>>>>>> filter. >
