Beersample-java2 app fails to run

I cloned the beersample-java2 app from GitHub, but I can’t get it to run. It seems to build OK. Hoping someone else has encountered this problem already.

NetBeans 8.0.2
Java 1.8.0_25
OS X 10.10 (Yosemite).


First exception:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'viewResolver' defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$ThymeleafViewResolverConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.thymeleaf.spring4.SpringTemplateEngine org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$ThymeleafViewResolverConfiguration.templateEngine; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$ThymeleafDefaultConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private final java.util.Collection org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$ThymeleafDefaultConfiguration.templateResolvers; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$DefaultTemplateResolverConfiguration': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot find template location: class path resource [templates/] (please add some templates or check your Thymeleaf configuration) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)

By the way, on the Couchbase page below it states “The framework for the tutorial can be downloaded from here.”

Problem is here points to http://www.example.org/.

http://docs.couchbase.com/developer/java-2.0/tutorial.html

@shusseina sorry about that. @simonbasle is getting the beersample2 up to speed at this very moment and we’ll rework the tutorial once it’s finished.

@simonbasle can you provide quick instructions on how to run it properly?

beersample-java2 and tutorial need a makeover. The problem arises because the templates directory is not found in the classpath. Thing is, this is a Maven project without a maven structure, so it kind of make sense :frowning:.
I will push a refactor of this branch to have a correct Maven structure, hopefully importing it to the IDE and running the Application will correctly work after that (I know it does in IntelliJ).

Unfortunately I know nothing about Maven which probably doesn’t help.

I am really just wanting to know how to build a program in Java which works with Couchbase, I’m not looking to build a web application, just a simple program (akin to a batch program) which will massage data in a Couchbase server. Maybe it’s worth me trying to create something from scratch? It’s not the coding that I find a challenge, it’s the project setup/configuration.

@shusseina wich IDE are you using and what simple thing are you trying to accomplish? Maybe we can get you a quick step-by-step guide.

latest version on master should now work better out-of-the-box. if you previously managed to get the error, restarting from scratch with same steps should now work I think (or maybe refreshing the project in NetBeans after a git pull)

Excellent, thanks @simonbasle I will try it out tomorrow. Thanks for your help.

Update: The new version of the app built and ran flawlessly! :+1:

If you want, also have a look at the work in progress branch rxexample, at this point there’s no GUI but if you’re interested in RxJava this is more relevant (eg look at beers and breweries controllers).

I want to write a Java program that will grab a set of docs from Couchbase, calculate some stats from those docs and update other docs accordingly. I intend to use views/MapReduce to calculate the stats. The Java program will just coordinate things and update the docs.

The updated docs in the Couchbase database/server will be used by an iOS app I am developing.

The Java program will act like a batch job and run at regular intervals; I will run it from the command line. Will see how I go tomorrow. Thanks for your help @daschl

FYI, I’m using NetBeans 8 on OS X 10.10 (Yosemite).