cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Soheil Eizadi <seiz...@infoblox.com>
Subject Master Branch problem cannot login
Date Fri, 14 Jun 2013 06:36:59 GMT
I synced today, initialized the database and built image and found that I could not login to
the CS UI. Not sure exactly what is going on but looks like the default field for Account
Table was not created, when I tried to manually create it I got an error. The problem corrected
itself when I ran the deployDB mvn build a second time after I had created the field manually.
I can now log into the CS UI, but I thought I would document it here.
-Soheil

Below is more detail log.
Administrators-MacBook-Pro-7:cloudstack seizadi$ git branch
* infoblox
  master
Administrators-MacBook-Pro-7:cloudstack seizadi$ git merge master
Already up-to-date.

>From AccountVO.java:

@Entity

@Table(name="account")

public class AccountVO implements Account {

    @Id

    @GeneratedValue(strategy=GenerationType.IDENTITY)

    @Column(name="id")

    private long id;


.....



    @Column(name = "default")

    boolean isDefault;

>From create-schema.sql I don't see any field default defined:

CREATE TABLE  `cloud`.`account` (
  `id` bigint unsigned NOT NULL auto_increment,
  `account_name` varchar(100) COMMENT 'an account name set by the creator of the account,
defaults to username for single accounts',
  `uuid` varchar(40),
  `type` int(1) unsigned NOT NULL,
  `domain_id` bigint unsigned,
  `state` varchar(10) NOT NULL default 'enabled',
  `removed` datetime COMMENT 'date removed',
  `cleanup_needed` tinyint(1) NOT NULL default '0',
  `network_domain` varchar(255),
  `default_zone_id` bigint unsigned,
  PRIMARY KEY  (`id`),
  INDEX i_account__removed(`removed`),
  CONSTRAINT `fk_account__default_zone_id` FOREIGN KEY `fk_account__default_zone_id`(`default_zone_id`)
REFERENCES `data_center`(`id`) ON DELETE CASCADE,
  INDEX `i_account__cleanup_needed`(`cleanup_needed`),
  INDEX `i_account__account_name__domain_id__removed`(`account_name`, `domain_id`, `removed`),
  CONSTRAINT `fk_account__domain_id` FOREIGN KEY(`domain_id`) REFERENCES `domain` (`id`),
  INDEX `i_account__domain_id`(`domain_id`),
  CONSTRAINT `uc_account__uuid` UNIQUE (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

mysql> select * from account;
+----+--------------+--------------------------------------+------+-----------+---------+---------+----------------+----------------+-----------------+
| id | account_name | uuid                                 | type | domain_id | state   |
removed | cleanup_needed | network_domain | default_zone_id |
+----+--------------+--------------------------------------+------+-----------+---------+---------+----------------+----------------+-----------------+
|  1 | system       | 401c6676-d1f2-11e2-a780-ee6f6199dc83 |    1 |         1 | enabled |
NULL    |              0 | NULL           |            NULL |
|  2 | admin        | 401c74fe-d1f2-11e2-a780-ee6f6199dc83 |    1 |         1 | enabled |
NULL    |              0 | NULL           |            NULL |
+----+--------------+--------------------------------------+------+-----------+---------+---------+----------------+----------------+-----------------+
2 rows in set (0.00 sec)

----
ERROR [cloud.api.ApiServlet] (2071009240@qtp-761108485-3:) unknown exception writing api response
com.cloud.utils.exception.CloudRuntimeException: DB Exception on: com.mysql.jdbc.PreparedStatement@52c0152d:
SELECT account.id, account.account_name, account.type, account.domain_id, account.state, account.removed,
account.cleanup_needed, account.network_domain, account.uuid, account.default_zone_id, account.default
FROM account WHERE account.id = 2
at com.cloud.utils.db.GenericDaoBase.findById(GenericDaoBase.java:979)
at com.cloud.utils.component.ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept(ComponentInstantiationPostProcessor.java:125)
at com.cloud.utils.db.GenericDaoBase.findByIdIncludingRemoved(GenericDaoBase.java:939)
at com.cloud.utils.component.ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept(ComponentInstantiationPostProcessor.java:125)
at com.cloud.user.AccountManagerImpl.getAccount(AccountManagerImpl.java:1632)
at com.cloud.api.ApiServer.loginUser(ApiServer.java:808)
at com.cloud.api.ApiServlet.processRequest(ApiServlet.java:210)
at com.cloud.api.ApiServlet.doPost(ApiServlet.java:71)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'account.default'
in 'field list'
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.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1053)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4074)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4006)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2468)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2629)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2719)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2318)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
at com.cloud.utils.db.GenericDaoBase.findById(GenericDaoBase.java:976)
... 34 more

If I create it manually:
diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql
index c88132d..e49782d 100755
--- a/setup/db/create-schema.sql
+++ b/setup/db/create-schema.sql
@@ -1326,6 +1326,7 @@ CREATE TABLE  `cloud`.`account` (
   `cleanup_needed` tinyint(1) NOT NULL default '0',
   `network_domain` varchar(255),
   `default_zone_id` bigint unsigned,
+  `default` tinyint NOT NULL default '0',
   PRIMARY KEY  (`id`),
   INDEX i_account__removed(`removed`),
   CONSTRAINT `fk_account__default_zone_id` FOREIGN KEY `fk_account__default_zone_id`(`default_zone_id`)
REFERENCES `data_center`(`id`

I get following error:
========> Processing upgrade: com.cloud.upgrade.DatabaseUpgradeChecker
[WARNING]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
at java.lang.Thread.run(Thread.java:680)
Caused by: com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the database
at com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:266)
at com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:364)
at com.cloud.upgrade.DatabaseCreator.main(DatabaseCreator.java:216)
... 6 more
Caused by: com.cloud.utils.exception.CloudRuntimeException: Unable to execute upgrade script:
/Users/seizadi/cloudstack/infoblox_branch/cloudstack/developer/target/db/db/schema-410to420.sql
at com.cloud.upgrade.DatabaseUpgradeChecker.runScript(DatabaseUpgradeChecker.java:183)
at com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:235)
... 8 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate column name
'default'
at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:193)
at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:87)
at com.cloud.upgrade.DatabaseUpgradeChecker.runScript(DatabaseUpgradeChecker.java:174)
... 9 more

After removing the change to create-schema.sql now I have the default column in my database,
initialized to true/1 and I can login to UI.

mysql> select * from account;
+----+--------------+--------------------------------------+------+-----------+---------+---------+----------------+----------------+-----------------+---------+
| id | account_name | uuid                                 | type | domain_id | state   |
removed | cleanup_needed | network_domain | default_zone_id | default |
+----+--------------+--------------------------------------+------+-----------+---------+---------+----------------+----------------+-----------------+---------+
|  1 | system       | 22ff801c-d4ba-11e2-bb4d-a088cb607e58 |    1 |         1 | enabled |
NULL    |              0 | NULL           |            NULL |       1 |
|  2 | admin        | 22ff8b34-d4ba-11e2-bb4d-a088cb607e58 |    1 |         1 | enabled |
NULL    |              0 | NULL           |            NULL |       1 |
+----+--------------+--------------------------------------+------+-----------+---------+---------+----------------+----------------+-----------------+---------+
2 rows in set (0.00 sec)




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message