RE: no DataSourceFactory configured for the connection
By migrated I assume you mean from an older version of Torque. Most likely it was a version prior to the properties file revamp that took place in Version 3.1 (I think). If this is true, you will need to modify your Torque runtime configuration properties file to the new format. See: http://db.apache.org/torque/releases/torque-3.3/runtime/reference/initialisation-configuration.html If this isn't the case, please supply more details. -Original Message- From: Shaista Shekh [mailto:shaista.sh...@gmail.com] Sent: Tuesday, August 25, 2009 1:25 AM To: torque-user@db.apache.org Subject: no DataSourceFactory configured for the connection I have migrated turbine 2.3.3 with ant. While I start the webserver/applicationserver everything works fine i am trying to logged in it is showing below given error in log file. There was no DataSourceFactory configured for the connection DATABASE Please guide me in this regard Thanking you DukeCE Privacy Statement: Please be advised that this e-mail and any files transmitted with it are confidential communication or may otherwise be privileged or confidential and are intended solely for the individual or entity to whom they are addressed. If you are not the intended recipient you may not rely on the contents of this email or any attachments, and we ask that you please not read, copy or retransmit this communication, but reply to the sender and destroy the email, its contents, and all copies thereof immediately. Any unauthorized dissemination, distribution or copying of this communication is strictly prohibited. - To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org For additional commands, e-mail: torque-user-h...@db.apache.org
Re: no DataSourceFactory configured for the connection
Sir Very very thanks Greg Monroe to reply I did all changes according to the given doc on below link: http://db.apache.org/torque/releases/torque-3.3/runtime/reference/initialisation-configuration.html Still i am facing that torque is not initialized. torque.properties are as below torque.database.default=brihaspati torque.database.brihaspati.adapter=mysql torque.dsfactory.brihaspati.factory=org.apache.torque.dsfactory.SharedPoolDataSourceFactory torque.dsfactory.brihaspati.connection.driver = org.gjt.mm.mysql.Driver torque.dsfactory.brihaspati.connection.url = jdbc:mysql://localhost:3306/brihaspati torque.dsfactory.brihaspati.connection.user = etrg torque.dsfactory.brihaspati.connection.password = brihaspatigroup torque.dsfactory.brihaspati.pool.maxActive=10 torque.dsfactory.brihaspati.pool.testOnBorrow=true torque.dsfactory.brihaspati.pool.validationQuery=SELECT 1 On 8/25/09, Greg Monroe greg.mon...@dukece.com wrote: By migrated I assume you mean from an older version of Torque. Most likely it was a version prior to the properties file revamp that took place in Version 3.1 (I think). If this is true, you will need to modify your Torque runtime configuration properties file to the new format. See: http://db.apache.org/torque/releases/torque-3.3/runtime/reference/initialisation-configuration.html If this isn't the case, please supply more details. -Original Message- From: Shaista Shekh [mailto:shaista.sh...@gmail.com] Sent: Tuesday, August 25, 2009 1:25 AM To: torque-user@db.apache.org Subject: no DataSourceFactory configured for the connection I have migrated turbine 2.3.3 with ant. While I start the webserver/applicationserver everything works fine i am trying to logged in it is showing below given error in log file. There was no DataSourceFactory configured for the connection DATABASE Please guide me in this regard Thanking you DukeCE Privacy Statement: Please be advised that this e-mail and any files transmitted with it are confidential communication or may otherwise be privileged or confidential and are intended solely for the individual or entity to whom they are addressed. If you are not the intended recipient you may not rely on the contents of this email or any attachments, and we ask that you please not read, copy or retransmit this communication, but reply to the sender and destroy the email, its contents, and all copies thereof immediately. Any unauthorized dissemination, distribution or copying of this communication is strictly prohibited. - To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org For additional commands, e-mail: torque-user-h...@db.apache.org
Re: No DataSourceFactory configured
I got resolution of this issue - there was a bug elsewhere in the classes we're using to initialize Torque; they were calling the wrong torque.properties file. It was impossible to determine from my unit test, but when I went higher up the chain we figured it out. Owen B. Mehegan wrote: Hi, I've seen this question asked many times in the mailing list archives, but so far I can't figure out a solution to the problem in my case. I have a unit test that is using Easymock to create mock database objects to test against. When I run the test, it always fails with this error: java.lang.NullPointerException: There was no DataSourceFactory configured for the connection recoverable But my Torque.properties _does_ include a datasource called 'recoverable:' torque.dsfactory.recoverable.factory=com.friend.db.RecoverableDataSourceFactory torque.dsfactory.recoverable.pool.maxActive=1 torque.dsfactory.recoverable.pool.maxIdle=1 torque.dsfactory.recoverable.pool.maxWait=1000 torque.dsfactory.recoverable.pool.testOnBorrow=false torque.dsfactory.recoverable.pool.validationQuery=SELECT 1 torque.dsfactory.recoverable.connection.driver=com.mockrunner.mock.jdbc.MockDriver torque.dsfactory.recoverable.connection.url = java://foo torque.dsfactory.recoverable.connection.user = user torque.dsfactory.recoverable.connection.password = foo This entry is similar to others in the torque.properties, so I don't think the syntax is incorrect. What else could I be doing wrong? -- Owen B. Mehegan Database Framework QA Guy He is a dangerous mixture of sophistication and recklessness which makes one anxious about his influence on other boys. [EMAIL PROTECTED] YIM: omehegan AIM: ottomaticjack GTalk: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: No DataSourceFactory configured
torque.dsfactory.recoverable.connection.url looks yucky. Owen B. Mehegan [EMAIL PROTECTED] wrote: Hi, I've seen this question asked many times in the mailing list archives, but so far I can't figure out a solution to the problem in my case. I have a unit test that is using Easymock to create mock database objects to test against. When I run the test, it always fails with this error: java.lang.NullPointerException: There was no DataSourceFactory configured for the connection recoverable But my Torque.properties _does_ include a datasource called 'recoverable:' torque.dsfactory.recoverable.factory=com.friend.db.RecoverableDataSourceFactory torque.dsfactory.recoverable.pool.maxActive=1 torque.dsfactory.recoverable.pool.maxIdle=1 torque.dsfactory.recoverable.pool.maxWait=1000 torque.dsfactory.recoverable.pool.testOnBorrow=false torque.dsfactory.recoverable.pool.validationQuery=SELECT 1 torque.dsfactory.recoverable.connection.driver=com.mockrunner.mock.jdbc.MockDriver torque.dsfactory.recoverable.connection.url = java://foo torque.dsfactory.recoverable.connection.user = user torque.dsfactory.recoverable.connection.password = foo This entry is similar to others in the torque.properties, so I don't think the syntax is incorrect. What else could I be doing wrong? -- Owen B. Mehegan Database Framework QA Guy He is a dangerous mixture of sophistication and recklessness which makes one anxious about his influence on other boys. [EMAIL PROTECTED] YIM: omehegan AIM: ottomaticjack GTalk: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Never miss a thing. Make Yahoo your homepage.
Re: No DataSourceFactory configured
Well, RecoverableDataSourceFactory is apparently just one of the standard Torque drivers, which we just happen to store in a logical location in our source tree. The comment at the top of that source file says: /** * A factory that looks up the DataSource using the JDBC2 pool methods. * * @author a href=mailto:[EMAIL PROTECTED]John McNally/a * @author a href=mailto:[EMAIL PROTECTED]Henning P. Schmiedehausen/a * @version $Id: SharedPoolDataSourceFactory.java,v 1.1 2003/08/19 19:09:12 mpoeschl Exp $ */ So I don't think that's too weird... Alvaro Coronel wrote: torque.dsfactory.recoverable.connection.url looks yucky. Owen B. Mehegan [EMAIL PROTECTED] wrote: Hi, I've seen this question asked many times in the mailing list archives, but so far I can't figure out a solution to the problem in my case. I have a unit test that is using Easymock to create mock database objects to test against. When I run the test, it always fails with this error: java.lang.NullPointerException: There was no DataSourceFactory configured for the connection recoverable But my Torque.properties _does_ include a datasource called 'recoverable:' torque.dsfactory.recoverable.factory=com.friend.db.RecoverableDataSourceFactory torque.dsfactory.recoverable.pool.maxActive=1 torque.dsfactory.recoverable.pool.maxIdle=1 torque.dsfactory.recoverable.pool.maxWait=1000 torque.dsfactory.recoverable.pool.testOnBorrow=false torque.dsfactory.recoverable.pool.validationQuery=SELECT 1 torque.dsfactory.recoverable.connection.driver=com.mockrunner.mock.jdbc.MockDriver torque.dsfactory.recoverable.connection.url = java://foo torque.dsfactory.recoverable.connection.user = user torque.dsfactory.recoverable.connection.password = foo This entry is similar to others in the torque.properties, so I don't think the syntax is incorrect. What else could I be doing wrong? -- Owen B. Mehegan Database Framework QA Guy He is a dangerous mixture of sophistication and recklessness which makes one anxious about his influence on other boys. [EMAIL PROTECTED] YIM: omehegan AIM: ottomaticjack GTalk: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: No DataSourceFactory configured
Oh, I see what you were getting at, sorry! I obfuscated the actual value of 'url' in this email, since I considered it to be sensitive data :) Alvaro Coronel wrote: torque.dsfactory.recoverable.connection.url looks yucky. Owen B. Mehegan [EMAIL PROTECTED] wrote: Hi, I've seen this question asked many times in the mailing list archives, but so far I can't figure out a solution to the problem in my case. I have a unit test that is using Easymock to create mock database objects to test against. When I run the test, it always fails with this error: java.lang.NullPointerException: There was no DataSourceFactory configured for the connection recoverable But my Torque.properties _does_ include a datasource called 'recoverable:' torque.dsfactory.recoverable.factory=com.friend.db.RecoverableDataSourceFactory torque.dsfactory.recoverable.pool.maxActive=1 torque.dsfactory.recoverable.pool.maxIdle=1 torque.dsfactory.recoverable.pool.maxWait=1000 torque.dsfactory.recoverable.pool.testOnBorrow=false torque.dsfactory.recoverable.pool.validationQuery=SELECT 1 torque.dsfactory.recoverable.connection.driver=com.mockrunner.mock.jdbc.MockDriver torque.dsfactory.recoverable.connection.url = java://foo torque.dsfactory.recoverable.connection.user = user torque.dsfactory.recoverable.connection.password = foo This entry is similar to others in the torque.properties, so I don't think the syntax is incorrect. What else could I be doing wrong? -- Owen B. Mehegan Database Framework QA Guy He is a dangerous mixture of sophistication and recklessness which makes one anxious about his influence on other boys. [EMAIL PROTECTED] YIM: omehegan AIM: ottomaticjack GTalk: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: No DataSourceFactory configured
Yeah, I'm experimenting with your suggestions now. My torque.properties includes three other entries. These three are identical except in name: torque.dsfactory.friend.factory=com.friend.db.MockDataSourceFactory torque.dsfactory.friend.pool.maxActive=22 torque.dsfactory.friend.pool.maxIdle=22 torque.dsfactory.friend.pool.testOnBorrow=true torque.dsfactory.friend.pool.validationQuery=SELECT 1 torque.dsfactory.friend.connection.driver = org.postgresql.Driver torque.dsfactory.friend.connection.url = java://stuff torque.dsfactory.friend.connection.user = stuff torque.dsfactory.friend.connection.password = So the difference between these and my 'recoverable' data source is, 'recoverable' uses these two config options: torque.dsfactory.recoverable.factory=com.friend.db.RecoverableDataSourceFactory torque.dsfactory.recoverable.connection.driver=com.mockrunner.mock.jdbc.MockDriver I've tried using all three of these in my test. One of them fails with the same There was no DataSourceFactory configured error as 'recoverable.' The other two fail with: java.util.NoSuchElementException: Could not create a validated object I've inherited this code from someone else, so it may be that I need to find out more about how we're using it. I was just hoping the issue was something simple related to Torque itself. Frank Nguyen wrote: Were you able to connect to any other database than recoverable database? what driver did you use ? were you able to connect to recoverable database itself using JDBC test with the same username and password? Lastly, try using different different dsfactory to see if it works for you. Here is my sample setup with my youcaddy database. ## Using commons-dbcp torque.dsfactory.youcaddy.factory=org.apache.torque.dsfactory.SharedPoolDataSourceFactory #torque.dsfactory.youcaddy.factory=org.apache.torque.dsfactory.PerUserPoolDataSourceFactor y torque.dsfactory.youcaddy.pool.defaultMaxActive=10 torque.dsfactory.youcaddy.pool.testOnBorrow=true torque.dsfactory.youcaddy.pool.validationQuery=SELECT 1 torque.dsfactory.youcaddy.connection.driver = org.gjt.mm.mysql.Driver torque.dsfactory.youcaddy.connection.url = jdbc:mysql://localhost/youcaddy torque.dsfactory.youcaddy.connection.user = bla torque.dsfactory.youcaddy.connection.password = bla Good luck ! Owen B. Mehegan [EMAIL PROTECTED] wrote: Hi, I've seen this question asked many times in the mailing list archives, but so far I can't figure out a solution to the problem in my case. I have a unit test that is using Easymock to create mock database objects to test against. When I run the test, it always fails with this error: java.lang.NullPointerException: There was no DataSourceFactory configured for the connection recoverable But my Torque.properties _does_ include a datasource called 'recoverable:' torque.dsfactory.recoverable.factory=com.friend.db.RecoverableDataSourceFactory torque.dsfactory.recoverable.pool.maxActive=1 torque.dsfactory.recoverable.pool.maxIdle=1 torque.dsfactory.recoverable.pool.maxWait=1000 torque.dsfactory.recoverable.pool.testOnBorrow=false torque.dsfactory.recoverable.pool.validationQuery=SELECT 1 torque.dsfactory.recoverable.connection.driver=com.mockrunner.mock.jdbc.MockDriver torque.dsfactory.recoverable.connection.url = java://foo torque.dsfactory.recoverable.connection.user = user torque.dsfactory.recoverable.connection.password = foo This entry is similar to others in the torque.properties, so I don't think the syntax is incorrect. What else could I be doing wrong? -- Owen B. Mehegan Database Framework QA Guy He is a dangerous mixture of sophistication and recklessness which makes one anxious about his influence on other boys. [EMAIL PROTECTED] YIM: omehegan AIM: ottomaticjack GTalk: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: No DataSourceFactory configured
Were you able to connect to any other database than recoverable database? what driver did you use ? were you able to connect to recoverable database itself using JDBC test with the same username and password? Lastly, try using different different dsfactory to see if it works for you. Here is my sample setup with my youcaddy database. ## Using commons-dbcp torque.dsfactory.youcaddy.factory=org.apache.torque.dsfactory.SharedPoolDataSourceFactory #torque.dsfactory.youcaddy.factory=org.apache.torque.dsfactory.PerUserPoolDataSourceFactor y torque.dsfactory.youcaddy.pool.defaultMaxActive=10 torque.dsfactory.youcaddy.pool.testOnBorrow=true torque.dsfactory.youcaddy.pool.validationQuery=SELECT 1 torque.dsfactory.youcaddy.connection.driver = org.gjt.mm.mysql.Driver torque.dsfactory.youcaddy.connection.url = jdbc:mysql://localhost/youcaddy torque.dsfactory.youcaddy.connection.user = bla torque.dsfactory.youcaddy.connection.password = bla Good luck ! Owen B. Mehegan [EMAIL PROTECTED] wrote: Hi, I've seen this question asked many times in the mailing list archives, but so far I can't figure out a solution to the problem in my case. I have a unit test that is using Easymock to create mock database objects to test against. When I run the test, it always fails with this error: java.lang.NullPointerException: There was no DataSourceFactory configured for the connection recoverable But my Torque.properties _does_ include a datasource called 'recoverable:' torque.dsfactory.recoverable.factory=com.friend.db.RecoverableDataSourceFactory torque.dsfactory.recoverable.pool.maxActive=1 torque.dsfactory.recoverable.pool.maxIdle=1 torque.dsfactory.recoverable.pool.maxWait=1000 torque.dsfactory.recoverable.pool.testOnBorrow=false torque.dsfactory.recoverable.pool.validationQuery=SELECT 1 torque.dsfactory.recoverable.connection.driver=com.mockrunner.mock.jdbc.MockDriver torque.dsfactory.recoverable.connection.url = java://foo torque.dsfactory.recoverable.connection.user = user torque.dsfactory.recoverable.connection.password = foo This entry is similar to others in the torque.properties, so I don't think the syntax is incorrect. What else could I be doing wrong? -- Owen B. Mehegan Database Framework QA Guy He is a dangerous mixture of sophistication and recklessness which makes one anxious about his influence on other boys. [EMAIL PROTECTED] YIM: omehegan AIM: ottomaticjack GTalk: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: no DataSourceFactory configured
I'd assume you have a new Torque version at compile time but the new 3.3-RC1 torque version at compile time. Make sure you use the same Torque version at compile time and run time. I'm glad the connection issue is solved. I have created an issue about displaying a more interpretable error message if getConnection() is called and Torque is not initialized, but I'm not sure whether it will make it into Torque 3.3 Thomas Pierre-Alain Branger [EMAIL PROTECTED] schrieb am 24.01.2007 01:02:31: Hi again, Reading one more time Thomas mail I realize that I had not initialize Torque with Torque.init(torque.properties); command. So I added this line and it seems that the connection is enabled but right now I have a new error that I could not solve. Here is the trace: Exception in thread main java.lang.NoSuchMethodError: org.apache.torque.map.TableMap.setJavaName(Ljava/lang/String;)V at mx.unam.ccg.BddPortal.map.ApplicationMapBuilder. doBuild(ApplicationMapBuilder.java:70) at org.apache.torque.util.BasePeer.getMapBuilder(BasePeer.java:1970) at mx.unam.ccg.BddPortal.BaseApplicationPeer. clinit(BaseApplicationPeer.java:86) at mx.unam.ccg.BddPortal.BaseApplication.clinit(BaseApplication.java:45) at testbddportalccg.Main.main(Main.java:44) Java Result: 1 Thanks for your time, Pierre Ok, I presume you are using the Torque sample code, so you call Torque.init() with the correct properties file first thing in the application, as Guy remarked. Maybe it's time to step back and try whether you can access the database using plain jdbc. You would use the code Class.forName(org.gjt.mm.mysql.Driver); java.sql.Connection connection = java.sql.DriverManager.getConnection(databaseUrl, user, password); and see whether you can connect to the database. If not, the exception stack trace may give you a reason what is going wrong. Thomas Pierre-Alain Branger [EMAIL PROTECTED] schrieb am 23.01.2007 00:04:55: Hi Thomas, I am using a correct db user name and password in my torque.properties and build.properties files but I don't show it in the mail. Any other idea? Pierre a) I do not believe that the torque.properties needs to be in the classpath. The tutorial example code loads it from the file system, as far as I know. b) in your torque.properties, you have set torque.dsfactory.BddPortalCCG.connection.user which means that there is no user set for your connnection. Try setting the correct db user name there. Same goes for the torque.database.user in the build.properties. Thomas On Mon, 22 Jan 2007, Pierre-Alain Branger wrote: Hi everybody, I follow your suggestions but I still can not execute my program properly. Following, the different things I did: - I added torque.properties, actually it was not in it: export CLASSPATH=/home/pbranger/BddPortalCCG/src/conf By the way the tutorial don't mention this step. - I also added torque.properties to the default source package in Net beans. - My database is properly started - Connection url, password and username are right in the configuration file. I just borrow user and password in the mail I sent. Thomas, what do you mean by I am sure whethet mysql accepts connections without specifying a database user (as you did)? I can connect to mysql by mysql -u user -p but if I don't specify user I obviously can not connect. Thanks again for your help, Pierre This usually means that connecting to the database failed. Possible reasons are - the database is not started - the connection url, password or username are wrong in the configuration file Loking at your configuration, I am sure whethet mysql accepts connections without specifying a database user (as you did) Thomas Pierre-Alain Branger [EMAIL PROTECTED] schrieb am 20.01.2007 02:04:11: Hi everybody, I follow the tutorial and could generate my mysql database and the corresponding java access classes. I made a jar and add it to a java project that compiled well. But when I launch my application I obtain the following message: java.lang.NullPointerException: There was no DataSourceFactory configured for the connection BddPortalCCG at org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:711) at org.apache.torque.Torque.getConnection(Torque.java:268) at org.apache.torque.util.Transaction.beginOptional(Transaction.java:80) at org.apache.torque.util.Transaction.begin(Transaction.java:62) at mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:361) at mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:343) at testbddportalccg.Main.main(Main.java:36) I hope
Re: no DataSourceFactory configured
Ok, I presume you are using the Torque sample code, so you call Torque.init() with the correct properties file first thing in the application, as Guy remarked. Maybe it's time to step back and try whether you can access the database using plain jdbc. You would use the code Class.forName(org.gjt.mm.mysql.Driver); java.sql.Connection connection = java.sql.DriverManager.getConnection(databaseUrl, user, password); and see whether you can connect to the database. If not, the exception stack trace may give you a reason what is going wrong. Thomas Pierre-Alain Branger [EMAIL PROTECTED] schrieb am 23.01.2007 00:04:55: Hi Thomas, I am using a correct db user name and password in my torque.properties and build.properties files but I don't show it in the mail. Any other idea? Pierre a) I do not believe that the torque.properties needs to be in the classpath. The tutorial example code loads it from the file system, as far as I know. b) in your torque.properties, you have set torque.dsfactory.BddPortalCCG.connection.user which means that there is no user set for your connnection. Try setting the correct db user name there. Same goes for the torque.database.user in the build.properties. Thomas On Mon, 22 Jan 2007, Pierre-Alain Branger wrote: Hi everybody, I follow your suggestions but I still can not execute my program properly. Following, the different things I did: - I added torque.properties, actually it was not in it: export CLASSPATH=/home/pbranger/BddPortalCCG/src/conf By the way the tutorial don't mention this step. - I also added torque.properties to the default source package in Net beans. - My database is properly started - Connection url, password and username are right in the configuration file. I just borrow user and password in the mail I sent. Thomas, what do you mean by I am sure whethet mysql accepts connections without specifying a database user (as you did)? I can connect to mysql by mysql -u user -p but if I don't specify user I obviously can not connect. Thanks again for your help, Pierre This usually means that connecting to the database failed. Possible reasons are - the database is not started - the connection url, password or username are wrong in the configuration file Loking at your configuration, I am sure whethet mysql accepts connections without specifying a database user (as you did) Thomas Pierre-Alain Branger [EMAIL PROTECTED] schrieb am 20.01.2007 02:04:11: Hi everybody, I follow the tutorial and could generate my mysql database and the corresponding java access classes. I made a jar and add it to a java project that compiled well. But when I launch my application I obtain the following message: java.lang.NullPointerException: There was no DataSourceFactory configured for the connection BddPortalCCG at org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:711) at org.apache.torque.Torque.getConnection(Torque.java:268) at org.apache.torque.util.Transaction.beginOptional(Transaction.java:80) at org.apache.torque.util.Transaction.begin(Transaction.java:62) at mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:361) at mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:343) at testbddportalccg.Main.main(Main.java:36) I hope soñeone could help, me. Here are the different configuring files I use: - torque.properties torque.database.default = BddPortalCCG torque.database.BddPortalCCG.adapter = mysql # Using commons-dbcp torque.dsfactory.BddPortalCCG.factory org.apache.torque.dsfactory.SharedPoolDataSourceFactory torque.dsfactory.BddPortalCCG.connection.driver org.gjt.mm.mysql.Driver torque.dsfactory.BddPortalCCG.connection.url jdbc:mysql://localhost:3306/BddPortalCCG torque.dsfactory.BddPortalCCG.connection.user torque.dsfactory.BddPortalCCG.connection.password - project.properties # The name of the project Torque will generate code for. torque.project=BddPortalCCG # The target database platform. torque.database=mysql # The target package to put the generated classes in. torque.targetPackage=mx.unam.ccg.BddPortal # The JDBC URL that Torque can use to create and # drop databases if instructed to do so. torque.database.createUrl=jdbc:mysql://localhost/mysql # The JDBC URL that will be used to create tables in your database. torque.database.buildUrl=jdbc:mysql://localhost/BddPortalCCG # The JDBC URL that will be used to access your database. torque.database.url=jdbc:mysql://localhost/BddPortalCCG # The JDBC database driver to use when connecting to your database. torque.database.driver=org.gjt.mm.mysql.Driver # The administrative username that has sufficient
Re: no DataSourceFactory configured
Hi Thomas, Thank you for your tip, I could access my database without error message as following: Class.forName(org.gjt.mm.mysql.Driver); java.sql.Connection connection = java.sql.DriverManager.getConnection(jdbc:mysql://localhost:3306/BddPortalCCG, , ); However, the Torque code still generate the same error: Code --- Application app = new Application(); app.setIdapp(0); app.setNameapp(Blast); app.setPathapp(/home/pbranger/blast); app.save(); Error --- java.lang.NullPointerException: There was no DataSourceFactory configured for the connection BddPortalCCG at org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:711) at org.apache.torque.Torque.getConnection(Torque.java:268) at org.apache.torque.util.Transaction.beginOptional(Transaction.java:80) at org.apache.torque.util.Transaction.begin(Transaction.java:62) at mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:361) at mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:343) at testbddportalccg.Main.main(Main.java:42) I suppose torque classes don't consider my torque.properties because this last appear to be right. I hope we could resolve this little problem. Pierre Ok, I presume you are using the Torque sample code, so you call Torque.init() with the correct properties file first thing in the application, as Guy remarked. Maybe it's time to step back and try whether you can access the database using plain jdbc. You would use the code Class.forName(org.gjt.mm.mysql.Driver); java.sql.Connection connection = java.sql.DriverManager.getConnection(databaseUrl, user, password); and see whether you can connect to the database. If not, the exception stack trace may give you a reason what is going wrong. Thomas Pierre-Alain Branger [EMAIL PROTECTED] schrieb am 23.01.2007 00:04:55: Hi Thomas, I am using a correct db user name and password in my torque.properties and build.properties files but I don't show it in the mail. Any other idea? Pierre a) I do not believe that the torque.properties needs to be in the classpath. The tutorial example code loads it from the file system, as far as I know. b) in your torque.properties, you have set torque.dsfactory.BddPortalCCG.connection.user which means that there is no user set for your connnection. Try setting the correct db user name there. Same goes for the torque.database.user in the build.properties. Thomas On Mon, 22 Jan 2007, Pierre-Alain Branger wrote: Hi everybody, I follow your suggestions but I still can not execute my program properly. Following, the different things I did: - I added torque.properties, actually it was not in it: export CLASSPATH=/home/pbranger/BddPortalCCG/src/conf By the way the tutorial don't mention this step. - I also added torque.properties to the default source package in Net beans. - My database is properly started - Connection url, password and username are right in the configuration file. I just borrow user and password in the mail I sent. Thomas, what do you mean by I am sure whethet mysql accepts connections without specifying a database user (as you did)? I can connect to mysql by mysql -u user -p but if I don't specify user I obviously can not connect. Thanks again for your help, Pierre This usually means that connecting to the database failed. Possible reasons are - the database is not started - the connection url, password or username are wrong in the configuration file Loking at your configuration, I am sure whethet mysql accepts connections without specifying a database user (as you did) Thomas Pierre-Alain Branger [EMAIL PROTECTED] schrieb am 20.01.2007 02:04:11: Hi everybody, I follow the tutorial and could generate my mysql database and the corresponding java access classes. I made a jar and add it to a java project that compiled well. But when I launch my application I obtain the following message: java.lang.NullPointerException: There was no DataSourceFactory configured for the connection BddPortalCCG at org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:711) at org.apache.torque.Torque.getConnection(Torque.java:268) at org.apache.torque.util.Transaction.beginOptional(Transaction.java:80) at org.apache.torque.util.Transaction.begin(Transaction.java:62) at mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:361) at mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:343) at testbddportalccg.Main.main(Main.java:36) I hope soñeone could help, me. Here are the different configuring files I use: - torque.properties torque.database.default = BddPortalCCG
Re: no DataSourceFactory configured
Hi again, Reading one more time Thomas mail I realize that I had not initialize Torque with Torque.init(torque.properties); command. So I added this line and it seems that the connection is enabled but right now I have a new error that I could not solve. Here is the trace: Exception in thread main java.lang.NoSuchMethodError: org.apache.torque.map.TableMap.setJavaName(Ljava/lang/String;)V at mx.unam.ccg.BddPortal.map.ApplicationMapBuilder.doBuild(ApplicationMapBuilder.java:70) at org.apache.torque.util.BasePeer.getMapBuilder(BasePeer.java:1970) at mx.unam.ccg.BddPortal.BaseApplicationPeer.clinit(BaseApplicationPeer.java:86) at mx.unam.ccg.BddPortal.BaseApplication.clinit(BaseApplication.java:45) at testbddportalccg.Main.main(Main.java:44) Java Result: 1 Thanks for your time, Pierre Ok, I presume you are using the Torque sample code, so you call Torque.init() with the correct properties file first thing in the application, as Guy remarked. Maybe it's time to step back and try whether you can access the database using plain jdbc. You would use the code Class.forName(org.gjt.mm.mysql.Driver); java.sql.Connection connection = java.sql.DriverManager.getConnection(databaseUrl, user, password); and see whether you can connect to the database. If not, the exception stack trace may give you a reason what is going wrong. Thomas Pierre-Alain Branger [EMAIL PROTECTED] schrieb am 23.01.2007 00:04:55: Hi Thomas, I am using a correct db user name and password in my torque.properties and build.properties files but I don't show it in the mail. Any other idea? Pierre a) I do not believe that the torque.properties needs to be in the classpath. The tutorial example code loads it from the file system, as far as I know. b) in your torque.properties, you have set torque.dsfactory.BddPortalCCG.connection.user which means that there is no user set for your connnection. Try setting the correct db user name there. Same goes for the torque.database.user in the build.properties. Thomas On Mon, 22 Jan 2007, Pierre-Alain Branger wrote: Hi everybody, I follow your suggestions but I still can not execute my program properly. Following, the different things I did: - I added torque.properties, actually it was not in it: export CLASSPATH=/home/pbranger/BddPortalCCG/src/conf By the way the tutorial don't mention this step. - I also added torque.properties to the default source package in Net beans. - My database is properly started - Connection url, password and username are right in the configuration file. I just borrow user and password in the mail I sent. Thomas, what do you mean by I am sure whethet mysql accepts connections without specifying a database user (as you did)? I can connect to mysql by mysql -u user -p but if I don't specify user I obviously can not connect. Thanks again for your help, Pierre This usually means that connecting to the database failed. Possible reasons are - the database is not started - the connection url, password or username are wrong in the configuration file Loking at your configuration, I am sure whethet mysql accepts connections without specifying a database user (as you did) Thomas Pierre-Alain Branger [EMAIL PROTECTED] schrieb am 20.01.2007 02:04:11: Hi everybody, I follow the tutorial and could generate my mysql database and the corresponding java access classes. I made a jar and add it to a java project that compiled well. But when I launch my application I obtain the following message: java.lang.NullPointerException: There was no DataSourceFactory configured for the connection BddPortalCCG at org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:711) at org.apache.torque.Torque.getConnection(Torque.java:268) at org.apache.torque.util.Transaction.beginOptional(Transaction.java:80) at org.apache.torque.util.Transaction.begin(Transaction.java:62) at mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:361) at mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:343) at testbddportalccg.Main.main(Main.java:36) I hope soñeone could help, me. Here are the different configuring files I use: - torque.properties torque.database.default = BddPortalCCG torque.database.BddPortalCCG.adapter = mysql # Using commons-dbcp torque.dsfactory.BddPortalCCG.factory org.apache.torque.dsfactory.SharedPoolDataSourceFactory torque.dsfactory.BddPortalCCG.connection.driver org.gjt.mm.mysql.Driver torque.dsfactory.BddPortalCCG.connection.url jdbc:mysql://localhost:3306/BddPortalCCG torque.dsfactory.BddPortalCCG.connection.user torque.dsfactory.BddPortalCCG.connection.password -
RE: no DataSourceFactory configured
Hi Pierre, Everything seems to be ok! Is the torque.properties in your classpath? Regards, Robert -Original Message- From: Pierre-Alain Branger [mailto:[EMAIL PROTECTED] Sent: Saturday, January 20, 2007 2:04 AM To: torque-user@db.apache.org Subject: no DataSourceFactory configured Hi everybody, I follow the tutorial and could generate my mysql database and the corresponding java access classes. I made a jar and add it to a java project that compiled well. But when I launch my application I obtain the following message: java.lang.NullPointerException: There was no DataSourceFactory configured for the connection BddPortalCCG at org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:711) at org.apache.torque.Torque.getConnection(Torque.java:268) at org.apache.torque.util.Transaction.beginOptional(Transaction.java:80) at org.apache.torque.util.Transaction.begin(Transaction.java:62) at mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:361) at mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:343) at testbddportalccg.Main.main(Main.java:36) I hope soñeone could help, me. Here are the different configuring files I use: - torque.properties torque.database.default = BddPortalCCG torque.database.BddPortalCCG.adapter = mysql # Using commons-dbcp torque.dsfactory.BddPortalCCG.factory = org.apache.torque.dsfactory.SharedPoolDataSourceFactory torque.dsfactory.BddPortalCCG.connection.driver = org.gjt.mm.mysql.Driver torque.dsfactory.BddPortalCCG.connection.url = jdbc:mysql://localhost:3306/BddPortalCCG torque.dsfactory.BddPortalCCG.connection.user = torque.dsfactory.BddPortalCCG.connection.password = - project.properties # The name of the project Torque will generate code for. torque.project=BddPortalCCG # The target database platform. torque.database=mysql # The target package to put the generated classes in. torque.targetPackage=mx.unam.ccg.BddPortal # The JDBC URL that Torque can use to create and # drop databases if instructed to do so. torque.database.createUrl=jdbc:mysql://localhost/mysql # The JDBC URL that will be used to create tables in your database. torque.database.buildUrl=jdbc:mysql://localhost/BddPortalCCG # The JDBC URL that will be used to access your database. torque.database.url=jdbc:mysql://localhost/BddPortalCCG # The JDBC database driver to use when connecting to your database. torque.database.driver=org.gjt.mm.mysql.Driver # The administrative username that has sufficient privileges to create # and drop databases and tables that Torque executes at generation time. torque.database.user= # The administrative password for the supplied username. torque.database.password= # The hostname or IP address of your database server. torque.database.host=localhost # The location of the your *-schema.xml files (see below). torque.schema.dir=./schema - schema.xml ?xml version=1.0 encoding=ISO-8859-1 standalone=no? !DOCTYPE database SYSTEM http://db.apache.org/torque/dtd/database_3_1.dtd; database name=BddPortalCCG table name=application description=Book Table column name=idApp required=true primaryKey=true type=INTEGER description=Application Id/ column name=nameApp required=true type=VARCHAR size=255 description=Application Name/ column name=pathApp required=true type=VARCHAR size=255 description=Application Path/ /table /database Thanks for your help, Pierre-Alain Branger Program of Computational Genomics Campus Morelos Tel. +52 777 13 100 24 [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: no DataSourceFactory configured
This usually means that connecting to the database failed. Possible reasons are - the database is not started - the connection url, password or username are wrong in the configuration file Loking at your configuration, I am sure whethet mysql accepts connections without specifying a database user (as you did) Thomas Pierre-Alain Branger [EMAIL PROTECTED] schrieb am 20.01.2007 02:04:11: Hi everybody, I follow the tutorial and could generate my mysql database and the corresponding java access classes. I made a jar and add it to a java project that compiled well. But when I launch my application I obtain the following message: java.lang.NullPointerException: There was no DataSourceFactory configured for the connection BddPortalCCG at org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:711) at org.apache.torque.Torque.getConnection(Torque.java:268) at org.apache.torque.util.Transaction.beginOptional(Transaction.java:80) at org.apache.torque.util.Transaction.begin(Transaction.java:62) at mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:361) at mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:343) at testbddportalccg.Main.main(Main.java:36) I hope soñeone could help, me. Here are the different configuring files I use: - torque.properties torque.database.default = BddPortalCCG torque.database.BddPortalCCG.adapter = mysql # Using commons-dbcp torque.dsfactory.BddPortalCCG.factory = org.apache.torque.dsfactory.SharedPoolDataSourceFactory torque.dsfactory.BddPortalCCG.connection.driver = org.gjt.mm.mysql.Driver torque.dsfactory.BddPortalCCG.connection.url = jdbc:mysql://localhost:3306/BddPortalCCG torque.dsfactory.BddPortalCCG.connection.user = torque.dsfactory.BddPortalCCG.connection.password = - project.properties # The name of the project Torque will generate code for. torque.project=BddPortalCCG # The target database platform. torque.database=mysql # The target package to put the generated classes in. torque.targetPackage=mx.unam.ccg.BddPortal # The JDBC URL that Torque can use to create and # drop databases if instructed to do so. torque.database.createUrl=jdbc:mysql://localhost/mysql # The JDBC URL that will be used to create tables in your database. torque.database.buildUrl=jdbc:mysql://localhost/BddPortalCCG # The JDBC URL that will be used to access your database. torque.database.url=jdbc:mysql://localhost/BddPortalCCG # The JDBC database driver to use when connecting to your database. torque.database.driver=org.gjt.mm.mysql.Driver # The administrative username that has sufficient privileges to create # and drop databases and tables that Torque executes at generation time. torque.database.user= # The administrative password for the supplied username. torque.database.password= # The hostname or IP address of your database server. torque.database.host=localhost # The location of the your *-schema.xml files (see below). torque.schema.dir=./schema - schema.xml ?xml version=1.0 encoding=ISO-8859-1 standalone=no? !DOCTYPE database SYSTEM http://db.apache.org/torque/dtd/database_3_1.dtd; database name=BddPortalCCG table name=application description=Book Table column name=idApp required=true primaryKey=true type=INTEGER description=Application Id/ column name=nameApp required=true type=VARCHAR size=255 description=Application Name/ column name=pathApp required=true type=VARCHAR size=255 description=Application Path/ /table /database Thanks for your help, Pierre-Alain Branger Program of Computational Genomics Campus Morelos Tel. +52 777 13 100 24 [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: no DataSourceFactory configured
Hi everybody, I follow your suggestions but I still can not execute my program properly. Following, the different things I did: - I added torque.properties, actually it was not in it: export CLASSPATH=/home/pbranger/BddPortalCCG/src/conf By the way the tutorial don't mention this step. - I also added torque.properties to the default source package in Net beans. - My database is properly started - Connection url, password and username are right in the configuration file. I just borrow user and password in the mail I sent. Thomas, what do you mean by I am sure whethet mysql accepts connections without specifying a database user (as you did)? I can connect to mysql by mysql -u user -p but if I don't specify user I obviously can not connect. Thanks again for your help, Pierre This usually means that connecting to the database failed. Possible reasons are - the database is not started - the connection url, password or username are wrong in the configuration file Loking at your configuration, I am sure whethet mysql accepts connections without specifying a database user (as you did) Thomas Pierre-Alain Branger [EMAIL PROTECTED] schrieb am 20.01.2007 02:04:11: Hi everybody, I follow the tutorial and could generate my mysql database and the corresponding java access classes. I made a jar and add it to a java project that compiled well. But when I launch my application I obtain the following message: java.lang.NullPointerException: There was no DataSourceFactory configured for the connection BddPortalCCG at org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:711) at org.apache.torque.Torque.getConnection(Torque.java:268) at org.apache.torque.util.Transaction.beginOptional(Transaction.java:80) at org.apache.torque.util.Transaction.begin(Transaction.java:62) at mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:361) at mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:343) at testbddportalccg.Main.main(Main.java:36) I hope soñeone could help, me. Here are the different configuring files I use: - torque.properties torque.database.default = BddPortalCCG torque.database.BddPortalCCG.adapter = mysql # Using commons-dbcp torque.dsfactory.BddPortalCCG.factory = org.apache.torque.dsfactory.SharedPoolDataSourceFactory torque.dsfactory.BddPortalCCG.connection.driver = org.gjt.mm.mysql.Driver torque.dsfactory.BddPortalCCG.connection.url = jdbc:mysql://localhost:3306/BddPortalCCG torque.dsfactory.BddPortalCCG.connection.user = torque.dsfactory.BddPortalCCG.connection.password = - project.properties # The name of the project Torque will generate code for. torque.project=BddPortalCCG # The target database platform. torque.database=mysql # The target package to put the generated classes in. torque.targetPackage=mx.unam.ccg.BddPortal # The JDBC URL that Torque can use to create and # drop databases if instructed to do so. torque.database.createUrl=jdbc:mysql://localhost/mysql # The JDBC URL that will be used to create tables in your database. torque.database.buildUrl=jdbc:mysql://localhost/BddPortalCCG # The JDBC URL that will be used to access your database. torque.database.url=jdbc:mysql://localhost/BddPortalCCG # The JDBC database driver to use when connecting to your database. torque.database.driver=org.gjt.mm.mysql.Driver # The administrative username that has sufficient privileges to create # and drop databases and tables that Torque executes at generation time. torque.database.user= # The administrative password for the supplied username. torque.database.password= # The hostname or IP address of your database server. torque.database.host=localhost # The location of the your *-schema.xml files (see below). torque.schema.dir=./schema - schema.xml ?xml version=1.0 encoding=ISO-8859-1 standalone=no? !DOCTYPE database SYSTEM http://db.apache.org/torque/dtd/database_3_1.dtd; database name=BddPortalCCG table name=application description=Book Table column name=idApp required=true primaryKey=true type=INTEGER description=Application Id/ column name=nameApp required=true type=VARCHAR size=255 description=Application Name/ column name=pathApp required=true type=VARCHAR size=255 description=Application Path/ /table /database Thanks for your help, Pierre-Alain Branger Program of Computational Genomics Campus Morelos Tel. +52 777 13 100 24 [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To
Re: no DataSourceFactory configured
a) I do not believe that the torque.properties needs to be in the classpath. The tutorial example code loads it from the file system, as far as I know. b) in your torque.properties, you have set torque.dsfactory.BddPortalCCG.connection.user = which means that there is no user set for your connnection. Try setting the correct db user name there. Same goes for the torque.database.user in the build.properties. Thomas On Mon, 22 Jan 2007, Pierre-Alain Branger wrote: Hi everybody, I follow your suggestions but I still can not execute my program properly. Following, the different things I did: - I added torque.properties, actually it was not in it: export CLASSPATH=/home/pbranger/BddPortalCCG/src/conf By the way the tutorial don't mention this step. - I also added torque.properties to the default source package in Net beans. - My database is properly started - Connection url, password and username are right in the configuration file. I just borrow user and password in the mail I sent. Thomas, what do you mean by I am sure whethet mysql accepts connections without specifying a database user (as you did)? I can connect to mysql by mysql -u user -p but if I don't specify user I obviously can not connect. Thanks again for your help, Pierre This usually means that connecting to the database failed. Possible reasons are - the database is not started - the connection url, password or username are wrong in the configuration file Loking at your configuration, I am sure whethet mysql accepts connections without specifying a database user (as you did) Thomas Pierre-Alain Branger [EMAIL PROTECTED] schrieb am 20.01.2007 02:04:11: Hi everybody, I follow the tutorial and could generate my mysql database and the corresponding java access classes. I made a jar and add it to a java project that compiled well. But when I launch my application I obtain the following message: java.lang.NullPointerException: There was no DataSourceFactory configured for the connection BddPortalCCG at org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:711) at org.apache.torque.Torque.getConnection(Torque.java:268) at org.apache.torque.util.Transaction.beginOptional(Transaction.java:80) at org.apache.torque.util.Transaction.begin(Transaction.java:62) at mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:361) at mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:343) at testbddportalccg.Main.main(Main.java:36) I hope soñeone could help, me. Here are the different configuring files I use: - torque.properties torque.database.default = BddPortalCCG torque.database.BddPortalCCG.adapter = mysql # Using commons-dbcp torque.dsfactory.BddPortalCCG.factory = org.apache.torque.dsfactory.SharedPoolDataSourceFactory torque.dsfactory.BddPortalCCG.connection.driver = org.gjt.mm.mysql.Driver torque.dsfactory.BddPortalCCG.connection.url = jdbc:mysql://localhost:3306/BddPortalCCG torque.dsfactory.BddPortalCCG.connection.user = torque.dsfactory.BddPortalCCG.connection.password = - project.properties # The name of the project Torque will generate code for. torque.project=BddPortalCCG # The target database platform. torque.database=mysql # The target package to put the generated classes in. torque.targetPackage=mx.unam.ccg.BddPortal # The JDBC URL that Torque can use to create and # drop databases if instructed to do so. torque.database.createUrl=jdbc:mysql://localhost/mysql # The JDBC URL that will be used to create tables in your database. torque.database.buildUrl=jdbc:mysql://localhost/BddPortalCCG # The JDBC URL that will be used to access your database. torque.database.url=jdbc:mysql://localhost/BddPortalCCG # The JDBC database driver to use when connecting to your database. torque.database.driver=org.gjt.mm.mysql.Driver # The administrative username that has sufficient privileges to create # and drop databases and tables that Torque executes at generation time. torque.database.user= # The administrative password for the supplied username. torque.database.password= # The hostname or IP address of your database server. torque.database.host=localhost # The location of the your *-schema.xml files (see below). torque.schema.dir=./schema - schema.xml ?xml version=1.0 encoding=ISO-8859-1 standalone=no? !DOCTYPE database SYSTEM http://db.apache.org/torque/dtd/database_3_1.dtd; database name=BddPortalCCG table name=application description=Book Table column name=idApp required=true primaryKey=true type=INTEGER description=Application Id/ column name=nameApp required=true type=VARCHAR size=255 description=Application Name/ column name=pathApp required=true type=VARCHAR size=255 description=Application Path/ /table /database Thanks
Re: no DataSourceFactory configured
Do you initiate Torque in your code? In the old version we use we call Torque.init(full path of torque.propeties); Before we try using Torque in any way. I put it in the init method of the first servlet of the web application. On Mon, 2007-01-22 at 11:46 -0600, Pierre-Alain Branger wrote: Hi everybody, I follow your suggestions but I still can not execute my program properly. Following, the different things I did: - I added torque.properties, actually it was not in it: export CLASSPATH=/home/pbranger/BddPortalCCG/src/conf By the way the tutorial don't mention this step. - I also added torque.properties to the default source package in Net beans. - My database is properly started - Connection url, password and username are right in the configuration file. I just borrow user and password in the mail I sent. Thomas, what do you mean by I am sure whethet mysql accepts connections without specifying a database user (as you did)? I can connect to mysql by mysql -u user -p but if I don't specify user I obviously can not connect. Thanks again for your help, Pierre This usually means that connecting to the database failed. Possible reasons are - the database is not started - the connection url, password or username are wrong in the configuration file Loking at your configuration, I am sure whethet mysql accepts connections without specifying a database user (as you did) Thomas Pierre-Alain Branger [EMAIL PROTECTED] schrieb am 20.01.2007 02:04:11: Hi everybody, I follow the tutorial and could generate my mysql database and the corresponding java access classes. I made a jar and add it to a java project that compiled well. But when I launch my application I obtain the following message: java.lang.NullPointerException: There was no DataSourceFactory configured for the connection BddPortalCCG at org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:711) at org.apache.torque.Torque.getConnection(Torque.java:268) at org.apache.torque.util.Transaction.beginOptional(Transaction.java:80) at org.apache.torque.util.Transaction.begin(Transaction.java:62) at mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:361) at mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:343) at testbddportalccg.Main.main(Main.java:36) I hope soñeone could help, me. Here are the different configuring files I use: - torque.properties torque.database.default = BddPortalCCG torque.database.BddPortalCCG.adapter = mysql # Using commons-dbcp torque.dsfactory.BddPortalCCG.factory = org.apache.torque.dsfactory.SharedPoolDataSourceFactory torque.dsfactory.BddPortalCCG.connection.driver = org.gjt.mm.mysql.Driver torque.dsfactory.BddPortalCCG.connection.url = jdbc:mysql://localhost:3306/BddPortalCCG torque.dsfactory.BddPortalCCG.connection.user = torque.dsfactory.BddPortalCCG.connection.password = - project.properties # The name of the project Torque will generate code for. torque.project=BddPortalCCG # The target database platform. torque.database=mysql # The target package to put the generated classes in. torque.targetPackage=mx.unam.ccg.BddPortal # The JDBC URL that Torque can use to create and # drop databases if instructed to do so. torque.database.createUrl=jdbc:mysql://localhost/mysql # The JDBC URL that will be used to create tables in your database. torque.database.buildUrl=jdbc:mysql://localhost/BddPortalCCG # The JDBC URL that will be used to access your database. torque.database.url=jdbc:mysql://localhost/BddPortalCCG # The JDBC database driver to use when connecting to your database. torque.database.driver=org.gjt.mm.mysql.Driver # The administrative username that has sufficient privileges to create # and drop databases and tables that Torque executes at generation time. torque.database.user= # The administrative password for the supplied username. torque.database.password= # The hostname or IP address of your database server. torque.database.host=localhost # The location of the your *-schema.xml files (see below). torque.schema.dir=./schema - schema.xml ?xml version=1.0 encoding=ISO-8859-1 standalone=no? !DOCTYPE database SYSTEM http://db.apache.org/torque/dtd/database_3_1.dtd; database name=BddPortalCCG table name=application description=Book Table column name=idApp required=true primaryKey=true type=INTEGER description=Application Id/ column name=nameApp required=true type=VARCHAR size=255 description=Application Name/ column name=pathApp required=true type=VARCHAR size=255
Re: no DataSourceFactory configured
Hi Thomas, I am using a correct db user name and password in my torque.properties and build.properties files but I don't show it in the mail. Any other idea? Pierre a) I do not believe that the torque.properties needs to be in the classpath. The tutorial example code loads it from the file system, as far as I know. b) in your torque.properties, you have set torque.dsfactory.BddPortalCCG.connection.user which means that there is no user set for your connnection. Try setting the correct db user name there. Same goes for the torque.database.user in the build.properties. Thomas On Mon, 22 Jan 2007, Pierre-Alain Branger wrote: Hi everybody, I follow your suggestions but I still can not execute my program properly. Following, the different things I did: - I added torque.properties, actually it was not in it: export CLASSPATH=/home/pbranger/BddPortalCCG/src/conf By the way the tutorial don't mention this step. - I also added torque.properties to the default source package in Net beans. - My database is properly started - Connection url, password and username are right in the configuration file. I just borrow user and password in the mail I sent. Thomas, what do you mean by I am sure whethet mysql accepts connections without specifying a database user (as you did)? I can connect to mysql by mysql -u user -p but if I don't specify user I obviously can not connect. Thanks again for your help, Pierre This usually means that connecting to the database failed. Possible reasons are - the database is not started - the connection url, password or username are wrong in the configuration file Loking at your configuration, I am sure whethet mysql accepts connections without specifying a database user (as you did) Thomas Pierre-Alain Branger [EMAIL PROTECTED] schrieb am 20.01.2007 02:04:11: Hi everybody, I follow the tutorial and could generate my mysql database and the corresponding java access classes. I made a jar and add it to a java project that compiled well. But when I launch my application I obtain the following message: java.lang.NullPointerException: There was no DataSourceFactory configured for the connection BddPortalCCG at org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:711) at org.apache.torque.Torque.getConnection(Torque.java:268) at org.apache.torque.util.Transaction.beginOptional(Transaction.java:80) at org.apache.torque.util.Transaction.begin(Transaction.java:62) at mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:361) at mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:343) at testbddportalccg.Main.main(Main.java:36) I hope soñeone could help, me. Here are the different configuring files I use: - torque.properties torque.database.default = BddPortalCCG torque.database.BddPortalCCG.adapter = mysql # Using commons-dbcp torque.dsfactory.BddPortalCCG.factory org.apache.torque.dsfactory.SharedPoolDataSourceFactory torque.dsfactory.BddPortalCCG.connection.driver org.gjt.mm.mysql.Driver torque.dsfactory.BddPortalCCG.connection.url jdbc:mysql://localhost:3306/BddPortalCCG torque.dsfactory.BddPortalCCG.connection.user torque.dsfactory.BddPortalCCG.connection.password - project.properties # The name of the project Torque will generate code for. torque.project=BddPortalCCG # The target database platform. torque.database=mysql # The target package to put the generated classes in. torque.targetPackage=mx.unam.ccg.BddPortal # The JDBC URL that Torque can use to create and # drop databases if instructed to do so. torque.database.createUrl=jdbc:mysql://localhost/mysql # The JDBC URL that will be used to create tables in your database. torque.database.buildUrl=jdbc:mysql://localhost/BddPortalCCG # The JDBC URL that will be used to access your database. torque.database.url=jdbc:mysql://localhost/BddPortalCCG # The JDBC database driver to use when connecting to your database. torque.database.driver=org.gjt.mm.mysql.Driver # The administrative username that has sufficient privileges to create # and drop databases and tables that Torque executes at generation time. torque.database.user # The administrative password for the supplied username. torque.database.password # The hostname or IP address of your database server. torque.database.host=localhost # The location of the your *-schema.xml files (see below). torque.schema.dir=./schema - schema.xml ?xml version=1.0 encoding=ISO-8859-1 standalone=no? !DOCTYPE database SYSTEM http://db.apache.org/torque/dtd/database_3_1.dtd; database name=BddPortalCCG table name=application description=Book Table column name=idApp required=true primaryKey=true type=INTEGER description=Application Id/