RE: OJB 1.0 RC4 in a multi-VM environment
Try using the sequence manager that uses a stored procedure 'oracle-style' (I think it's called SequenceManagerStoredProcedureImpl - what's what we are using with SQL Server 2000 (we have 4 app servers and other misc vms tied into it). I'd also recommend the jgroups/oscache distributed cache. Ryan -Original Message- From: Marcello Zaniboni [mailto:[EMAIL PROTECTED] Sent: Monday, July 05, 2004 5:47 AM To: [EMAIL PROTECTED] Subject: OJB 1.0 RC4 in a multi-VM environment Hi. I am working on a large project and I need to use OJB 1.0 RC4 in a multi-VM environment. The project is yet in production. I am reading the document at the URL http://db.apache.org/ojb/docu/howtos/howto-work-with-clustering.html ...but I have some doubts about what to do for reducing the impact on the project. My needs are the following ones: * I am using Microsoft SQL Server 2000. * I am using tables with integer IDs and I'd like not to change the PK definition in the tables. * I'd like not to modify the tables with additional columns for optimistic lock. The reason of my requests of not changing the tables is their number: more than 300! You understand it could be a very heavy work to inform every developer that he/she has to change his/her table definitions. The same applies to the class-descriptor items in the repository: I'd like not to alter them... even if it could be more acceptable than modifying the DB. The ideal solution would be to work only on the connection descriptor, the OJB.properties file and to keep the tables and their descriptors as they are. Is it possible to preserve all this requirements? Can you suggest the adequate Sequence Manager and other settings? Thanks in advance... bye, Marcello - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Difficultity with abstract mapping
[EMAIL PROTECTED] wrote: Hi Armin, yes - I tried defining an extent and the appropriate class-descriptor's - I also experimented with "super". I assume that I am correct in assuming that it "is" possible to build such a structure with an abstract class? yep, I wrote a test case (using "extent" and different tables, as described on my last post) on my local machine and it work without problems (store/delete graph of objects). Pay attention not to mix different mapping strategy, e.g. use "extent" and "super" for the same classes, this could cause side-effects. It should also be possible store the whole graph in one table using "ojbConcreteClass" feature. regards, Armin regards, Marcus Hi Marcus, did you try to declare class-descriptor's for B and C (including all fields and references) and define an extent for class A: regards, Armin Marcus Young wrote: Hi, I have just been working an issue related to mapping abstract classes. I've read quite a lot about it but I'm still unclear. The structure I have is as follows: Abstract Class A which can hold a collection of 'A' objects. Classes B and C which extend A Each class is mapped to a separate table. I am hoping to be able to retreive records in such a way as to 'build' an 'A' class object including the objects collection which may include objects of class B and C. So far I have been working with 'super' and 'extents' - but to be honest I'm not really sure how to get it working. Most commonly I'm getting exceptions of "InstantiationException". - this appears to be related to the abstract 'A' class? I can resolve this particular exception by using a concrete class, however I particularly wanted to use an abstract class. Any assistance would be greatly appreciated. I end up with something like this: public abstract class A extends TransferObject { protected Long _id; } public class B extends A { private String _name; private String _description; *} *public class C extends A { private String _name; private String _description; *} * class="com.eclipsej.permission.A" table="A"> name="_id" column="ID" jdbc-type="BIGINT" primarykey="true" autoincrement="true" /> auto-retreive="true" auto-update="true" auto-delete="true"> * * - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Unix Systems Administrator +61 3 9873 0155 +61 3 9720 7467 (fax) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ArrayIndexOutOfBoundsException - OJB 1.0
I got rid of the factory and the extended class, and the stuff works now. Thanks for your help, -Martin Martin Marinschek wrote: Armin Waibel wrote: Martin Marinschek wrote: I am not using anonymous keys at all, afaik every object in my system has its id and exposes it also in the source-code. ok, similar to my local test Here is my class-descriptor for the class being serialized and loaded back; I realized that I am using the factory-properties to create a customized class ('CustomizedOfferLineImpl', this class has just an additional get-method to summarize some properties) - maybe this is what is causing the problems? (e.g. OJB does not find a class-descriptor for 'CustomizedOfferLineImpl' and does not check if 'CustomizedOfferLineImpl' is of base class 'OfferLineImpl' and using this one?) hmm, never tried this. But if 'CustomizedOfferLineImpl' is not declared in metadata, you will at the latest get problems when storing these objects. Do you get any other error logging before the ArrayIndexOutOfBoundException occurs? In my local test I do: - store an Project class object with a collection of SubProject objects (1:n Project to SubProject) - clear cache and query the created Project - get the Project with proxied SubProject reference (not materialized) - serialize/deserialize Project - get the first SubProject object from Project (materialization done without problems) Is this test similar to yours? regards, Armin Yes, very much the same... I believe that it might be the factory and extension class thing that is causing the problems, but I will retry in a different setting. thanks, -Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] . - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Difficultity with abstract mapping
Martin, on thinking about it - a single table may be the best approach. One of my objectives is to be able to build a collection of different objects (all from the same base class) - a sort of recursive collection. It seems that "ojbConcreteClass" would provide support for this - I'm not really sure how else it could be done. Marcus > good and bad table design is disputable, but in fact; if you use Oracle > Designer for example, they use exactly this approach for all > generalization-relationships by default. > > -Martin > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > Unix Systems Administrator +61 3 9873 0155 +61 3 9720 7467 (fax) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Difficultity with abstract mapping
good and bad table design is disputable, but in fact; if you use Oracle Designer for example, they use exactly this approach for all generalization-relationships by default. -Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ArrayIndexOutOfBoundsException - OJB 1.0
Armin Waibel wrote: Martin Marinschek wrote: I am not using anonymous keys at all, afaik every object in my system has its id and exposes it also in the source-code. ok, similar to my local test Here is my class-descriptor for the class being serialized and loaded back; I realized that I am using the factory-properties to create a customized class ('CustomizedOfferLineImpl', this class has just an additional get-method to summarize some properties) - maybe this is what is causing the problems? (e.g. OJB does not find a class-descriptor for 'CustomizedOfferLineImpl' and does not check if 'CustomizedOfferLineImpl' is of base class 'OfferLineImpl' and using this one?) hmm, never tried this. But if 'CustomizedOfferLineImpl' is not declared in metadata, you will at the latest get problems when storing these objects. Do you get any other error logging before the ArrayIndexOutOfBoundException occurs? In my local test I do: - store an Project class object with a collection of SubProject objects (1:n Project to SubProject) - clear cache and query the created Project - get the Project with proxied SubProject reference (not materialized) - serialize/deserialize Project - get the first SubProject object from Project (materialization done without problems) Is this test similar to yours? regards, Armin Yes, very much the same... I believe that it might be the factory and extension class thing that is causing the problems, but I will retry in a different setting. thanks, -Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ArrayIndexOutOfBoundsException - OJB 1.0
Martin Marinschek wrote: I am not using anonymous keys at all, afaik every object in my system has its id and exposes it also in the source-code. ok, similar to my local test Here is my class-descriptor for the class being serialized and loaded back; I realized that I am using the factory-properties to create a customized class ('CustomizedOfferLineImpl', this class has just an additional get-method to summarize some properties) - maybe this is what is causing the problems? (e.g. OJB does not find a class-descriptor for 'CustomizedOfferLineImpl' and does not check if 'CustomizedOfferLineImpl' is of base class 'OfferLineImpl' and using this one?) hmm, never tried this. But if 'CustomizedOfferLineImpl' is not declared in metadata, you will at the latest get problems when storing these objects. Do you get any other error logging before the ArrayIndexOutOfBoundException occurs? In my local test I do: - store an Project class object with a collection of SubProject objects (1:n Project to SubProject) - clear cache and query the created Project - get the Project with proxied SubProject reference (not materialized) - serialize/deserialize Project - get the first SubProject object from Project (materialization done without problems) Is this test similar to yours? regards, Armin -Martin name="id" column="ID" jdbc-type="BIGINT" nullable="false" primarykey="true" autoincrement="true" sequence-name="OFFSINGLE_SEQ" length="20" precision="0" conversion="at.oekb.mda.util.persistence.ojb.conversion.BigDecimal2LongConversion" /> name="comment" column="OFFSINGLE_COMMENT" jdbc-type="VARCHAR" nullable="true" length="255" /> name="modifiedAt" column="MODIFIED_AT" jdbc-type="DATE" nullable="false" length="0" conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDateFieldConversion" /> name="modifiedBy" column="MODIFIED_BY" jdbc-type="VARCHAR" nullable="false" length="255" /> name="createdAt" column="CREATED_AT" jdbc-type="DATE" nullable="false" length="0" conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDateFieldConversion" /> name="createdBy" column="CREATED_BY" jdbc-type="VARCHAR" nullable="false" length="255" /> name="offerId" column="OFFALL_ID" jdbc-type="BIGINT" nullable="false" length="20" precision="0" conversion="at.oekb.mda.util.persistence.ojb.conversion.BigDecimal2LongConversion" /> name="contentId" column="CONT_ID" jdbc-type="BIGINT" nullable="false" length="20" precision="0" conversion="at.oekb.mda.util.persistence.ojb.conversion.BigDecimal2LongConversion" /> name="nameSpaceId" column="NSP_ID" jdbc-type="BIGINT" nullable="false" length="20" precision="0" conversion="at.oekb.mda.util.persistence.ojb.conversion.BigDecimal2LongConversion" /> class-ref="at.oekb.roncalli.metadata.entity.OfferImpl" proxy="true"> class-ref="at.oekb.roncalli.metadata.entity.ContentImpl" proxy="true"> class-ref="at.oekb.roncalli.metadata.entity.NameSpaceImpl" proxy="true"> element-class-ref="at.oekb.roncalli.metadata.entity.OfferLineConditionImpl" proxy="true"> element-class-ref="at.oekb.roncalli.metadata.entity.DataTransferImpl" proxy="true"> - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Difficultity with abstract mapping
Hi Armin, yes - I tried defining an extent and the appropriate class-descriptor's - I also experimented with "super". I assume that I am correct in assuming that it "is" possible to build such a structure with an abstract class? regards, Marcus > Hi Marcus, > > did you try to declare class-descriptor's for B and C (including all > fields and references) and define an extent for class A: > > > > > > > regards, > Armin > > Marcus Young wrote: > > > Hi, > > > > I have just been working an issue related to mapping abstract classes. > > I've read quite a lot about it but I'm still unclear. The structure I > > have is as follows: > > > > Abstract Class A which can hold a collection of 'A' objects. > > Classes B and C which extend A > > Each class is mapped to a separate table. > > > > I am hoping to be able to retreive records in such a way as to 'build' > > an 'A' class object including the objects collection which may include > > objects of class B and C. So far I have been working with 'super' and > > 'extents' - but to be honest I'm not really sure how to get it working. > > Most commonly I'm getting exceptions of "InstantiationException". - > > this appears to be related to the abstract 'A' class? I can resolve > > this particular exception by using a concrete class, however I > > particularly wanted to use an abstract class. Any assistance would be > > greatly appreciated. > > > > I end up with something like this: > > > > public abstract class A extends TransferObject > > { protected Long _id; > > } > > > > public class B extends A > > { > >private String _name; > >private String _description; > > *} > > > > *public class C extends A > > { > >private String _name; > >private String _description; > > *} > > > > *> class="com.eclipsej.permission.A" table="A"> > > >name="_id" > >column="ID" > >jdbc-type="BIGINT" > >primarykey="true" > >autoincrement="true" > > /> > > > > > > > > > > > primarykey="true" autoincrement="true"/> > > > > > jdbc-type="VARCHAR"/> > class-ref="com.eclipsej.permission.A" > > auto-retreive="true" auto-update="true" auto-delete="true"> > > > > * > > * > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > Unix Systems Administrator +61 3 9873 0155 +61 3 9720 7467 (fax) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ArrayIndexOutOfBoundsException - OJB 1.0
I am not using anonymous keys at all, afaik every object in my system has its id and exposes it also in the source-code. Here is my class-descriptor for the class being serialized and loaded back; I realized that I am using the factory-properties to create a customized class ('CustomizedOfferLineImpl', this class has just an additional get-method to summarize some properties) - maybe this is what is causing the problems? (e.g. OJB does not find a class-descriptor for 'CustomizedOfferLineImpl' and does not check if 'CustomizedOfferLineImpl' is of base class 'OfferLineImpl' and using this one?) -Martin name="id" column="ID" jdbc-type="BIGINT" nullable="false" primarykey="true" autoincrement="true" sequence-name="OFFSINGLE_SEQ" length="20" precision="0" conversion="at.oekb.mda.util.persistence.ojb.conversion.BigDecimal2LongConversion" /> name="comment" column="OFFSINGLE_COMMENT" jdbc-type="VARCHAR" nullable="true" length="255" /> name="modifiedAt" column="MODIFIED_AT" jdbc-type="DATE" nullable="false" length="0" conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDateFieldConversion" /> name="modifiedBy" column="MODIFIED_BY" jdbc-type="VARCHAR" nullable="false" length="255" /> name="createdAt" column="CREATED_AT" jdbc-type="DATE" nullable="false" length="0" conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDateFieldConversion" /> name="createdBy" column="CREATED_BY" jdbc-type="VARCHAR" nullable="false" length="255" /> name="offerId" column="OFFALL_ID" jdbc-type="BIGINT" nullable="false" length="20" precision="0" conversion="at.oekb.mda.util.persistence.ojb.conversion.BigDecimal2LongConversion" /> name="contentId" column="CONT_ID" jdbc-type="BIGINT" nullable="false" length="20" precision="0" conversion="at.oekb.mda.util.persistence.ojb.conversion.BigDecimal2LongConversion" /> name="nameSpaceId" column="NSP_ID" jdbc-type="BIGINT" nullable="false" length="20" precision="0" conversion="at.oekb.mda.util.persistence.ojb.conversion.BigDecimal2LongConversion" /> class-ref="at.oekb.roncalli.metadata.entity.OfferImpl" proxy="true"> class-ref="at.oekb.roncalli.metadata.entity.ContentImpl" proxy="true"> class-ref="at.oekb.roncalli.metadata.entity.NameSpaceImpl" proxy="true"> element-class-ref="at.oekb.roncalli.metadata.entity.OfferLineConditionImpl" proxy="true"> element-class-ref="at.oekb.roncalli.metadata.entity.DataTransferImpl" proxy="true"> - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OJB 1.0 RC4 in a multi-VM environment
Hi. I am working on a large project and I need to use OJB 1.0 RC4 in a multi-VM environment. The project is yet in production. I am reading the document at the URL http://db.apache.org/ojb/docu/howtos/howto-work-with-clustering.html ...but I have some doubts about what to do for reducing the impact on the project. My needs are the following ones: * I am using Microsoft SQL Server 2000. * I am using tables with integer IDs and I'd like not to change the PK definition in the tables. * I'd like not to modify the tables with additional columns for optimistic lock. The reason of my requests of not changing the tables is their number: more than 300! You understand it could be a very heavy work to inform every developer that he/she has to change his/her table definitions. The same applies to the class-descriptor items in the repository: I'd like not to alter them... even if it could be more acceptable than modifying the DB. The ideal solution would be to work only on the connection descriptor, the OJB.properties file and to keep the tables and their descriptors as they are. Is it possible to preserve all this requirements? Can you suggest the adequate Sequence Manager and other settings? Thanks in advance... bye, Marcello - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Difficultity with abstract mapping
David, thanks for your comments. The main problem that I see with this approach is that each of the classes inheriting from the abstract class have very different attributes - so there will be a lot of empty fields in the table - I am not an expert, however I would assume that this is not good table design? For example, the actual classes I am trying to build are "PermissionHolder" (abstract) and User, Role and Group (concrete). User has many more attributes than the Group and Role. Do you see this as an issue? It is interesting that if I use a concrete class as the parent (rather than abstract) I seem to be able to store and retreive - a least in simple test cases. Marcus > Marcus Young wrote: > > > Each class is mapped to a separate table. > > I persuaded, that it's much easier to map the whole hierarchy to one > table and provide ojbConcreteClass.. > > David > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Difficultity with abstract mapping
Hi Marcus, did you try to declare class-descriptor's for B and C (including all fields and references) and define an extent for class A: regards, Armin Marcus Young wrote: Hi, I have just been working an issue related to mapping abstract classes. I've read quite a lot about it but I'm still unclear. The structure I have is as follows: Abstract Class A which can hold a collection of 'A' objects. Classes B and C which extend A Each class is mapped to a separate table. I am hoping to be able to retreive records in such a way as to 'build' an 'A' class object including the objects collection which may include objects of class B and C. So far I have been working with 'super' and 'extents' - but to be honest I'm not really sure how to get it working. Most commonly I'm getting exceptions of "InstantiationException". - this appears to be related to the abstract 'A' class? I can resolve this particular exception by using a concrete class, however I particularly wanted to use an abstract class. Any assistance would be greatly appreciated. I end up with something like this: public abstract class A extends TransferObject { protected Long _id; } public class B extends A { private String _name; private String _description; *} *public class C extends A { private String _name; private String _description; *} * class="com.eclipsej.permission.A" table="A"> name="_id" column="ID" jdbc-type="BIGINT" primarykey="true" autoincrement="true" /> auto-retreive="true" auto-update="true" auto-delete="true"> * * - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Difficultity with abstract mapping
Marcus Young wrote: Each class is mapped to a separate table. I persuaded, that it's much easier to map the whole hierarchy to one table and provide ojbConcreteClass.. David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ArrayIndexOutOfBoundsException - OJB 1.0
Hi Martin, I try to reproduce your problem without success. Could you please post a test case or detail describe (some pseudo code) what your are doing? By the way, do you use anonymous keys in collection objects? regards, Armin Martin Marinschek wrote: I found out that the problem occurs if the JavaServer Faces framework serializes an object and reloads it afterwards. Is it forbidden to serialize and recreate OJB-created objects with proxies in it? Do I have to mark the lists created by OJB as transient? But if they are transient, on recreation I will surely loose information... Should I write a converter for myself, being able to materialize the proxy-objects before they are serialized and serializing only the materialized objects? best regards, Martin Martin Marinschek wrote: Using OJB (release 1.0) in a web application (JSF, more clearly stated), I get an 'ArrayIndexOutOfBoundsException' when using the collection-proxy-feature. If I debug the situation, I find out that shortly before I call the 'ListProxyDefaultImpl.get(0)' method, the list claims that it has 2 entries, but it nevertheless throws the above mentioned exception... The problem is that this failure occurs not always, but only from time to time and I am not quite sure what to do about it. Anybody of you has a suggestion or a workaround? Or is this a bug? Best regards, Martin Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at net.sourceforge.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:481) ... 74 more Caused by: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0 at java.util.Vector.get(Vector.java:709) at org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl.get(ListProxyDefaultImpl.java:71) at at.oekb.roncalli.customized.entity.CustomizedOfferLineImpl.getSummarizedCustomerCondition(CustomizedOfferLineImpl.java:36) ... 79 more - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] . - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ArrayIndexOutOfBoundsException - OJB 1.0
I found out that the problem occurs if the JavaServer Faces framework serializes an object and reloads it afterwards. Is it forbidden to serialize and recreate OJB-created objects with proxies in it? Do I have to mark the lists created by OJB as transient? But if they are transient, on recreation I will surely loose information... Should I write a converter for myself, being able to materialize the proxy-objects before they are serialized and serializing only the materialized objects? best regards, Martin Martin Marinschek wrote: Using OJB (release 1.0) in a web application (JSF, more clearly stated), I get an 'ArrayIndexOutOfBoundsException' when using the collection-proxy-feature. If I debug the situation, I find out that shortly before I call the 'ListProxyDefaultImpl.get(0)' method, the list claims that it has 2 entries, but it nevertheless throws the above mentioned exception... The problem is that this failure occurs not always, but only from time to time and I am not quite sure what to do about it. Anybody of you has a suggestion or a workaround? Or is this a bug? Best regards, Martin Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at net.sourceforge.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:481) ... 74 more Caused by: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0 at java.util.Vector.get(Vector.java:709) at org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl.get(ListProxyDefaultImpl.java:71) at at.oekb.roncalli.customized.entity.CustomizedOfferLineImpl.getSummarizedCustomerCondition(CustomizedOfferLineImpl.java:36) ... 79 more - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] . - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JBoss have to close connection in managed environment and nes ted EJB calls
Hi Armin, Thanks for spending hours of investigation. I think it is absolutely correct, that OJB uses only one PersistenceBroker and as you described it seems that it is a problem of JBoss. Again thanks a lot for your detailed description. regards, André -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: Samstag, 3. Juli 2004 17:45 To: OJB Users List Subject: Re: JBoss have to close connection in managed environment and nes ted EJB calls Hi Andre, after spending hours of investigation, I think I found the reason for the warning. Seems JBoss doesn't recognize a connection.close() call when: - bean 1 create a PB instance and do some work - in bean 1 another bean (bean 2) was used - bean 2 create a PB instance. Internal OJB use the same PB instance, thus both use the same internal PB instance wrapped by different handle. The use PB was already associated with a connection in bean 1, thus bean 2 use the same connection handle. - now bean 2 close the used PB handle, internal the PB instance only release/close the used connection - now bean 1 perform additional work, thus the PB instance create a new connection (because bean 2 close it) and close it after use (PB close call in bean 1) - bean 1 method ends and the container commit the transaction Now the problem occur, because JBoss does not recognize that the first connection created in bean 1 was closed in bean 2 and log a warning about unclosed connection. If you comment out line 110 in PersistenceBrokerFactorySyncImpl or use version 1.5 of PersistenceBrokerFactorySyncImpl the warning does not occur. In version 1.6 I introduce that different beans in the same tx use internal the same PB instance (think this is similar to DataSource handling) to avoid massive PB instance creation for bean in bean calls. See http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&m sgId=1693533 The question now is are OJB wrong in handling connections or should JBoss allow this? I'm don't know the answer. ** Here is my test: Have a look how OJB handles connection '[EMAIL PROTECTED]' (the bean source code can be found below) ---> test start an lookup first PB in first bean ... 16:53:17,625 INFO [CacheDistributor] Create new ObjectCacheImplementation for 'default' 16:53:17,625 INFO [STDOUT] lookup con: [EMAIL PROTECTED] connection=org.jboss.resource.adapter [EMAIL PROTECTED]: false 16:53:17,625 INFO [STDOUT] ## broker1: [EMAIL PROTECTED] connection=org.jboss.resource.adapter. [EMAIL PROTECTED] ---> query in first bean, connection was created, now we call the nested bean 16:53:17,625 INFO [STDOUT] ### DO nested bean call 16:53:17,625 INFO [PersonArticleManagerPBBean] ** Found bean: org.apache.ojb.ejb.pb.ArticleManagerPBBeanLocal:Stateless 16:53:17,640 INFO [STDOUT] lookup con: [EMAIL PROTECTED] connection=org.jboss.resource.adapter [EMAIL PROTECTED]: false 16:53:17,640 INFO [PersistenceBrokerImpl] Cascade store for this reference-descriptor (category) was set to false. ... 16:53:17,656 INFO [STDOUT] lookup con: [EMAIL PROTECTED] connection=org.jboss.resource.adapter [EMAIL PROTECTED]: false 16:53:17,656 INFO [PersistenceBrokerImpl] Cascade store for this reference-descriptor (category) was set to false. 16:53:17,656 INFO [STDOUT] lookup con: [EMAIL PROTECTED] connection=org.jboss.resource.adapter [EMAIL PROTECTED]: false 16:53:17,671 ERROR [STDERR] release connection: [EMAIL PROTECTED] connection=org.jboss.resource [EMAIL PROTECTED] thread: Thread[RMI TCP Connection(2)-217.224.94.148,5,RMI Runtime] 16:53:17,671 INFO [STDOUT] close con: [EMAIL PROTECTED] 16:53:17,671 INFO [STDOUT] is closed: true 16:53:17,671 INFO [STDOUT] ### END nested bean call ---> nested bean call is finished and '[EMAIL PROTECTED]' is closed!! But the second bean close the connection created by the first bean. bean1 now start to insert objects and create a new connection, because the first one was closed by the nested bean 16:53:17,671 INFO [STDOUT] ## broker1: now store objects 16:53:17,671 INFO [STDOUT] create con: [EMAIL PROTECTED] connection=org.jboss.resource.adapter [EMAIL PROTECTED] 16:53:17,671 INFO [STDOUT] lookup con: [EMAIL PROTECTED] connection=org.jboss.resource.adapter [EMAIL PROTECTED]: false 16:53:17,671 INFO [STDOUT] lookup con: [EMAIL PROTECTED] connection=org.jboss.resource.adapter [EMAIL PROTECTED]: false ... 16:53:18,015 INFO [STDOUT] ## broker1: end store, [EMAIL PROTECTED] connection=org.jboss.resour [EMAIL PROTECTED] 16:53:18,031 INFO [STDOUT] ## close broker1 now 16:53:18,031 ERROR [STDERR] release connection: [EMAIL PROTECTED] connection=org.jboss.resource [EMAIL PROTECTED] thread: Thread[RMI TCP Connection(2)-217.224.94.148,5,RMI Runtime] 16:53:18,046 INFO [STDOUT] close con: [EMAIL PROTECTED] 16:53:18,046 INFO [STDOUT] is closed: true ---> first bean cl