Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Glimmer » ContactManager loading contacts from a database
ContactManager loading contacts from a database [message #565930] Wed, 03 February 2010 17:35
Andy Maleh is currently offline Andy MalehFriend
Messages: 28
Registered: July 2009
Junior Member
hadenp said:

Glimmer looks fantastic! As a first try I'm modifying Contact Manager, to load @contacts[] from a database(activerecord-jdbcsqlite3-adapter). When I run it (Jruby -w) I get...
"Processing method: text and args: ["Contact Manager"]
java.lang.ClassNotFoundException: org.eclipse.swt.Table"
Is this a name conflict with another Table and if so how can I resolve it?
Thanks!
Haden

-----

Andy said:

No, this is pretty much the SWT table used in the Contact Manager application. This error happens if you do not have SWT installed correctly. Refer to the README file for instructions on how to install SWT if you have not already.

Did you run the program successfully before modifying Contact Manager to load a database? Make sure it runs fine in its original form first.

If you encounter an error again, please post a stack trace (or the top 10 entries at least)?

-----
hadenp said:

Here's the modified Contact_Repository (excerpt) and below it the error I get(w/o -w flag). Hope I'm not bothering you with something obvious that I'm doing wrong...


require 'rubygems'
require 'active_record'
gem 'activerecord-jdbcsqlite3-adapter'
require 'yaml'

require File.dirname(__FILE__) + "/contact"

class ContactRepository

def initialize
@connections = YAML.load_file("database.yml")
ActiveRecord::Base.establish_connection(@connections["development "])
stmt = "select first_name, last_name, email from contacts"
@val = ActiveRecord::Base.connection.select_all(stmt)
@contacts = []

@val.each do |c|
#puts "@val= #{c["first_name"]} #{c["last_name"]} #{c["email"]}"
@map = {:first_name => c["first_name"], :last_name => c["last_name"], :email => c["email"] }
#puts "@map= #{@map}"
@contacts << Contact.new( @map )
end
# @contacts = [
# Contact.new(:first_name => "Anne", :last_name => "Sweeney", :email => "mailto:anne@sweeny.com"),
# Contact.new(:first_name => "Beatrice", :last_name => "Jung", :email => "mailto:beatrice@jung.com"),
# Contact.new(:first_name => "Frank", :last_name => "Deelio", :email => "mailto:frank@deelio.com"),
# Contact.new(:first_name => "franky", :last_name => "miller", :email => "mailto:frank@miller.com"),
# ]
end
----------------------------
Here's the error...

C:\gui\samples\contactmanager>jruby contact_manager.rb
c:/jruby/lib/ruby/gems/1.8/gems/facets-2.8.1/lib/core/facets /kernel/here.rb:9 warning: `binding' should not be aliased

Loading command handlers for DSL: swt
@val= Fred Apple mailto:fredapple@ma.com
@map= mailto:first_nameFredlast_nameAppleemailfredapple@ma.com
@val= Joe Napolitano mailto:joeynap@yahoo.com
@map= mailto:first_nameJoelast_nameNapolitanoemailjoeynap@yahoo.com
@val= Alice Laring mailto:alice.laring@gmail.com
@map= mailto:first_nameAlicelast_nameLaringemailalice.laring@gmail.com

Processing method: shell and args: []

ShellCommandHandler will handle command: shell with arguments []

Processing method: text and args: ["Contact Manager"]
c:/jruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/acti ve_support/core_ext/string/output_safety.rb:25:in `add_with_
safety': can't convert nil into String (TypeError)
from ./../../src/command_handlers/models/r_widget.rb:55:in `respond_to?'
from ./../../src/command_handlers/widget_method_command_handler.r b:19:in `can_handle?'
from ./../../src/command_handler_chain_link.rb:20:in `handle'
from ./../../src/command_handler_chain_link.rb:24:in `handle'
from ./../../src/glimmer.rb:29:in `method_missing'
from ./../../src/glimmer.rb:41:in `method_missing'
from contact_manager.rb:29
from ./../../src/command_handlers/models/r_widget.rb:144:in `call'
from ./../../src/command_handlers/models/r_widget.rb:144:in `process_block'
from ./../../src/glimmer.rb:36:in `add_contents'
from ./../../src/glimmer.rb:30:in `method_missing'
from ./../../src/glimmer.rb:41:in `method_missing'
from contact_manager.rb:28
Previous Topic:ContactManager loading contacts from a database
Goto Forum:
  


Current Time: Mon Dec 22 15:48:55 GMT 2014

Powered by FUDForum. Page generated in 0.01538 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software