Closed spring-projects-issues closed 10 years ago
Michael Nitschinger commented
This is the CouchbaseClient telling you that you do not have a bucket with that name and/or password!
Can you please post the info of localhost:8091/pools/default/buckets? Also make sure the bucket is there (case sensitive) and also M2 is already shipped.
Finally it's called Couchbase and not CouchDB just making sure you connect to the right database ;)
Pavel Bekkerman commented
Hi Michael.
Before replying to your comment, I cared to upgraded to 1.0.0.M2. I, than, deleted and recreated the buckets... and got the same failure. Only now the stack trace is more informative.
Basically, it says: once you have more than one template (or repository), I have more than one couchbase client - and I don't know which maps to what!
Probably, there's a bug in how
1) I don't know if it helps, but: in Eclipse, STS, CTRL+hover on couchbase-template-ref="XXX" fails, while on db-ref="YYY" it works OK.
2) switching to spring-data-mongo with the same exact configuration works like a charm. The only difference with the Mongo is that I had to place
Any idea now?
The trace: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '....................RepositoryTest': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.couchbase.client.CouchbaseClient ....................RepositoryTest.deviceCurrentLocationCouchbaseClient; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.couchbase.client.CouchbaseClient] is defined: expected single matching bean but found 2: [devicecurrentlocation, personactivity] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:374) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:110) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:290) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.couchbase.client.CouchbaseClient ....................RepositoryTest.deviceCurrentLocationCouchbaseClient; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.couchbase.client.CouchbaseClient] is defined: expected single matching bean but found 2: [devicecurrentlocation, personactivity] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:513) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:92) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:284) ... 27 more Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.couchbase.client.CouchbaseClient] is defined: expected single matching bean but found 2: [devicecurrentlocation, personactivity] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:823) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:730) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:485) ... 29 more
Michael Nitschinger commented
Jup, looks like a bug from here. I think you're the first one to try this, the xml config part isnt used quite as often as the Java config I think.
I'll try to fix it for the RC1
Pavel Bekkerman commented
Cool, thanks
Michael Nitschinger commented
Hi Pavel,
it works for me.. I noticed when adding a test for this ticket, that you've used db-ref instead of client-ref.. here is a working example:
\<?xml version="1.0" encoding="UTF-8"?>
\<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:couchbase="http://www.springframework.org/schema/data/couchbase" xmlns:data-repository="http://www.springframework.org/schema/data/repository" xsi:schemaLocation="http://www.springframework.org/schema/data/couchbase http://www.springframework.org/schema/data/couchbase/spring-couchbase.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/data/repository http://www.springframework.org/schema/data/repository/spring-repository.xsd">
<couchbase:couchbase id="cb-first" bucket="default" password="" host="localhost" />
<couchbase:couchbase id="cb-second" bucket="sn" password="sn" host="localhost" />
<couchbase:template id="cb-template-first" client-ref="cb-first" />
<couchbase:template id="cb-template-second" client-ref="cb-second" />
<couchbase:repositories base-package="com.example" couchbase-template-ref="cb-template-first">
<data-repository:include-filter type="regex" expression=".*ARepository" />
</couchbase:repositories>
<couchbase:repositories base-package="com.example" couchbase-template-ref="cb-template-second">
<data-repository:include-filter type="regex" expression=".*BRepository" />
</couchbase:repositories>
\
Michael Nitschinger commented
Please reopen if my provided code doesn't work for you (or is invalid otherwise), thanks!
Pavel Bekkerman opened DATACOUCH-47 and commented
I have some thin like: