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 -