Re: EJB 2.0 Dependent Object problem - NPE on deploy
THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU! That was the problem! I sure wish I had seen that. I compared my descriptor to the sample many times and missed that each time. I guess thats what I get for working all night ;-) Seriousely Earl, I can't thank you enough! I now have dependent object samples with a one-to-one unidirectional relationship and a one-to-many unidirectional working. Next challenge is to make them work bidirectional. This is the important one, since thats what my app needs to do. I have my fingers crossed. I'm going to clean up the samples and send them off to OrionSupport, but if anyone needs them in the meantime, send me a note off list and I'll send them to you. Jim --On Sunday, October 22, 2000 11:48 AM -0600 Earl Marwil [EMAIL PROTECTED] wrote: Jim, Try adding a field-name tag in your dependent cmp-field declarations: dependents dependent dependent-nameaddrDo/dependent-name dependent-classTest20CmpDo.eb.AddrDo/dependent-class cmp-fieldfield-namestreet/field-name/cmp-field cmp-fieldfield-namecity/field-name/cmp-field cmp-fieldfield-namestate/field-name/cmp-field cmp-fieldfield-namezip/field-name/cmp-field /dependent /dependents I can't remember how I discovered this - it worked for me when I first looked into ejb 2.0 / cmr / orion a couple of months ago. Also, the ejb-name for the entity must match exactly with the role-source ejb-name in the relationship. You have Temp20CmpDo.eb.Person in the former and and Temp20CmpDo.eb.PersonEJB in the latter. Hope this helps, Earl Earl S. Marwil, Ph.D. / Senior Scientist / SCIENTECH, Inc. __o / TEL: (208) 525-3717 / 1690 International Way -\, / FAX: (208) 529-4721 / Idaho Falls, ID 83402 0/ 0__ / net: [EMAIL PROTECTED]
Re: EJB 2.0 Dependent Object problem - NPE on deploy
Jim, Try adding a field-name tag in your dependent cmp-field declarations: dependents dependent dependent-nameaddrDo/dependent-name dependent-classTest20CmpDo.eb.AddrDo/dependent-class cmp-fieldfield-namestreet/field-name/cmp-field cmp-fieldfield-namecity/field-name/cmp-field cmp-fieldfield-namestate/field-name/cmp-field cmp-fieldfield-namezip/field-name/cmp-field /dependent /dependents I can't remember how I discovered this - it worked for me when I first looked into ejb 2.0 / cmr / orion a couple of months ago. Also, the ejb-name for the entity must match exactly with the role-source ejb-name in the relationship. You have Temp20CmpDo.eb.Person in the former and and Temp20CmpDo.eb.PersonEJB in the latter. Hope this helps, Earl Earl S. Marwil, Ph.D. / Senior Scientist / SCIENTECH, Inc. __o / TEL: (208) 525-3717 / 1690 International Way -\, / FAX: (208) 529-4721 / Idaho Falls, ID 83402 0/ 0__ / net: [EMAIL PROTECTED]
EJB 2.0 Dependent Object problem - NPE on deploy
Hi All... After being told that Orion supports the PD1 spec for EJB 2.0 dependent objects I went through the PD1 spec carefully and compared it to the PD2 spec and changed my code accordingly. In fact, I have created a very stripped down example that fails. I also have looked carefully at the LogEntry class in the ATM example and its associated deployment descriptors and AccountEJB class. The best I can get Orion to do is throw a null pointer exception (pasted below) at deployment time. I have been trying a variety of things for many hours so far Friday and this weekend and still just the same, cryptic null pointer error. I have posted the code and deployment descriptors below. I realize the error is mine, since I can successfully deploy the ATM example. If someone could take a look and let me know what I screwed up, I would be greatly appreciative. This whole mess is pretty straightforward. In the PersonEJB class you'll see I used AddrDo for the varible name as in getAddrDo(), but I also tried to use a different name than the type, sich as getAddress(). If I remove the dependent object portions of this code and descriptor it works fine, except of course without the dependent. Also, there is a servlet and web descriptors and application descriptors I didn't post to save bandwidth. If thats needed I'll gladly post it. Thanks to everyone in advance. I'm sorry I'm asking so much, but the side of my head is bashed in from the brick wall. Jim C:\orionjava -jar orion.jar Auto-unpacking C:\Orion-test-apps\Test20CmpDo\rel\Sample20EbDo-ver001a.ear... do ne. Auto-unpacking C:\Orion-test-apps\Test20CmpDo\rel\Sample20EbDo-ver001a\Sample20E bDo-ver001a-web.war... done. Auto-deploying Sample20EbDo (Assembly had been updated)... Auto-deploying Sample20EbDo-ver001a-ejb.jar (ejb-jar.xml had been touched since the previous deployment)... java.lang.NullPointerException at com.evermind.server.ejb.deployment.ContainerManagedField.equals(JAX) at java.util.HashMap.put(Unknown Source) at java.util.HashSet.add(Unknown Source) at java.util.AbstractCollection.addAll(Unknown Source) at java.util.HashSet.init(Unknown Source) at com.evermind.server.ejb.deployment.Dependent.zk(JAX) at com.evermind.server.ejb.compilation.f4.init(JAX) at com.evermind.server.ejb.compilation.f9.ss(JAX) at com.evermind.server.ejb.EJBContainer.by(JAX) at com.evermind.server.Application.by(JAX) at com.evermind.server.Application.ge(JAX) at com.evermind.server.ApplicationServer.rn(JAX) at com.evermind.server.ApplicationServer.apr(JAX) at com.evermind.server.ApplicationServer.ge(JAX) at com.evermind.server.hf.run(JAX) at java.lang.Thread.run(Unknown Source) at com.evermind.util.f.run(JAX) ?xml version="1.0"? !DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_2_0.dtd" ejb-jar descriptionTest Sample EJB 2.0 EB/description display-namePerson/display-name enterprise-beans entity cmp-version2.0/cmp-version descriptionPerson has an address DO/description display-nameTest20CmpDo.eb.Person/display-name ejb-nameTest20CmpDo.eb.Person/ejb-name homeTest20CmpDo.eb.PersonHome/home remoteTest20CmpDo.eb.Person/remote ejb-classTest20CmpDo.eb.PersonEJB/ejb-class persistence-typeContainer/persistence-type prim-key-classjava.lang.String/prim-key-class reentrantTrue/reentrant !-- Same failure with without the next line -- cmp-fieldfield-nameaddrDo/field-name/cmp-field cmp-fieldfield-nameuserId/field-name/cmp-field cmp-fieldfield-namefirstName/field-name/cmp-field cmp-fieldfield-namelastName/field-name/cmp-field primkey-fielduserId/primkey-field /entity /enterprise-beans dependents dependent dependent-nameaddrDo/dependent-name dependent-classTest20CmpDo.eb.AddrDo/dependent-class cmp-fieldstreet/cmp-field cmp-fieldcity/cmp-field cmp-fieldstate/cmp-field cmp-fieldzip/cmp-field /dependent /dependents relationships ejb-relation ejb-relation-nameUser-Address/ejb-relation-name ejb-relationship-role ejb-relationship-role-nameUser-has-Address/ejb-relationship-role-name
RE: EJB 2.0 Dependent Object problem - NPE on deploy
I noticed that you're missing the abstract-schema-name element in the entity block. That might not be your problem, though; when I comment mine out I can still successfully deploy my solution. If adding abstract-schema-name does nothing, I'll look again. I haven't been using dependent objects because I couldn't figure out from the spec how to use a compound primary key defined by two CMR fields. The spec (in italics at the bottom of pg 121 of pd2) says this is possible, but I can't quite seem to figure out how it should work. Has anyone done this? Section 9.4.4.1 (at the end of pg 118) is confusing. It says that the primary key must be set by the end of ejbCreate(), but that CMR fields must not be modified until ejbPostCreate(). If a CMR field is the primary key, we seem to have a catch-22 problem... Jeff Schnitzer [EMAIL PROTECTED] -Original Message- From: Jim Archer [mailto:[EMAIL PROTECTED]] Sent: Saturday, October 21, 2000 9:14 PM To: Orion-Interest Subject: EJB 2.0 Dependent Object problem - NPE on deploy Hi All... After being told that Orion supports the PD1 spec for EJB 2.0 dependent objects I went through the PD1 spec carefully and compared it to the PD2 spec and changed my code accordingly. In fact, I have created a very stripped down example that fails. I also have looked carefully at the LogEntry class in the ATM example and its associated deployment descriptors and AccountEJB class. The best I can get Orion to do is throw a null pointer exception (pasted below) at deployment time. I have been trying a variety of things for many hours so far Friday and this weekend and still just the same, cryptic null pointer error. I have posted the code and deployment descriptors below. I realize the error is mine, since I can successfully deploy the ATM example. If someone could take a look and let me know what I screwed up, I would be greatly appreciative. This whole mess is pretty straightforward. In the PersonEJB class you'll see I used AddrDo for the varible name as in getAddrDo(), but I also tried to use a different name than the type, sich as getAddress(). If I remove the dependent object portions of this code and descriptor it works fine, except of course without the dependent. Also, there is a servlet and web descriptors and application descriptors I didn't post to save bandwidth. If thats needed I'll gladly post it. Thanks to everyone in advance. I'm sorry I'm asking so much, but the side of my head is bashed in from the brick wall. Jim C:\orionjava -jar orion.jar Auto-unpacking C:\Orion-test-apps\Test20CmpDo\rel\Sample20EbDo-ver001a.ear... do ne. Auto-unpacking C:\Orion-test-apps\Test20CmpDo\rel\Sample20EbDo-ver001a\Sample20E bDo-ver001a-web.war... done. Auto-deploying Sample20EbDo (Assembly had been updated)... Auto-deploying Sample20EbDo-ver001a-ejb.jar (ejb-jar.xml had been touched since the previous deployment)... java.lang.NullPointerException at com.evermind.server.ejb.deployment.ContainerManagedField.equals(JAX) at java.util.HashMap.put(Unknown Source) at java.util.HashSet.add(Unknown Source) at java.util.AbstractCollection.addAll(Unknown Source) at java.util.HashSet.init(Unknown Source) at com.evermind.server.ejb.deployment.Dependent.zk(JAX) at com.evermind.server.ejb.compilation.f4.init(JAX) at com.evermind.server.ejb.compilation.f9.ss(JAX) at com.evermind.server.ejb.EJBContainer.by(JAX) at com.evermind.server.Application.by(JAX) at com.evermind.server.Application.ge(JAX) at com.evermind.server.ApplicationServer.rn(JAX) at com.evermind.server.ApplicationServer.apr(JAX) at com.evermind.server.ApplicationServer.ge(JAX) at com.evermind.server.hf.run(JAX) at java.lang.Thread.run(Unknown Source) at com.evermind.util.f.run(JAX) ?xml version="1.0"? !DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_2_0.dtd" ejb-jar descriptionTest Sample EJB 2.0 EB/description display-namePerson/display-name enterprise-beans entity cmp-version2.0/cmp-version descriptionPerson has an address DO/description display-nameTest20CmpDo.eb.Person/display-name ejb-nameTest20CmpDo.eb.Person/ejb-name homeTest20CmpDo.eb.PersonHome/home remoteTest20CmpDo.eb.Person/remote ejb-classTest20CmpDo.eb.PersonEJB/ejb-class persistence-typeContainer/persistence-type prim-key-classjava.lang.String/prim-key-class reentrantTrue/reentrant !-- Same failure