Hi C F? a few days ago Marino post this to the list
regards, Armin ----- Original Message ----- From: "Marino Tudor" <[EMAIL PROTECTED]> To: "Ojb-User" <[EMAIL PROTECTED]> Sent: Wednesday, October 23, 2002 4:28 PM Subject: Tomcat JNDI DataSource How To - Thanks Armin > > Hi, > > for anyone having problem how to > declare DataSource in Tomcat 4, and use it for > OJB, here are the copies of e-mails: > > > ******************************************** > > Hi Armin, > > Thanks, it works in your way, > but the repository file have to be changed like this: > <jdbc-connection-descriptor > platform="Oracle" > jdbc-level="1.0" > jndi-datasource-name="java:comp/env/OracleDS"> > </jdbc-connection-descriptor> > > without username and password attribute because > the same error appears if you just set empty strings for those > attributes. > > So, the above repository works OK, but > this one still cause the same error > <jdbc-connection-descriptor > platform="Oracle" > jdbc-level="1.0" > jndi-datasource-name="java:comp/env/OracleDS" > username="" > password=""> > </jdbc-connection-descriptor> > > > regards > Marino > > > -----Original Message----- > From: Armin Waibel [mailto:hafman@;t-online.de] > Sent: Wednesday, October 23, 2002 11:42 AM > To: Marino Tudor > Subject: Re: Tomcat JNDI DataSource problem > > > Hi Marino, > > ----- Original Message ----- > From: "Marino Tudor" <[EMAIL PROTECTED]> > To: "Armin Waibel" <[EMAIL PROTECTED]> > Sent: Wednesday, October 23, 2002 11:21 AM > Subject: RE: Tomcat JNDI DataSource problem > > > > Thanks Armin for your help. > > The enviroment: > > Win 2000 > > JDK 1.3 > > Tomcat 4.1.12 > > OJB 0.9.7 > > Oracle 8i (classes12.jar) > > > > Also find enclosed the following attached files: > > repository.xml > > OJB.properties > > server.xml (from Tomcat) > > > > Here are the whole stack trace: > > > > ************** STACK TRACE ******************** > > java.lang.UnsupportedOperationException > > at > > > org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSourc > e.ja > > va:125) > > jakarta-dbcp does not support > public java.sql.Connection getConnection(java.lang.String uname, > java.lang.String passwd) > throws java.sql.SQLException > > see > http://nagoya.apache.org/gump/javadoc/jakarta-commons/dbcp/dist/docs/api > / > > class org.apache.commons.dbcp.PoolingDataSource > > only the > public java.sql.Connection getConnection() > throws java.sql.SQLException > was supported. > > OJB use the first method to lookup a new Datasource when > a user was specified in the PBKey or in the repository file. > You have specified user/password in your server.xml. > To avoid this modify your repository file: > <jdbc-connection-descriptor > platform="Oracle" > jdbc-level="1.0" > jndi-datasource-name="java:comp/env/OracleDS" > username="" > password=""> > </jdbc-connection-descriptor> > > When using PBKey to lookup PB instances do not specify > a user/password. > If OJB do not found a user/password the second getConnection() method > was used by OJB to lookup a new connection. > > HTH > regards, > Armin > > > > at > > > org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.ja > va:3 > > 29) > > at > > > org.apache.ojb.broker.accesslayer.AbstractConnectionFactory.getConnectio > nFro > > mDataSource(Unknown Source) > > at > > > org.apache.ojb.broker.accesslayer.AbstractConnectionFactory.getConnectio > n(Un > > known Source) > > at > > > org.apache.ojb.broker.accesslayer.ConnectionFactoryPassThroughImpl.looku > pCon > > nection(Unknown Source) > > at > > > org.apache.ojb.broker.accesslayer.ConnectionManager.getConnection(Unknow > n > > Source) > > at > > > org.apache.ojb.broker.accesslayer.StatementsForClassImpl.prepareStatemen > t(Un > > known Source) > > at > > > org.apache.ojb.broker.accesslayer.StatementsForClassImpl.getPreparedStmt > (Unk > > nown Source) > > at > > > org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatement( > Unkn > > own Source) > > at org.apache.ojb.broker.accesslayer.JdbcAccess.executeQuery(Unknown > > Source) > > at org.apache.ojb.broker.accesslayer.RsIterator.(Unknown Source) > > at > > > org.apache.ojb.broker.singlevm.RsIteratorFactoryImpl.createRsIterator(Un > know > > n Source) > > at > > > org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getRsIteratorFromQu > ery( > > Unknown Source) > > at > > > org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getIteratorFromQuer > y(Un > > known Source) > > at > > > org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuer > y(Un > > known Source) > > at > > > org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuer > y(Un > > known Source) > > at > > > org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuer > y(Un > > known Source) > > at org.apache.ojb.odmg.oql.OQLQueryImpl.execute(Unknown Source) > > at galiot.action.FormTest.doExecute(FormTest.java:92) > > at webwork.action.ActionSupport.execute(ActionSupport.java:110) > > at > webwork.dispatcher.ServletDispatcher.service(ServletDispatcher.java:261) > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) > > at > > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica > tion > > FilterChain.java:247) > > at > > > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt > erCh > > ain.java:193) > > at > > > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv > e.ja > > va:260) > > at > > > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i > nvok > > eNext(StandardPipeline.java:643) > > at > > > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 > 80) > > at > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) > > at > > > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv > e.ja > > va:191) > > at > > > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i > nvok > > eNext(StandardPipeline.java:643) > > at > > > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 > 80) > > at > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) > > at > > > org.apache.catalina.core.StandardContext.invoke(StandardContext.java:239 > 6) > > at > > > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java > :180 > > ) > > at > > > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i > nvok > > eNext(StandardPipeline.java:643) > > at > > > org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa > lve. > > java:170) > > at > > > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i > nvok > > eNext(StandardPipeline.java:641) > > at > > > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java > :172 > > ) > > at > > > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i > nvok > > eNext(StandardPipeline.java:641) > > at > > > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 > 80) > > at > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) > > at > > > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. > java > > :174) > > at > > > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i > nvok > > eNext(StandardPipeline.java:643) > > at > > > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 > 80) > > at > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) > > at > org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) > > at > > > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:40 > 5) > > at > > > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC > onne > > ction(Http11Protocol.java:380) > > at > > > org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:50 > 8) > > at > > > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool > .jav > > a:533) > > at java.lang.Thread.run(Thread.java:484) > > > > > > ************ END ****************************** > > > > regards > > Marino > > > > -----Original Message----- > > From: Armin Waibel [mailto:hafman@;t-online.de] > > Sent: Tuesday, October 22, 2002 5:17 PM > > To: [EMAIL PROTECTED] > > Subject: Re: Tomcat JNDI DataSource problem > > > > > > Hi Marino, > > > > could you post the whole stack trace to me? > > > > regards, > > Armin > > > > ----- Original Message ----- > > From: "Marino Tudor" <[EMAIL PROTECTED]> > > To: "Ojb-User" <[EMAIL PROTECTED]> > > Sent: Tuesday, October 22, 2002 4:53 PM > > Subject: Tomcat JNDI DataSource problem > > > > > > > > > > I have a problem getting the > > > DataSource from Tomcat 4.1. in OJB 0.9.7.! > > > > > > It works OK outside the OJB, but when I declare > > > jini-datasource-name in repository.xml I get the > > > following error: > > > > > > java.lang.UnsupportedOperationException > > > at > > > > > > org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSourc > > e.ja > > > va:125) > > > > > > The repository.xml looks like: > > > <jdbc-connection-descriptor > > > platform="Oracle" > > > jdbc-level="1.0" > > > jndi-datasource-name="java:comp/env/OracleDS" > > > username="sysadm" > > > password="sysadm"> > > > </jdbc-connection-descriptor> > > > > > > and OJB.properties looks like: > > > > > > ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFacto > > ryDe > > > faultImpl > > > > > > It seems that OJB finds jndi-name, because when I put the wrong name > > in > > > jndi-datasource-name I get the another error like: > > > > > > javax.naming.NameNotFoundException: Name jdbc is not bound in this > > Context > > > at org.apache.naming.NamingContext.lookup(NamingContext.java:811) > > > > > > Regards > > > Marino Tudor > > > > > > > -- > To unsubscribe, e-mail: <mailto:ojb-user-unsubscribe@;jakarta.apache.org> > For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org> > > > -- To unsubscribe, e-mail: <mailto:ojb-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>
