jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Sonar
  • SONAR-1275

Error when running for the first time with PostgreSQL 8.2 : ActiveRecord::ActiveRecordError: ERROR: value too long for type character varying(9)

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.11.1
  • Fix Version/s: 1.12
  • Component/s: Database
  • Labels:
    None

Description

Running the latest Sonar release - fresh installation, database set to PostgreSQL - db created with "createuser -E -P sonar; createdb -E UNICODE -O sonar sonar".

When Sonar populates the database initially (I can see its table structure in the database afterwards), at some stage the following error is logged:

2009.11.19 11:04:18 WARN / unable to create shared application instance
org.jruby.rack.RackInitializationException: An error has occurred, all later migrations canceled:

ActiveRecord::ActiveRecordError: ERROR: value too long for type character varying(9)
: INSERT INTO "metrics" ("name", "description", "direction", "domain", "short_name", "qualitative", "val_type", "user_managed", "enabled", "origin") VALUES('c
ode_coverage_line_hits_data', 'Code coverage line hits data', 0, 'Tests', 'Code coverage data', 'f', 'DATA', 'f', 't', NULL)
from /opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-jdbc-adapter-0.9/lib/active_record/connection_adapters/jdbc_adapter.rb:581:in `exe
cute'
from /opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-jdbc-adapter-0.9/lib/jdbc_adapter/jdbc_postgre.rb:167:in `insert'
from /opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/base.rb:2733:in `create'
from /opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/callbacks.rb:237:in `create_with_callbacks'
from /opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/timestamp.rb:29:in `create_with_timestamps'
from /opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/base.rb:2699:in `create_or_update'
from /opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/callbacks.rb:222:in `create_or_update_with_callbacks'
from /opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/base.rb:2383:in `save'
... 32 levels...
from file:/opt/sonar-1.11.1/war/sonar-web/WEB-INF/lib/jruby-rack-0.9.4.jar!/rack/builder.rb:29:in `instance_eval'
from file:/opt/sonar-1.11.1/war/sonar-web/WEB-INF/lib/jruby-rack-0.9.4.jar!/rack/builder.rb:29:in `initialize'
from <script>:2

at org.jruby.rack.DefaultRackApplicationFactory$4.init(DefaultRackApplicationFactory.java:153) [jruby-rack-0.9.4.jar:na]
at org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:50) [jruby-rack-0.9.4.jar:na]
at org.jruby.rack.SharedRackApplicationFactory.init(SharedRackApplicationFactory.java:26) [jruby-rack-0.9.4.jar:na]
at org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:39) [jruby-rack-0.9.4.jar:na]
at org.sonar.web.listeners.ApplicationListener.contextInitialized(ApplicationListener.java:70) [classes/:na]
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548) [jetty-6.1.17.jar:6.1.17]
at org.mortbay.jetty.servlet.Context.startContext(Context.java:136) [jetty-6.1.17.jar:6.1.17]
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1239) [jetty-6.1.17.jar:6.1.17]
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517) [jetty-6.1.17.jar:6.1.17]
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:466) [jetty-6.1.17.jar:6.1.17]
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) [jetty-util-6.1.17.jar:6.1.17]
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) [jetty-6.1.17.jar:6.1.17]
at org.mortbay.jetty.Server.doStart(Server.java:224) [jetty-6.1.17.jar:6.1.17]
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) [jetty-util-6.1.17.jar:6.1.17]
at org.sonar.application.JettyEmbedder.start(JettyEmbedder.java:81) [sonar-application-1.11.1.jar:na]
at org.sonar.application.StartServer.main(StartServer.java:41) [sonar-application-1.11.1.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [na:1.6.0_10]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [na:1.6.0_10]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [na:1.6.0_10]
at java.lang.reflect.Method.invoke(Method.java:597) [na:1.6.0_10]
at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:237) [wrapper.jar:3.3.0]
at java.lang.Thread.run(Thread.java:619) [na:1.6.0_10]
Caused by: org.jruby.exceptions.RaiseException: An error has occurred, all later migrations canceled:

ActiveRecord::ActiveRecordError: ERROR: value too long for type character varying(9)
: INSERT INTO "metrics" ("name", "description", "direction", "domain", "short_name", "qualitative", "val_type", "user_managed", "enabled", "origin") VALUES('c
ode_coverage_line_hits_data', 'Code coverage line hits data', 0, 'Tests', 'Code coverage data', 'f', 'DATA', 'f', 't', NULL)
at Kernel.raise(/opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/migration.rb:485) [na:na]
at ActiveRecord::Migrator.migrate(/opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/migration.rb:466) [na:na]
at Array.each(/opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/migration.rb:466) [na:na]
at ActiveRecord::Migrator.migrate(/opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/migration.rb:394) [na:na]
at #<Class:01x17d56b>.up(/opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/migration.rb:377) [na:na]
at #<Class:01x17d56b>.migrate(/opt/sonar-1.11.1/war/sonar-web/WEB-INF/config/../lib/database_version.rb:63) [na:na]
at #<Class:01x640b25>.setup(/opt/sonar-1.11.1/war/sonar-web/WEB-INF/config/../lib/database_version.rb:70) [na:na]
at #<Class:01x640b25>.automatic_setup(/opt/sonar-1.11.1/war/sonar-web/WEB-INF/config/environment.rb:195) [na:na]
at (unknown).(unknown)(/opt/sonar-1.11.1/war/sonar-web/WEB-INF/config/environment.rb:26) [na:na]
at Kernel.load(file:/opt/sonar-1.11.1/war/sonar-web/WEB-INF/lib/jruby-rack-0.9.4.jar!/jruby/rack/rails.rb:26) [na:na]
at JRuby::Rack::RailsServletHelper.load_environment(file:/opt/sonar-1.11.1/war/sonar-web/WEB-INF/lib/jruby-rack-0.9.4.jar!/jruby/rack/rails.rb:151) [n
a:na]
at #<Class:01xdc64a2>.new(<script>:2) [na:na]
at (unknown).(unknown)(file:/opt/sonar-1.11.1/war/sonar-web/WEB-INF/lib/jruby-rack-0.9.4.jar!/rack/builder.rb:29) [na:na]
at Kernel.instance_eval(file:/opt/sonar-1.11.1/war/sonar-web/WEB-INF/lib/jruby-rack-0.9.4.jar!/rack/builder.rb:29) [na:na]
at Kernel.instance_eval(file:/opt/sonar-1.11.1/war/sonar-web/WEB-INF/lib/jruby-rack-0.9.4.jar!/rack/builder.rb:29) [na:na]
at Rack::Builder.initialize(<script>:2) [na:na]
at (unknown).(unknown)(:1) [na:na]
2009.11.19 11:04:18 WARN / Error: application initialization failed
org.jruby.rack.RackInitializationException: unable to create shared application instance
at org.jruby.rack.SharedRackApplicationFactory.init(SharedRackApplicationFactory.java:38) [jruby-rack-0.9.4.jar:na]
at org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:39) [jruby-rack-0.9.4.jar:na]
at org.sonar.web.listeners.ApplicationListener.contextInitialized(ApplicationListener.java:70) [classes/:na]
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548) [jetty-6.1.17.jar:6.1.17]
at org.mortbay.jetty.servlet.Context.startContext(Context.java:136) [jetty-6.1.17.jar:6.1.17]
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1239) [jetty-6.1.17.jar:6.1.17]
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517) [jetty-6.1.17.jar:6.1.17]
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:466) [jetty-6.1.17.jar:6.1.17]
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) [jetty-util-6.1.17.jar:6.1.17]
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) [jetty-6.1.17.jar:6.1.17]
at org.mortbay.jetty.Server.doStart(Server.java:224) [jetty-6.1.17.jar:6.1.17]
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) [jetty-util-6.1.17.jar:6.1.17]
at org.sonar.application.JettyEmbedder.start(JettyEmbedder.java:81) [sonar-application-1.11.1.jar:na]
at org.sonar.application.StartServer.main(StartServer.java:41) [sonar-application-1.11.1.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [na:1.6.0_10]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [na:1.6.0_10]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [na:1.6.0_10]
at java.lang.reflect.Method.invoke(Method.java:597) [na:1.6.0_10]
at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:237) [wrapper.jar:3.3.0]
at java.lang.Thread.run(Thread.java:619) [na:1.6.0_10]
Caused by: org.jruby.rack.RackInitializationException: An error has occurred, all later migrations canceled:

ActiveRecord::ActiveRecordError: ERROR: value too long for type character varying(9)
: INSERT INTO "metrics" ("name", "description", "direction", "domain", "short_name", "qualitative", "val_type", "user_managed", "enabled", "origin") VALUES('c
ode_coverage_line_hits_data', 'Code coverage line hits data', 0, 'Tests', 'Code coverage data', 'f', 'DATA', 'f', 't', NULL)
from /opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-jdbc-adapter-0.9/lib/active_record/connection_adapters/jdbc_adapter.rb:581:in `exe
cute'
from /opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-jdbc-adapter-0.9/lib/jdbc_adapter/jdbc_postgre.rb:167:in `insert'
from /opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/base.rb:2733:in `create'
from /opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/callbacks.rb:237:in `create_with_callbacks'
from /opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/timestamp.rb:29:in `create_with_timestamps'
from /opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/base.rb:2699:in `create_or_update'
from /opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/callbacks.rb:222:in `create_or_update_with_callbacks'
from /opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/base.rb:2383:in `save'
... 32 levels...
from file:/opt/sonar-1.11.1/war/sonar-web/WEB-INF/lib/jruby-rack-0.9.4.jar!/rack/builder.rb:29:in `instance_eval'
from file:/opt/sonar-1.11.1/war/sonar-web/WEB-INF/lib/jruby-rack-0.9.4.jar!/rack/builder.rb:29:in `initialize'
from <script>:2

at org.jruby.rack.DefaultRackApplicationFactory$4.init(DefaultRackApplicationFactory.java:153) [jruby-rack-0.9.4.jar:na]
at org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:50) [jruby-rack-0.9.4.jar:na]
at org.jruby.rack.SharedRackApplicationFactory.init(SharedRackApplicationFactory.java:26) [jruby-rack-0.9.4.jar:na]
... 19 common frames omitted
Caused by: org.jruby.exceptions.RaiseException: An error has occurred, all later migrations canceled:
ActiveRecord::ActiveRecordError: ERROR: value too long for type character varying(9)
: INSERT INTO "metrics" ("name", "description", "direction", "domain", "short_name", "qualitative", "val_type", "user_managed", "enabled", "origin") VALUES('c
ode_coverage_line_hits_data', 'Code coverage line hits data', 0, 'Tests', 'Code coverage data', 'f', 'DATA', 'f', 't', NULL)
at Kernel.raise(/opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/migration.rb:485) [na:na]
at ActiveRecord::Migrator.migrate(/opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/migration.rb:466) [na:na]
at Array.each(/opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/migration.rb:466) [na:na]
at ActiveRecord::Migrator.migrate(/opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/migration.rb:394) [na:na]
at #<Class:01x17d56b>.up(/opt/sonar-1.11.1/war/sonar-web/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/migration.rb:377) [na:na]
at #<Class:01x17d56b>.migrate(/opt/sonar-1.11.1/war/sonar-web/WEB-INF/config/../lib/database_version.rb:63) [na:na]
at #<Class:01x640b25>.setup(/opt/sonar-1.11.1/war/sonar-web/WEB-INF/config/../lib/database_version.rb:70) [na:na]
at #<Class:01x640b25>.automatic_setup(/opt/sonar-1.11.1/war/sonar-web/WEB-INF/config/environment.rb:195) [na:na]
at (unknown).(unknown)(/opt/sonar-1.11.1/war/sonar-web/WEB-INF/config/environment.rb:26) [na:na]
at Kernel.load(file:/opt/sonar-1.11.1/war/sonar-web/WEB-INF/lib/jruby-rack-0.9.4.jar!/jruby/rack/rails.rb:26) [na:na]
at JRuby::Rack::RailsServletHelper.load_environment(file:/opt/sonar-1.11.1/war/sonar-web/WEB-INF/lib/jruby-rack-0.9.4.jar!/jruby/rack/rails.rb:151) [n
a:na]
at #<Class:01xdc64a2>.new(<script>:2) [na:na]
at (unknown).(unknown)(file:/opt/sonar-1.11.1/war/sonar-web/WEB-INF/lib/jruby-rack-0.9.4.jar!/rack/builder.rb:29) [na:na]
at Kernel.instance_eval(file:/opt/sonar-1.11.1/war/sonar-web/WEB-INF/lib/jruby-rack-0.9.4.jar!/rack/builder.rb:29) [na:na]
at Kernel.instance_eval(file:/opt/sonar-1.11.1/war/sonar-web/WEB-INF/lib/jruby-rack-0.9.4.jar!/rack/builder.rb:29) [na:na]
at Rack::Builder.initialize(<script>:2) [na:na]
at (unknown).(unknown)(:1) [na:na]
2009.11.19 11:04:19 INFO org.sonar.CONSOLE Sonar started: http://0.0.0.0:9000/

"Visiting sonar page at port 9000 greets with the following error page:
We're sorry, but something went wrong.
Please try back in a few minutes and contact support if the problem persists.
go back projects"

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Simon Brandhof added a comment - 19/Nov/09 4:28 AM

Hi Aleksander, which version of PostgreSQL do you use ?

Show
Simon Brandhof added a comment - 19/Nov/09 4:28 AM Hi Aleksander, which version of PostgreSQL do you use ?
Hide
Permalink
Aleksander Adamowski added a comment - 19/Nov/09 4:39 AM

PostgreSQL 8.2.10.

Show
Aleksander Adamowski added a comment - 19/Nov/09 4:39 AM PostgreSQL 8.2.10.
Hide
Permalink
Simon Brandhof added a comment - 19/Nov/09 4:56 AM

Unfortunately all tests have been done with version 8.4.

Can you search the differences between your table METRICS and this one please ?

Show
Simon Brandhof added a comment - 19/Nov/09 4:56 AM Unfortunately all tests have been done with version 8.4. Can you search the differences between your table METRICS and this one please ?
Hide
Permalink
Aleksander Adamowski added a comment - 19/Nov/09 7:48 AM

Here's the table representation from the psql client. The only difference seems to be that the column "description" is only 9 chars:

sonar=# \d metrics
Table "public.metrics"
Column | Type | Modifiers
---------------------------------------------------------------------------------------
id | integer | not null default nextval('metrics_id_seq'::regclass)
name | character varying(64) | not null
description | character varying(9) |
direction | integer | not null default 0
domain | character varying(64) |
short_name | character varying(64) |
qualitative | boolean | not null default false
val_type | character varying(8) |
user_managed | boolean | default false
enabled | boolean | default true
origin | character varying(3) |
Indexes:
"metrics_pkey" PRIMARY KEY, btree (id)
"metrics_unique_name" UNIQUE, btree (name)

Show
Aleksander Adamowski added a comment - 19/Nov/09 7:48 AM Here's the table representation from the psql client. The only difference seems to be that the column "description" is only 9 chars: sonar=# \d metrics Table "public.metrics" Column | Type | Modifiers --------------------------------------------------------------------------------------- id | integer | not null default nextval('metrics_id_seq'::regclass) name | character varying(64) | not null description | character varying(9) | direction | integer | not null default 0 domain | character varying(64) | short_name | character varying(64) | qualitative | boolean | not null default false val_type | character varying(8) | user_managed | boolean | default false enabled | boolean | default true origin | character varying(3) | Indexes: "metrics_pkey" PRIMARY KEY, btree (id) "metrics_unique_name" UNIQUE, btree (name)
Hide
Permalink
Simon Brandhof added a comment - 19/Nov/09 8:46 AM

OK, the column METRICS.DESCRIPTION is badly created with Postgresql 8.2. Size should be 255 instead of 9.
It's fixed in sonar 1.12.

The workaround for you is to drop the schema, edit the file war/sonar-web/WEB-INF/db/migrate/001_initial_schema.rb and replace the line 45 by :

t.column :description, :string, :null => true, :limit => 255
Show
Simon Brandhof added a comment - 19/Nov/09 8:46 AM OK, the column METRICS.DESCRIPTION is badly created with Postgresql 8.2. Size should be 255 instead of 9. It's fixed in sonar 1.12. The workaround for you is to drop the schema, edit the file war/sonar-web/WEB-INF/db/migrate/001_initial_schema.rb and replace the line 45 by :
t.column :description, :string, :null => true, :limit => 255

People

  • Assignee:
    Simon Brandhof
    Reporter:
    Aleksander Adamowski
Vote (0)
Watch (0)

Dates

  • Created:
    19/Nov/09 4:22 AM
    Updated:
    24/Nov/09 2:40 AM
    Resolved:
    19/Nov/09 10:41 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.