RE: BATCH-MODE problem (repost)
Oleg/Stephane -- I am pretty certain that this problem is gone in RC5. Back in July, I submitted a bug report/patch to document/fix this problem. Revision 1.7 of o.a.o.b.util.batch.PreparedStatementInvocationHandler was created on/about July 29, and it contains this fix. Ron Gallagher Atlanta, GA [EMAIL PROTECTED] -Original Message- From: Oleg Nitz [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 16, 2003 7:59 PM To: OJB Users List Subject: Re: BATCH-MODE problem (repost) Hi Stéphane, sorry for the delay. Unfortunately, the stack trace doesn't show line numbers for OJB classes. Probably this is because the jar for the release is build without debug info. Also I would like to know which version do you use. That would be great if you get RC5 sources, build target jar-debug and re-run your app. Actually if you used earlier release, you may find that the problem disappears with RC5 ;-) Oleg On Tuesday 16 December 2003 12:33, Stéphane El Guedj wrote: Hi, I'm currently trying to improve my app performances and I therefore tried to set the batch-mode property in the repository to true. Unfortunately, whenever OJB attempts to submit the batch, I get the following exception: java.lang.IllegalArgumentException: object is not an instance of declaring class at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3 9 ) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp l .java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.doExecu t e(Unknown Source) at org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.invoke( U nknown Source) at $Proxy0.doExecute(Unknown Source) at org.apache.ojb.broker.util.batch.BatchConnection.executeBatch(Unknown Source) at org.apache.ojb.broker.util.batch.BatchConnection.nextExecuted(Unknown Source) at org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.invoke( U nknown Source) at $Proxy0.executeUpdate(Unknown Source) at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeUpdate(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown Source)Notif 4240 - act: 4832 at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown Source) at Test.main(Test.java:110) I am using Oracle 8i and OJB 1.0rc4. Here is an excerpt from my repository: jdbc-connection-descriptor default-connection=true jcd-alias=bod platform=oracle jdbc-level=2.0 driver=oracle.jdbc.driver.OracleDriver protocol=jdbc subprotocol=oracle:thin dbalias=@superbug:1521:dbmaster username=SEJ password=SEJ batch-mode=true connection-pool maxActive=15 whenExhaustedAction=0 testOnBorrow=false testOnReturn=false validationQuery=select count(*) from OJB_HL_SEQ / sequence-manager className=org.apache.ojb.broker.util.sequence.SequenceManagerInMemoryImpl attribute attribute-name=autoNaming attribute-value=true/ /sequence-manager /jdbc-connection-descriptor Here is a code excerpt: broker.beginTransaction(); broker.serviceConnectionManager().setBatchMode(true); broker.store(o); broker.commitTransaction(); My question: can I use batch-mode with Oracle, and if so, do I use the right driver... Thanks in advance. Regards Stiphane El Guedj - 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]
JDO only work with Sun's jar (and not my own build)
Hi all, Since two days I couldn't get rid of this failure when in tutorial5 I tried to do whatever the program propose : The list of available products: [JDO] DEBUG: OjbStoreConnector.begin: connectionReadyForRelease=false java.lang.NoSuchFieldError: tokenTypeToASTClassMap at com.sun.jdori.common.query.jdoqlc.JDOQLParser.buildTokenTypeASTClassMap(Unknown Source) at com.sun.jdori.common.query.jdoqlc.JDOQLParser.init(Unknown Source) at com.sun.jdori.common.query.jdoqlc.JDOQLParser.init(Unknown Source) at com.sun.jdori.common.query.jdoqlc.JDOQLC.createStringParser(Unknown Source) at com.sun.jdori.common.query.jdoqlc.JDOQLC.setFilter(Unknown Source) at com.sun.jdori.common.query.QueryImpl.compile(Unknown Source) at com.sun.jdori.common.query.QueryImpl.execute(Unknown Source) at org.apache.ojb.tutorial5.UCListAllProducts.apply(UCListAllProducts.java:44) at org.apache.ojb.tutorial5.Application.run(Application.java:100) at org.apache.ojb.tutorial5.Application.main(Application.java:68) Cannot close PersistenceManager while transaction is still active. Now, it is solved, the problem came from my jdo jars : I built them myself from the JDORI sources. Now, I use the jars from java.sun.com and everything goes well but the mystery remains without any explanation : why ojb doesn't work with my jars ? -- Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
SQLException Socket Closed with Oracle 9 and RC5
For some reason, it looks like OJB doesn't know when a connection has been closed, or there is something wrong with my setup. I'm using OJB rc5, with Oracle 9.2.0, and ojdbc4.jar (for JDK 1.4.x). It seems that when the app is not used and left idle, that connections are closed, but then when it is hit again, it tries to use the connections, throws the exception, and then notes the socket as closed. here is my repository_database entry: !-- Datasource for Acronyms -- jdbc-connection-descriptor jcd-alias=acronyms default-connection=true platform=Oracle jdbc-level=2.0 driver=oracle.jdbc.OracleDriver protocol=jdbc subprotocol=oracle dbalias=thin:@hpspdb1:1521:HPSPDB username=uname password=upass eager-release=true batch-mode=false useAutoCommit=0 ignoreAutoCommitExceptions=true connection-pool maxActive=1 maxIdle=2 maxWait=3 minEvictableIdleTimeMillis=4 numTestsPerEvictionRun=5 testOnBorrow=true testOnReturn=true testWhileIdle=true timeBetweenEvictionRunsMillis=6 whenExhaustedAction=2 validationQuery= logAbandoned=true removeAbandoned=true removeAbandonedTimeout=8/ sequence-manager className=org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl attribute attribute-name=grabSize attribute-value=100/ attribute attribute-name=autoNaming attribute-value=true/ attribute attribute-name=globalSequenceId attribute-value=false/ attribute attribute-name=globalSequenceStart attribute-value=1/ /sequence-manager /jdbc-connection-descriptor here is the exception: java.sql.SQLException: Io exception: Socket closed at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333) at oracle.jdbc.driver.OracleStatement.init(OracleStatement.java:389) at oracle.jdbc.driver.OracleStatement.init(OracleStatement.java:413) at oracle.jdbc.driver.OraclePreparedStatement.init(OraclePreparedStatement.java:119) at oracle.jdbc.driver.OraclePreparedStatement.init(OraclePreparedStatement.java:92) at oracle.jdbc.driver.OracleConnection.privatePrepareStatement(OracleConnection.java:950) at oracle.jdbc.driver.OracleConnection.prepareStatement(OracleConnection.java:802) at org.apache.ojb.broker.accesslayer.StatementsForClassImpl.prepareStatement(Unknown Source) at org.apache.ojb.broker.accesslayer.StatementsForClassImpl.prepareStatement(Unknown Source) at org.apache.ojb.broker.accesslayer.StatementsForClassImpl.getPreparedStmt(Unknown Source) at org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatement(Unknown Source) at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown Source) at org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(Unknown Source) at org.apache.ojb.broker.accesslayer.RsIterator.init(Unknown Source) at org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Unknown Source) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown Source) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown Source) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown Source) at gov.hhs.acronyms.sql.AcronymDAO.selectAcronyms(AcronymDAO.java:80) at gov.hhs.acronyms.actions.SearchAction.execute(SearchAction.java:68) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:165) at javax.servlet.http.HttpServlet.service(HttpServlet.java:103) at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:113) at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:190) at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:177) at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:221) at
Re: JDO only work with Sun's jar (and not my own build)
Hi Hubert, did you compile the jdori source with JDK 1.3 or 1.4 ? AFAIK only 1.3 is supported by SUN. I really can't tell you what's up with the JDORI sources. But it's not an OJB issue at least ;-) Thomas Hubert Behaghel wrote: Hi all, Since two days I couldn't get rid of this failure when in tutorial5 I tried to do whatever the program propose : The list of available products: [JDO] DEBUG: OjbStoreConnector.begin: connectionReadyForRelease=false java.lang.NoSuchFieldError: tokenTypeToASTClassMap at com.sun.jdori.common.query.jdoqlc.JDOQLParser.buildTokenTypeASTClassMap(Unknown Source) at com.sun.jdori.common.query.jdoqlc.JDOQLParser.init(Unknown Source) at com.sun.jdori.common.query.jdoqlc.JDOQLParser.init(Unknown Source) at com.sun.jdori.common.query.jdoqlc.JDOQLC.createStringParser(Unknown Source) at com.sun.jdori.common.query.jdoqlc.JDOQLC.setFilter(Unknown Source) at com.sun.jdori.common.query.QueryImpl.compile(Unknown Source) at com.sun.jdori.common.query.QueryImpl.execute(Unknown Source) at org.apache.ojb.tutorial5.UCListAllProducts.apply(UCListAllProducts.java:44) at org.apache.ojb.tutorial5.Application.run(Application.java:100) at org.apache.ojb.tutorial5.Application.main(Application.java:68) Cannot close PersistenceManager while transaction is still active. Now, it is solved, the problem came from my jdo jars : I built them myself from the JDORI sources. Now, I use the jars from java.sun.com and everything goes well but the mystery remains without any explanation : why ojb doesn't work with my jars ? -- Hubert - 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: com.sybase.jdbc2.jdbc.SybSQLException: Incorrect syntax near the keyword 'temporary'.
Hello, -Original Message- com.sybase.jdbc2.jdbc.SybSQLException: Incorrect syntax near the keyword 'temporary'. at com.sybase.jdbc2.tds.Tds.processEed(Tds.java:2429) do you use temporary as a column / field name? That might cause the problem. In order to find out, please switch on p6spy and investigate the generated SQL. the problem can be fixed by using PlatformSybaseASEImpl rather than PlatformSybaseImpl Olli - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: select question (again)
Hi, personnally, I put : criteria.addSql(date = TO_DATE('2004', '')); But I think there other possibilities -Message d'origine- De : Glauber Andrade [mailto:[EMAIL PROTECTED] Envoyé : jeudi 18 décembre 2003 00:19 À : OJB Users List Objet : select question (again) How do I implement a select like this with OJB Criteria ? select * from TABLE where date = TO_DATE('2004','') (as on Oracle) or select * from TABLE where YEAR(date) = 2004 (as on MySQL) THANKS, Glauber Andrade - 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: Sample ant build files for OJB?
Hi Thomas, Many thanks for your help. I have successfully built the ojb-blank.jar library to start my project. I needed to add the Sun's connector-api.jar in /lib, otherwise the main-opt target fails. Apparently the connector-api.jar library is not listed in the libraries needed to deploy OJB. Pierre -Original Message- From: Mahler Thomas [mailto:[EMAIL PROTECTED] Sent: Wednesday, 17 December, 2003 5:53 PM To: 'OJB Users List' Subject: RE: Sample ant build files for OJB? This should get you started: http://db.apache.org/ojb/getting-started.html -Original Message- From: De Swert Pierre (GFDI) [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 10:33 AM To: OJB Users List Subject: Sample ant build files for OJB? Hi all, I have recently downloaded OJB r5 and I try to apply it to my own project. Running the tutorials was quite simple but deploying OBJ for my project is not quite straightforward. I am currently loosing my time by adapting the ant build of my project. So I decided to subscribe to this mailing list... ;) Loads of targets are defined in the ant build files (build.xml, build-torque.xml...) provided with OJB. I would like to extract only the targets required to build the repository.xml using ojb xdoclet and build the database using the torque stuff. I would be grateful for receiving simple ant builds and the related dot properties files that I could use as an example. Many thanks for your help. Pierre [EMAIL PROTECTED] mailto:[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: Mapping problem
Hallo Armin, I've changed the mapping and the code but nothing changed. I can't get the Suppliers of an Item ;-(( Mapping now: class-descriptor class=demo.myshop.model.ojb2.Supplier table=OJB_SUPPLIER field-descriptor name=supId column=SUP_ID jdbc-type=INTEGER primarykey=true autoincrement=true/ field-descriptor name=fk_bpid column=FK_BPID jdbc-type=INTEGER primarykey=false access=anonymous autoincrement=false/ field-descriptor name=shippingCost column=SHIPPINGCOST jdbc-type=INTEGER/ reference-descriptor name=businessPartner class-ref=demo.myshop.model.ojb2.BusinessPartner foreignkey field-ref=fk_bpid/ /reference-descriptor collection-descriptor name=items element-class-ref=demo.myshop.model.ojb2.SellableItem auto-retrieve=true auto-update=true indirection-table=OJB_SUPPLIER_ITEM fk-pointing-to-this-class column=SUPPLIERID/ fk-pointing-to-element-class column=ITEMID/ /collection-descriptor /class-descriptor I hope you have some more ideas. Thanks, Stephan -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 4:57 PM To: OJB Users List Subject: Re: Mapping problem Hi Stephan, Stephan Wannenwetsch wrote: Hallo Armin, the insert error has gone, but now I have again the problem with recieving the suppliers from an item. I mean something like that: Mapping changed to: class-descriptor class=demo.myshop.model.ojb2.Supplier table=OJB_SUPPLIER add new field for PK of Supplier == field-descriptor name=supId column=SUP_ID jdbc-type=INTEGER primarykey=true == autoincrement=true/ let the FK field to BusinessPartner be anonymous field-descriptor name=fk_bpid column=FK_BPID jdbc-type=INTEGER == primarykey=true == primarykey=false == access=anonymous autoincrement=false/ field-descriptor name=shippingCost column=SHIPPINGCOST jdbc-type=INTEGER/ reference-descriptor name=businessPartner class-ref=demo.myshop.model.ojb2.BusinessPartner foreignkey field-ref=fk_bpid/ /reference-descriptor collection-descriptor name=items element-class-ref=demo.myshop.model.ojb2.SellableItem auto-retrieve=true auto-update=true indirection-table=OJB_SUPPLIER_ITEM fk-pointing-to-this-class column=SUPPLIERID/ fk-pointing-to-element-class column=ITEMID/ /collection-descriptor /class-descriptor I also added the fk-bpid field to the Supplier.class + getters/setters setter+getter are only necessary if you want to use a PersistentField implementation which use bean compliant method access. regards, Armin SellableItem: package demo.myshop.model.ojb2; import java.util.Collection; public interface SellableItem { public String getDescription(); public Integer getItemId(); public Integer getPrice(); public void setDescription(String description); public void setPrice(Integer price); public Collection getSuppliers(); public void setSuppliers(Collection supplier); public void addSupplier(Supplier supplier); public String getConcreteClass(); public String getOjbConcreteClass(); public void setOjbConcreteClass(String ojbConcreteClass); } Implemented for example in Service Contract: package demo.myshop.model.ojb2; import java.util.Collection; import java.util.HashSet; public class ServiceContract implements SellableItem { private Integer itemId; protected String ojbConcreteClass; private String description; private Integer price; private Integer period; private Collection suppliers; public ServiceContract() { ojbConcreteClass = ServiceContract.class.getName(); suppliers = new HashSet(); } public String getDescription() { return description; } public Integer getItemId() { return itemId; } public Integer getPeriod() { return period; } public Integer getPrice() { return price; }
RE: SQLException Socket Closed with Oracle 9 and RC5
The only way OJB can know whether the connection has been closed is if you set it up to test the connections in the pool. Your connection descriptor is set up halfway to do that, it specifies testOnBorrow, testOnReturn and testWhileIdle but you haven't provided a validationQuery for it to test with. I'd make the following changes: validationQuery=SELECT 1 FROM dual testOnReturn=false (Having the pool test both when the connection is returned and when it's borrowed is just way overkill.) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 9:57 AM To: [EMAIL PROTECTED] Subject: SQLException Socket Closed with Oracle 9 and RC5 For some reason, it looks like OJB doesn't know when a connection has been closed, or there is something wrong with my setup. I'm using OJB rc5, with Oracle 9.2.0, and ojdbc4.jar (for JDK 1.4.x). It seems that when the app is not used and left idle, that connections are closed, but then when it is hit again, it tries to use the connections, throws the exception, and then notes the socket as closed. here is my repository_database entry: !-- Datasource for Acronyms -- jdbc-connection-descriptor jcd-alias=acronyms default-connection=true platform=Oracle jdbc-level=2.0 driver=oracle.jdbc.OracleDriver protocol=jdbc subprotocol=oracle dbalias=thin:@hpspdb1:1521:HPSPDB username=uname password=upass eager-release=true batch-mode=false useAutoCommit=0 ignoreAutoCommitExceptions=true connection-pool maxActive=1 maxIdle=2 maxWait=3 minEvictableIdleTimeMillis=4 numTestsPerEvictionRun=5 testOnBorrow=true testOnReturn=true testWhileIdle=true timeBetweenEvictionRunsMillis=6 whenExhaustedAction=2 validationQuery= logAbandoned=true removeAbandoned=true removeAbandonedTimeout=8/ sequence-manager className=org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl attribute attribute-name=grabSize attribute-value=100/ attribute attribute-name=autoNaming attribute-value=true/ attribute attribute-name=globalSequenceId attribute-value=false/ attribute attribute-name=globalSequenceStart attribute-value=1/ /sequence-manager /jdbc-connection-descriptor here is the exception: java.sql.SQLException: Io exception: Socket closed at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333) at oracle.jdbc.driver.OracleStatement.init(OracleStatement.java:389) at oracle.jdbc.driver.OracleStatement.init(OracleStatement.java:413) at oracle.jdbc.driver.OraclePreparedStatement.init(OraclePreparedStatement.java:119) at oracle.jdbc.driver.OraclePreparedStatement.init(OraclePreparedStatement.java:92) at oracle.jdbc.driver.OracleConnection.privatePrepareStatement(OracleConnection.java:950) at oracle.jdbc.driver.OracleConnection.prepareStatement(OracleConnection.java:802) at org.apache.ojb.broker.accesslayer.StatementsForClassImpl.prepareStatement(Unknown Source) at org.apache.ojb.broker.accesslayer.StatementsForClassImpl.prepareStatement(Unknown Source) at org.apache.ojb.broker.accesslayer.StatementsForClassImpl.getPreparedStmt(Unknown Source) at org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatement(Unknown Source) at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown Source) at org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(Unknown Source) at org.apache.ojb.broker.accesslayer.RsIterator.init(Unknown Source) at org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Unknown Source) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown Source) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown Source) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown Source) at gov.hhs.acronyms.sql.AcronymDAO.selectAcronyms(AcronymDAO.java:80) at gov.hhs.acronyms.actions.SearchAction.execute(SearchAction.java:68) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
Re: SQLException Socket Closed with Oracle 9 and RC5
Lance, thanks for answer. Seems my post (this morning) was lost in space ;-) regards, Armin Lance Eason wrote: The only way OJB can know whether the connection has been closed is if you set it up to test the connections in the pool. Your connection descriptor is set up halfway to do that, it specifies testOnBorrow, testOnReturn and testWhileIdle but you haven't provided a validationQuery for it to test with. I'd make the following changes: validationQuery=SELECT 1 FROM dual testOnReturn=false (Having the pool test both when the connection is returned and when it's borrowed is just way overkill.) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 9:57 AM To: [EMAIL PROTECTED] Subject: SQLException Socket Closed with Oracle 9 and RC5 For some reason, it looks like OJB doesn't know when a connection has been closed, or there is something wrong with my setup. I'm using OJB rc5, with Oracle 9.2.0, and ojdbc4.jar (for JDK 1.4.x). It seems that when the app is not used and left idle, that connections are closed, but then when it is hit again, it tries to use the connections, throws the exception, and then notes the socket as closed. here is my repository_database entry: !-- Datasource for Acronyms -- jdbc-connection-descriptor jcd-alias=acronyms default-connection=true platform=Oracle jdbc-level=2.0 driver=oracle.jdbc.OracleDriver protocol=jdbc subprotocol=oracle dbalias=thin:@hpspdb1:1521:HPSPDB username=uname password=upass eager-release=true batch-mode=false useAutoCommit=0 ignoreAutoCommitExceptions=true connection-pool maxActive=1 maxIdle=2 maxWait=3 minEvictableIdleTimeMillis=4 numTestsPerEvictionRun=5 testOnBorrow=true testOnReturn=true testWhileIdle=true timeBetweenEvictionRunsMillis=6 whenExhaustedAction=2 validationQuery= logAbandoned=true removeAbandoned=true removeAbandonedTimeout=8/ sequence-manager className=org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl attribute attribute-name=grabSize attribute-value=100/ attribute attribute-name=autoNaming attribute-value=true/ attribute attribute-name=globalSequenceId attribute-value=false/ attribute attribute-name=globalSequenceStart attribute-value=1/ /sequence-manager /jdbc-connection-descriptor here is the exception: java.sql.SQLException: Io exception: Socket closed at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333) at oracle.jdbc.driver.OracleStatement.init(OracleStatement.java:389) at oracle.jdbc.driver.OracleStatement.init(OracleStatement.java:413) at oracle.jdbc.driver.OraclePreparedStatement.init(OraclePreparedStatement.java:119) at oracle.jdbc.driver.OraclePreparedStatement.init(OraclePreparedStatement.java:92) at oracle.jdbc.driver.OracleConnection.privatePrepareStatement(OracleConnection.java:950) at oracle.jdbc.driver.OracleConnection.prepareStatement(OracleConnection.java:802) at org.apache.ojb.broker.accesslayer.StatementsForClassImpl.prepareStatement(Unknown Source) at org.apache.ojb.broker.accesslayer.StatementsForClassImpl.prepareStatement(Unknown Source) at org.apache.ojb.broker.accesslayer.StatementsForClassImpl.getPreparedStmt(Unknown Source) at org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatement(Unknown Source) at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown Source) at org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(Unknown Source) at org.apache.ojb.broker.accesslayer.RsIterator.init(Unknown Source) at org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Unknown Source) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown Source) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown Source) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown Source) at gov.hhs.acronyms.sql.AcronymDAO.selectAcronyms(AcronymDAO.java:80) at gov.hhs.acronyms.actions.SearchAction.execute(SearchAction.java:68) at
Re: select question (again)
Hennebelle wrote: personnally, I put : criteria.addSql(date = TO_DATE('2004', '')); There's also: criteria.addEqualTo(date, TO_DATE('2004', '')); Works similar with all operators/'add'-methods on a Criteria. Regards, Martin -- Martin Kalén Curalia AB Web: http://www.curalia.se Orrspelsvägen 2BMail: [EMAIL PROTECTED] SE-182 79 StocksundTel: +46-8-410 064 40 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Sample ant build files for OJB?
Thank you for the heads up on this! -Brian On Thu, 2003-12-18 at 05:04, De Swert Pierre (GFDI) wrote: Hi Thomas, Many thanks for your help. I have successfully built the ojb-blank.jar library to start my project. I needed to add the Sun's connector-api.jar in /lib, otherwise the main-opt target fails. Apparently the connector-api.jar library is not listed in the libraries needed to deploy OJB. Pierre -Original Message- From: Mahler Thomas [mailto:[EMAIL PROTECTED] Sent: Wednesday, 17 December, 2003 5:53 PM To: 'OJB Users List' Subject: RE: Sample ant build files for OJB? This should get you started: http://db.apache.org/ojb/getting-started.html -Original Message- From: De Swert Pierre (GFDI) [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 10:33 AM To: OJB Users List Subject: Sample ant build files for OJB? Hi all, I have recently downloaded OJB r5 and I try to apply it to my own project. Running the tutorials was quite simple but deploying OBJ for my project is not quite straightforward. I am currently loosing my time by adapting the ant build of my project. So I decided to subscribe to this mailing list... ;) Loads of targets are defined in the ant build files (build.xml, build-torque.xml...) provided with OJB. I would like to extract only the targets required to build the repository.xml using ojb xdoclet and build the database using the torque stuff. I would be grateful for receiving simple ant builds and the related dot properties files that I could use as an example. Many thanks for your help. Pierre [EMAIL PROTECTED] mailto:[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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with cursors
Hi, When I make my tests with OJB (0.9.7), I have got an Oracle's error : ORA-01000: maximum open cursors exceeded This error appear when I use PB API and the method getIteratorByQuery, a cursor is use with the iterator I keep but is not close. For found this error, I have two tests, each test is passed 100 times. Each test ask a maximum of 30 lines in the database (I must write these lines in my application in a list 30 by 30). The first test have criteria who take 10 lines in the database, I take them with my iterator (I make an iterator.next()) and the iterator stop after 10 lines. The second test have no criterias, we have thousand and thousand lines who are possible to take, OJB takes the 30 first lines. The first works fine (100 times) but the second stop after the 50 (In the database, we have put a maximum of 50 cursors). That's why I think the iterator keep the cursor because it is always possible to ask the others lines. I tried to make while (iterator.hasNext()) iterator.next(), it works but take too much time. I have already add broker.close() for close the PB at the end of my code, but it doesn't close the cursor. Do you have this problem before, do you solve it ? Is there a configuration on OJB which can suppress cursors ? Must I use JDBC directly for suppress them ? Thanks in advance for your answer. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with cursors
Hello, Hennebelle wrote: When I make my tests with OJB (0.9.7), I have got an Oracle's error : ORA-01000: maximum open cursors exceeded This error appear when I use PB API and the method getIteratorByQuery, a cursor is use with the iterator I keep but is not close. You can cast the returned Iterator to OJBIterator, which will give you access to the following method: /** * Release all internally used Database resources of the iterator. * Clients must call this methods explicitely if the iterator is not * exhausted by the client application. If the Iterator is exhauseted * this method will be called implicitely. */ public void releaseDbResources(); (Otherwise, you are right about this method beeing called when doing .next() calls to the end. Also, it's called automagically in finalize() of the concrete OJBIterator implementation.) HTH, Martin -- Martin Kalén Curalia AB Web: http://www.curalia.se Orrspelsvägen 2BMail: [EMAIL PROTECTED] SE-182 79 StocksundTel: +46-8-410 064 40 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: select question (again)
Be careful doing this in code that which gets executed a lot in a multi-threaded environment (ie, a servlet container), SDF has some serious synchronization bottlenecks =/ -Brian On Thu, 2003-12-18 at 09:29, Gelhar, Wallace Joseph wrote: Hi, Personally I would use SimpleDateFormat df = new SimpleDateFormat(); criteria.addBetween(date, df.parse(01/01/+year), df.parse(12/31/+year)); This makes it database independent. Wally -Original Message- From: Martin Kalén [mailto:[EMAIL PROTECTED] Sent: Thursday, December 18, 2003 8:00 AM To: OJB Users List Subject: Re: select question (again) Hennebelle wrote: personnally, I put : criteria.addSql(date = TO_DATE('2004', '')); There's also: criteria.addEqualTo(date, TO_DATE('2004', '')); Works similar with all operators/'add'-methods on a Criteria. Regards, Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Database not found
Hi I am using ojb with struts and Tomcat 4.1.24 I am getting the following message org.apache.jasper.JasperException: org.odmg.DatabaseNotFoundException: OJB can't open database repository.xml Borrow broker from pool failed: Creation of a new PB instance failed at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2 54) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) .. when i am trying to work with odmg but if i work with PB the application run with out problem - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
3 questions about ODMG
-Using Pb with ODMG Question: When you use the PB methods with the ODMG broker, the query includes the objects touched by the current transaction? If not this could lead to problems with locks if the cache is cleared (see thread with title: Multiple reads within the same transaction). We are currently doing a second query for every object using the TransactionImpl method getObjectByIdentity to avoid this problem. -Question About Locks and Reference Update: When does OJB updates the references to the objects (by reference, I mean the object and the integer that references the id of the object)? The problems im having are best explained by the following example: Lets say I have an object A that has references to B, C and D And within a transaction I do: A xptoA = new A(); lockWrite(xptoA) ; xptoA.setB(xptoB); xptoA.setC(xptoC); xptoA.setD(xptoD); When commit is done all the references are updated except for the reference to xptoB and so I get an exception because that field in the DB cannot be null. Then I changed the order of the instructions to: A xptoA = new A(); xptoA.setB(xptoB); lockWrite(xptoA) ; xptoA.setC(xptoC); xptoA.setD(xptoD); and now all the references are updated. What I am trying to understand is the difference between B, C and D, so I can understand why this happens. - Question About Firebird Does OJB supports the FireBird DB and the construction of the plataform profile for FireBird is just straightforward or are there any known issues? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem with cursors
Thank you, it works now. Hello, Hennebelle wrote: When I make my tests with OJB (0.9.7), I have got an Oracle's error : ORA-01000: maximum open cursors exceeded This error appear when I use PB API and the method getIteratorByQuery, a cursor is use with the iterator I keep but is not close. You can cast the returned Iterator to OJBIterator, which will give you access to the following method: /** * Release all internally used Database resources of the iterator. * Clients must call this methods explicitely if the iterator is not * exhausted by the client application. If the Iterator is exhauseted * this method will be called implicitely. */ public void releaseDbResources(); (Otherwise, you are right about this method beeing called when doing .next() calls to the end. Also, it's called automagically in finalize() of the concrete OJBIterator implementation.) HTH, Martin -- Martin Kalén Curalia AB Web: http://www.curalia.se Orrspelsvägen 2BMail: [EMAIL PROTECTED] SE-182 79 StocksundTel: +46-8-410 064 40 - 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]
Order of field-descriptor id entries at repository
Hello, I had some stange values aut objects since updated to RC5. After some debuging I found out that I got illegal values at attributes which does not match with the database. For example I got a attribute at tahe object with the value 15 where a 0 is stored at the corresponding database row. The solution was the sort order at the repository_user.xml. My repository_user.xml was auto generated and did not represent the correct order of field-descriptor id's. I former time this worked. Now it seems that the id's must have the correct order. After sorting the repository everything worked fine. All the fields had the correct id so it was not a real mapping error. I just thougt that OJB uses the field-descriptor for mapping the column. I'll now sort my repository an think that everything will work after that. Will this problem be fixed? I thing trusting in the position is dangerous. best regards, Guido - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
old thread: Re: ConnectionFactoryManagedImpl and rollbacks
Hi Armin, I am very sorry to come back to the same topic after such a long time, but we are super bussy to get our thing up and running. we are using the Persistent Broker API in an managed enviroment as jboss or OC4J (oracle application server). using the ojb.org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl from OJB with jboss I see the following log: --- [ejb.ojb.org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] (Thread-10) Rollback was called, do rollback on current connection [EMAIL PROTECTED] [ejb.ojb.org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] (Thread-10) Rollback on the underlying connection failed java.sql.SQLException: You cannot rollback during a managed transaction! at org.jboss.resource.adapter.jdbc.local.LocalManagedConnection.jdbcRollback(LocalManagedConnection.java:478) at org.jboss.resource.adapter.jdbc.local.LocalConnection.rollback(LocalConnection.java:457) at org.apache.ojb.broker.util.WrappedConnection.rollback(Unknown Source) at org.apache.ojb.broker.util.pooling.ByPassConnection.rollback(Unknown Source) at org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.localRollback(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.abortTransaction(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.abortTransaction(Unknown Source) --- if I use an implentation which produces connections with a NOOP-rollback method, than I see only: --- [ejb.ojb.org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] (Thread-11) Rollback was called, do rollback on current connection [EMAIL PROTECTED] 14:00:20,312 INFO [STDOUT] ** we ignore rollback --- when I understand the JDO spec correct, than the transaction borders is done by the embedding enviroment only. so altogether our own implementation works fine on jboss and on OC4J with our connection factory. FYI: OJB really helped us a lot to have an application which deploys easiely on serveral application servers !! hope you find the time for checking it. best wishes Kristian Armin Waibel wrote: Hi Kristian, sorry for the late reply. In next future I didn't find the time to check your proposal to make rollback() a noop in ConnectionFactoryManaged Impl, but sounds correct. In a managed environment there is no need (think it's not allowed) to rollback connection. What's your experience with the changed Factory? Which API do you use (odmg, pb)? regards, Armin - Original Message - From: kristian meier [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Friday, September 12, 2003 5:04 PM Subject: ConnectionFactoryManagedImpl and rollbacks Hello, we are using OJB on an application server, in the moment JBoss. everything works fine until there comes an exception and the PersistentBroker gets closed without a commit. in the close()-method the broker does a rollback on the underlying connection-object and with the ByPassConnection the rollback is then triggered on the underlying connection-object. now my exception is caught by the EJB-container and again a rollback is triggered on the current transaction, which generates another exception from the EJB-container. we have seen this behaviour also on WebSphere and on SunONE-Applicationserver. things seemed to be better after we used our own ConnectionFactoryManagedImpl where the rollback()-method is also no-op. do I miss something, why the rollback()-method is needed as is in an applcation-server-scenario ? some hints are welcome to understand better what is going on here, thank you Kristian -- -- Jentro Technologies GmbH Kristian Meier, Developer -- Rosenheimer Str. 145e 81671 Munich, Germany Tel. +49 89 189 169 80mailto: [EMAIL PROTECTED] Fax. +49 89 189 169 99internet: http://www.jentro.com -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: automatic failover
Hi Stephen, Stephen Ting wrote: Hi, I think that's make no different than catching PersistenceBrokerException because it is the Subclass of OJBRuntimeException. for me here is a subtle difference, since OJBRuntimeException is a subclass of RuntimeException. so if in one component such an exception is thrown, it will just fall throw your catch clause. I dont know the OJB code that well to know whether an OBJBrokerException can be thrown by the use of the PersistentBroker, but to be on the safe side I would catch OJBRuntimeException. in the end I agree that a PersistentBrokerException should be sufficient according to the javadocs. so I just tried to see if I can reproduce such an exception, but I see which is wrapped in an application exception and passed correctly to the servlet. maybe the message I just posted about old thread: Re: ConnectionFactoryManagedImpl and rollbacks is of any interest for you. hope that helps a bit. best wishes Kristian Whereas, for my case where I uses OJB in session bean, it's throw RemoteException whenever there is communication link breakdown. The PersistenceBrokerExeption catch in session bean was not propagate to the web container. Hopefully, this is correct. Cheers, Stephen -- -- Jentro Technologies GmbH Kristian Meier, Developer -- Rosenheimer Str. 145e 81671 Munich, Germany Tel. +49 89 189 169 80mailto: [EMAIL PROTECTED] Fax. +49 89 189 169 99internet: http://www.jentro.com -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SQLException Socket Closed with Oracle 9 and RC5
Hi Robert, OJB checks per default with connection.isClosed() before return a connection from the pool. But most jdbcDrivers don't recognize timed out connections closed by the server. To do a more serious check you can use attribute 'validationQuery' (e.g. SELECT 1 FROM DUAL) if you don't have success to allow re-connect of timed out connection. regards, Armin [EMAIL PROTECTED] wrote: For some reason, it looks like OJB doesn't know when a connection has been closed, or there is something wrong with my setup. I'm using OJB rc5, with Oracle 9.2.0, and ojdbc4.jar (for JDK 1.4.x). It seems that when the app is not used and left idle, that connections are closed, but then when it is hit again, it tries to use the connections, throws the exception, and then notes the socket as closed. here is my repository_database entry: !-- Datasource for Acronyms -- jdbc-connection-descriptor jcd-alias=acronyms default-connection=true platform=Oracle jdbc-level=2.0 driver=oracle.jdbc.OracleDriver protocol=jdbc subprotocol=oracle dbalias=thin:@hpspdb1:1521:HPSPDB username=uname password=upass eager-release=true batch-mode=false useAutoCommit=0 ignoreAutoCommitExceptions=true connection-pool maxActive=1 maxIdle=2 maxWait=3 minEvictableIdleTimeMillis=4 numTestsPerEvictionRun=5 testOnBorrow=true testOnReturn=true testWhileIdle=true timeBetweenEvictionRunsMillis=6 whenExhaustedAction=2 validationQuery= logAbandoned=true removeAbandoned=true removeAbandonedTimeout=8/ sequence-manager className=org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl attribute attribute-name=grabSize attribute-value=100/ attribute attribute-name=autoNaming attribute-value=true/ attribute attribute-name=globalSequenceId attribute-value=false/ attribute attribute-name=globalSequenceStart attribute-value=1/ /sequence-manager /jdbc-connection-descriptor here is the exception: java.sql.SQLException: Io exception: Socket closed at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333) at oracle.jdbc.driver.OracleStatement.init(OracleStatement.java:389) at oracle.jdbc.driver.OracleStatement.init(OracleStatement.java:413) at oracle.jdbc.driver.OraclePreparedStatement.init(OraclePreparedStatement.java:119) at oracle.jdbc.driver.OraclePreparedStatement.init(OraclePreparedStatement.java:92) at oracle.jdbc.driver.OracleConnection.privatePrepareStatement(OracleConnection.java:950) at oracle.jdbc.driver.OracleConnection.prepareStatement(OracleConnection.java:802) at org.apache.ojb.broker.accesslayer.StatementsForClassImpl.prepareStatement(Unknown Source) at org.apache.ojb.broker.accesslayer.StatementsForClassImpl.prepareStatement(Unknown Source) at org.apache.ojb.broker.accesslayer.StatementsForClassImpl.getPreparedStmt(Unknown Source) at org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatement(Unknown Source) at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown Source) at org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(Unknown Source) at org.apache.ojb.broker.accesslayer.RsIterator.init(Unknown Source) at org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Unknown Source) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown Source) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown Source) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown Source) at gov.hhs.acronyms.sql.AcronymDAO.selectAcronyms(AcronymDAO.java:80) at gov.hhs.acronyms.actions.SearchAction.execute(SearchAction.java:68) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:165) at javax.servlet.http.HttpServlet.service(HttpServlet.java:103) at
Re: old thread: Re: ConnectionFactoryManagedImpl and rollbacks
Hi Kristian, I will try to test ConnectionFactoryManagedImpl with a noop-rollback methods ASAP. Currently I'm very busy with other OJB stuff. Please remember me (with severe criticism) again if I don't post my experience within the next few days ;-) regards, Armin kristian meier wrote: Hi Armin, I am very sorry to come back to the same topic after such a long time, but we are super bussy to get our thing up and running. we are using the Persistent Broker API in an managed enviroment as jboss or OC4J (oracle application server). using the ojb.org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl from OJB with jboss I see the following log: --- [ejb.ojb.org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] (Thread-10) Rollback was called, do rollback on current connection [EMAIL PROTECTED] [ejb.ojb.org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] (Thread-10) Rollback on the underlying connection failed java.sql.SQLException: You cannot rollback during a managed transaction! at org.jboss.resource.adapter.jdbc.local.LocalManagedConnection.jdbcRollback(LocalManagedConnection.java:478) at org.jboss.resource.adapter.jdbc.local.LocalConnection.rollback(LocalConnection.java:457) at org.apache.ojb.broker.util.WrappedConnection.rollback(Unknown Source) at org.apache.ojb.broker.util.pooling.ByPassConnection.rollback(Unknown Source) at org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.localRollback(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.abortTransaction(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.abortTransaction(Unknown Source) --- if I use an implentation which produces connections with a NOOP-rollback method, than I see only: --- [ejb.ojb.org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] (Thread-11) Rollback was called, do rollback on current connection [EMAIL PROTECTED] 14:00:20,312 INFO [STDOUT] ** we ignore rollback --- when I understand the JDO spec correct, than the transaction borders is done by the embedding enviroment only. so altogether our own implementation works fine on jboss and on OC4J with our connection factory. FYI: OJB really helped us a lot to have an application which deploys easiely on serveral application servers !! hope you find the time for checking it. best wishes Kristian Armin Waibel wrote: Hi Kristian, sorry for the late reply. In next future I didn't find the time to check your proposal to make rollback() a noop in ConnectionFactoryManaged Impl, but sounds correct. In a managed environment there is no need (think it's not allowed) to rollback connection. What's your experience with the changed Factory? Which API do you use (odmg, pb)? regards, Armin - Original Message - From: kristian meier [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Friday, September 12, 2003 5:04 PM Subject: ConnectionFactoryManagedImpl and rollbacks Hello, we are using OJB on an application server, in the moment JBoss. everything works fine until there comes an exception and the PersistentBroker gets closed without a commit. in the close()-method the broker does a rollback on the underlying connection-object and with the ByPassConnection the rollback is then triggered on the underlying connection-object. now my exception is caught by the EJB-container and again a rollback is triggered on the current transaction, which generates another exception from the EJB-container. we have seen this behaviour also on WebSphere and on SunONE-Applicationserver. things seemed to be better after we used our own ConnectionFactoryManagedImpl where the rollback()-method is also no-op. do I miss something, why the rollback()-method is needed as is in an applcation-server-scenario ? some hints are welcome to understand better what is going on here, thank you Kristian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to restrict result of 1:N mappings
Hello, I've got a 1:N mapping between classes. I would like to restrict the entries at the retrieved collection. I got two Classes A and B with a 1:n mapping between it. B has 17000 entries so I would like to restrict the collection to a small set of B's by using the primary key of B. By using a path expression I get the correct A but the collection from A to B contains all values of B not only the ones with the given b.pk . Could somebody give me a hint where to look at? Thanks in advance, best regards, Guido - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to restrict result of 1:N mappings
hi guido, please have a look at the query customizer. jakob Guido Beutler wrote: Hello, I've got a 1:N mapping between classes. I would like to restrict the entries at the retrieved collection. I got two Classes A and B with a 1:n mapping between it. B has 17000 entries so I would like to restrict the collection to a small set of B's by using the primary key of B. By using a path expression I get the correct A but the collection from A to B contains all values of B not only the ones with the given b.pk . Could somebody give me a hint where to look at? Thanks in advance, best regards, Guido - 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: AW: JDO - Unable to build object instance
It might be because you havn't followed the javabean get/set pattern... you wrote: public String GetName() { public void SetName(String name) { but the standard pattern is public String getName() { public void setName(String name) { This probably causes the enhancer to not recognize your object as having any properties to enhance or some such. - Gus Sebastian Muench wrote: Hi all, yes, I have the default public constructor. May it be, I missed some settings? I did: - the mapping in the Person.jdo (copied to target/classes/JDOTest/) - the mapping in the repository_jdo.xml (in target/test/ojb/) - the schema - creation in the hsqldb The build and enhance of the class is successful. See more complete source code below. Thanks for help, Sebastian Person.class package JDOTest; import java.io.Serializable; public class Person implements Serializable { private int id; protected String name; public Person() { } public Person(int id, String name) { this.id = id; this.name = name; } public int GetId() { return this.id; } public String GetName() { return this.name; } public void SetId(int id) { this.id = id; } public void SetName(String name) { this.name = name; } } TestJdo.class ... public class TestJdo { private PersistenceManagerFactory factory; private PersistenceManager manager; public TestJdo() { factory = null; manager = null; try { factory = new OjbStorePMF(); manager = factory.getPersistenceManager(); } catch(Throwable t) { System.out.println(t.getMessage()); t.printStackTrace(); } } ... private void run() { Person p = new Person(); try { PersistenceBrokerFactory.defaultPersistenceBroker().clearCache(); this.manager.currentTransaction().begin(); Query query = this.manager.newQuery(Person.class); Collection allPerson = (Collection)query.execute(); Iterator iter = allPerson.iterator(); if(!iter.hasNext()) { System.out.println(No entries found); } while(iter.hasNext()) { System.out.println(iter.next()); } manager.currentTransaction().commit(); } catch(Throwable t) { t.printStackTrace(); } finally { manager.close(); } } } -Ursprüngliche Nachricht- Von: Brian McCallister [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 17. Dezember 2003 18:34 An: OJB Users List Betreff: Re: JDO - Unable to build object instance It doesn't outside of JDO at least, I use private no-arg constructors with OJB all the time. -Brian On Wed, 2003-12-17 at 12:18, Gus Heck wrote: Mahler Thomas wrote: Hi Sebastian, Does your class have a public default constructor? From _Core Java Data Objects_ page 51: There is one requirement, however; JDO requires that a persistence-capable class have a no-arguments constructor. This constructor does not need to be declared public it just needs to be accessible to the class itself and to any potential subclasses. If thee are no sublcasses it can be declared as private. Does OJB place a further restriction that it must be public? -Gus -Original Message- From: Sebastian Muench [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 1:42 AM To: OJB Users List; [EMAIL PROTECTED] Subject: R: JDO - Unable to build object instance Oh, the file I mentioned in my last mail hasn't been attached. Here is the screenshot: [JDO] DEBUG: OjbStoreConnector.begin: connectionReadyForRelease=false [org.apache.ojb.broker.accesslayer.RsIterator] ERROR: Error while iterate ResultSet for query org.apache.ojb.broker.accesslayer.RsQueryObject[query: Query from class JDOTest.Person where null, class descriptor: JDOTest.Person] Unable to build object instance (MAYBE you don't have a constructor available):class JDOTest.Person org.apache.ojb.broker.PersistenceBrokerException: Unable to build object instance (MAYBE you don't have a constructor available):class JDOTest.Person at org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.buildWi thReflection(R owReaderDefaultImpl.java:239) at org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readObj ectFrom(RowRea derDefaultImpl.java:115) at
XDoclet OJB module src in CVS
Since monday the XDoclet OJB module is part of the OJB CVS (including source, documentation, unit tests). Therefore, the pre-build jars are now in the lib folder (built with the official 1.2b4 XDoclet release from the sourceforge download site), and the documentation is part of the standard documentation set (xdoclet-module.xml in xdocs). Instructions on how to build the module from source can be found in the documentation. There were no big changes to the module itself except for a fix to the jdbc type mapping (thanks to Gus Heck). Happy OJBing, Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: automatic failover
Hi Kristian, -Original Message- From: kristian meier [mailto:[EMAIL PROTECTED] Sent: 18 December 2003 23:56 To: OJB Users List Subject: Re: automatic failover Hi Stephen, Stephen Ting wrote: Hi, I think that's make no different than catching PersistenceBrokerException because it is the Subclass of OJBRuntimeException. for me here is a subtle difference, since OJBRuntimeException is a subclass of RuntimeException. so if in one component such an exception is thrown, it will just fall throw your catch clause. I dont know the OJB code that well to know whether an OBJBrokerException can be thrown by the use of the PersistentBroker, but to be on the safe side I would catch OJBRuntimeException. in the end I agree that a PersistentBrokerException should be sufficient according to the javadocs. so I just tried to see if I can reproduce such an exception, but I see which is wrapped in an application exception and passed correctly to the servlet. I would be very interested to see the result of your test. In my test, if the database is down. For myself It make no differnet for catching OJBRuntimeException or PersistentBrokerException. Whereas, at the servlet I just didn't get the wrapped execption. It's the RemoteException caught at servlet. maybe the message I just posted about old thread: Re: ConnectionFactoryManagedImpl and rollbacks is of any interest for you. hope that helps a bit. best wishes Kristian Whereas, for my case where I uses OJB in session bean, it's throw RemoteException whenever there is communication link breakdown. The PersistenceBrokerExeption catch in session bean was not propagate to the web container. Hopefully, this is correct. Cheers, Stephen -- -- Jentro Technologies GmbH Kristian Meier, Developer -- Rosenheimer Str. 145e 81671 Munich, Germany Tel. +49 89 189 169 80mailto: [EMAIL PROTECTED] Fax. +49 89 189 169 99internet: http://www.jentro.com -- - 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: ODMG - getIteratorByQuery
Hi Armin, This morning I read a thread about OJBIterator. It's mention to cast the PB Iterator To OJBIterator and invoke releaseDbResources() if I break half way of the iteration. This somehow make some difference in the Exception. However, Jboss still complain the connection is not close. Your help are very much appreciated. Thanks Regards, Stephen 2003-12-19 09:32:31,602 INFO [org.jboss.resource.connectionmanager.CachedConnectionManager] Closing a connection for you. Please close them yourself: [EMAIL PROTECTED] java.lang.Exception: STACKTRACE at org.jboss.resource.connectionmanager.CachedConnectionManager.registerCon nection(CachedConnectionManager.java:282) at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConn ection(BaseConnectionManager2.java:506) at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionMa nagerProxy.allocateConnection(BaseConnectionManager2.java:814) at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperD ataSource.java:122) at org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.newConne ctionFromDataSource(Unknown Source) at org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.lookupCo nnection(Unknown Source) at org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl.lookupCon nection(Unknown Source) at org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.getConnection(Un known Source) at org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatement( Unknown Source) at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown Source) at org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(Unknown Source) at org.apache.ojb.broker.accesslayer.RsIterator.init(Unknown Source) at org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknow n Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery( Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Un known Source) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unk nown Source) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unk nown Source) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unk nown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Un known Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQu ery(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQu ery(Unknown Source) at my.com.shinyang.eply.service.ejb.SequenceLabelSessionBean.createLabel(Se quenceLabelSessionBean.java:319) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(Stat elessSessionContainer.java:683) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke( CachedConnectionInterceptor.java:185) at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(Statele ssSessionInstanceInterceptor.java:72) at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterce ptor.java:84) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptor CMT.java:267) at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128) at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.jav a:118) at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191) at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryF inderInterceptor.java:122) at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionC ontainer.java:331) at org.jboss.ejb.Container.invoke(Container.java:700) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDi spatcher.java:284) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546) at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:101) at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:9 0) at