" scaffold " throws and error while executing CRUD operations .

72 views
Skip to first unread message

Ashish Tiwari

unread,
Aug 1, 2012, 12:49:08 AM8/1/12
to scooter-...@googlegroups.com
Before using the ScooterFramework i worked on PlayFramework . But I love the simplicity of the scooter .

I have latest scooter framework source code.
I am following the Blog tutorial , when i am trying to run java -jar tools/generate.jar blog scaffold post   It throws an error as below .

ashish@codeleaf:/media/Development/ToolKit/frameworks/scooter$ java -jar tools/generate.jar blog scaffold post
Generating code for app named blog:
scooter.home: /media/Development/ToolKit/frameworks/scooter
Target dir: /media/Development/ToolKit/frameworks/scooter/webapps/blog
log4j:WARN No appenders could be found for logger (com.mchange.v2.log.MLog).
log4j:WARN Please initialize the log4j system properly.
exists /media/Development/ToolKit/frameworks/scooter/webapps/blog/WEB-INF/src/blog/controllers/ApplicationController.java
com.scooterframework.common.exception.ObjectCreationException: Failed to instantiate class "com.scooterframework.orm.activerecord.ActiveRecord". Details: java.lang.Exception: com.scooterframework.orm.activerecord.ActiveRecord.
at com.scooterframework.orm.activerecord.ActiveRecordUtil.generateActiveRecordInstance(ActiveRecordUtil.java:319)
at com.scooterframework.tools.common.AbstractGenerator.generateActiveRecordHomeInstance(AbstractGenerator.java:73)
at com.scooterframework.tools.generator.ControllerScaffoldGenerator.<init>(ControllerScaffoldGenerator.java:80)
at com.scooterframework.tools.generator.CodeGenerator.doTheWork(CodeGenerator.java:209)
at com.scooterframework.tools.generator.CodeGenerator.main(CodeGenerator.java:90)
Caused by: java.lang.Exception: com.scooterframework.orm.activerecord.ActiveRecord
at com.scooterframework.orm.activerecord.ActiveRecordUtil.newInstance(ActiveRecordUtil.java:347)
at com.scooterframework.orm.activerecord.ActiveRecordUtil.generateActiveRecordInstance(ActiveRecordUtil.java:310)
... 4 more
Caused by: com.scooterframework.common.exception.ObjectCreationException: Failed to instantiate class "com.scooterframework.orm.activerecord.ActiveRecord". Details: ConnectionUtil.createPooledConnection failed for conectionName "blog_development" because Connections could not be acquired from the underlying database!.
at com.scooterframework.common.util.ObjectFactory.newInstance(ObjectFactory.java:68)
at com.scooterframework.orm.activerecord.ActiveRecordUtil.newInstance(ActiveRecordUtil.java:339)
... 5 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.scooterframework.common.util.ObjectFactory.newInstance(ObjectFactory.java:66)
... 6 more
Caused by: com.scooterframework.orm.sqldataexpress.exception.CreateConnectionFailureException: ConnectionUtil.createPooledConnection failed for conectionName "blog_development" because Connections could not be acquired from the underlying database!connName = null
at com.scooterframework.orm.sqldataexpress.connection.ConnectionUtil.createPooledConnection(ConnectionUtil.java:342)
at com.scooterframework.orm.sqldataexpress.connection.ConnectionUtil.createPooledConnection(ConnectionUtil.java:274)
at com.scooterframework.orm.sqldataexpress.connection.JdbcConnection.createConnection(JdbcConnection.java:45)
at com.scooterframework.orm.sqldataexpress.connection.UserDatabaseConnectionImpl.getConnection(UserDatabaseConnectionImpl.java:57)
at com.scooterframework.orm.sqldataexpress.util.DAOUtil.closeConnection(DAOUtil.java:28)
at com.scooterframework.orm.sqldataexpress.util.SqlExpressUtil.lookupTableInfo(SqlExpressUtil.java:731)
at com.scooterframework.orm.activerecord.ActiveRecord.lookupAndRegister(ActiveRecord.java:2644)
at com.scooterframework.orm.activerecord.ActiveRecord.initialize(ActiveRecord.java:2568)
at com.scooterframework.orm.activerecord.ActiveRecord.<init>(ActiveRecord.java:301)
... 11 more
Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:529)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:134)
at com.scooterframework.orm.sqldataexpress.connection.ConnectionUtil.createPooledConnection(ConnectionUtil.java:340)
... 19 more
Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1319)
at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)
at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)
... 21 more
ERROR ERROR ERROR: Failed to instantiate class "com.scooterframework.orm.activerecord.ActiveRecord". Details: java.lang.Exception: com.scooterframework.orm.activerecord.ActiveRecord.

please guys help me , I am building an WebApplication in SCOOTER  .

stark

unread,
Aug 1, 2012, 1:10:02 AM8/1/12
to scooter-...@googlegroups.com
i think you have not created the database... 'blog_development' and it cant create a connection.

check the config properties for the db connection parameters and create the db with the sql create script for that example.

WEB-INF/config/database.properties
static/docs/blog_development.sql

hope that helps.

+1 on your "But I love the simplicity of the scooter ."

Ashish

unread,
Aug 1, 2012, 2:22:41 AM8/1/12
to scooter-...@googlegroups.com
Thanks stark .

Actually I have assigned a password to Mysql and in the database.properties password was blank ...

database.connection.blog_development=\
        driver=com.mysql.jdbc.Driver,\
        url=jdbc:mysql://localhost:3306/blog_development?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull,\
        username=root,\
        password=,\
        max_pool_size=10,\
        min_pool_size=1

problem solved .

doninsd

unread,
Aug 22, 2012, 2:40:16 PM8/22/12
to scooter-...@googlegroups.com
I had the same issue - configured the database properties file to use a user level account. Switched it to root with a pw and it worked great.
Reply all
Reply to author
Forward
0 new messages