If you want to get up and running really quickly, here is how to get it done using Jetty. Note that this short guide assumes you're running MacOS or Linux. If you're running windows, you need to modify the paths accordingly. Also, make sure to have at least maven installed.
Download Couchbase Server 2.0 and install it. Make sure to install the beer-sample dataset when you run the wizard, because the tutorial application will work with it.
Add the following views (and design documents) to the
beer-sample bucket (and publish them to
production afterwards):
Design document name is beer and view name
is by_name.
function (doc, meta) { if(doc.type && doc.type == "beer") { emit(doc.name, null); } }
Design document name is brewery and view
name is by_name.
function (doc, meta) { if(doc.type && doc.type == "brewery") { emit(doc.name, null); } }
Clone the repository from
GitHub
and cd into the directory:
$ git clone git://github.com/couchbaselabs/beersample-java.git Cloning into 'beersample-java'... remote: Counting objects: 153, done. remote: Compressing objects: 100% (92/92), done. remote: Total 153 (delta 51), reused 124 (delta 22) Receiving objects: 100% (153/153), 81.97 KiB | 120 KiB/s, done. Resolving deltas: 100% (51/51), done. $ cd beersample-java
Finally, use maven to run the application inside the Jetty container:
$ mvn jetty:run .... snip .... Dec 17, 2012 1:50:16 PM com.couchbase.beersample.ConnectionManager contextInitialized INFO: Connecting to Couchbase Cluster 2012-12-17 13:50:16.621 INFO com.couchbase.client.CouchbaseConnection: Added {QA sa=/127.0.0.1:11210, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue 2012-12-17 13:50:16.624 INFO com.couchbase.client.CouchbaseConnection: Connection state changed for sun.nio.ch.SelectionKeyImpl@2e2a730e 2012-12-17 13:50:16.635 WARN net.spy.memcached.auth.AuthThreadMonitor: Incomplete authentication interrupted for node {QA sa=localhost/127.0.0.1:11210, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=8} 2012-12-17 13:50:16.662 WARN net.spy.memcached.auth.AuthThread: Authentication failed to localhost/127.0.0.1:11210 2012-12-17 13:50:16.662 INFO net.spy.memcached.protocol.binary.BinaryMemcachedNodeImpl: Removing cancelled operation: SASL auth operation 2012-12-17 13:50:16.664 INFO net.spy.memcached.auth.AuthThread: Authenticated to localhost/127.0.0.1:11210 2012-12-17 13:50:16.666 INFO com.couchbase.client.ViewConnection: Added localhost to connect queue 2012-12-17 13:50:16.667 INFO com.couchbase.client.CouchbaseClient: viewmode property isn't defined. Setting viewmode to production mode 2012-12-17 13:50:16.866:INFO::Started SelectChannelConnector@0.0.0.0:8080 [INFO] Started Jetty Server
Now, navigate to http://localhost:8080/welcome and enjoy the application.