Cannot create inner bean '(inner bean)' of type [org.ektorp.spring.HttpClientFactoryBean]

3,473 views
Skip to first unread message

sulman...@gmail.com

unread,
Jun 27, 2013, 2:45:13 AM6/27/13
to ektorp-...@googlegroups.com

Hello,

I have following in my app-context.xml.

<beans xmlns="http://www.springframework.org/schema/beans"

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  xmlns:context="http://www.springframework.org/schema/context"

  xmlns:couchdb="http://www.ektorp.org/schema/couchdb"

  xmlns:util="http://www.springframework.org/schema/util"

  xsi:schemaLocation="

        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd

        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd

        http://www.ektorp.org/schema/couchdb http://www.ektorp.org/schema/couchdb/couchdb.xsd

        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">

<util:properties id="props" location="classpath:/couchdb.properties" />

<couchdb:instance id="myDb" properties="props"/>

<couchdb:database name="mydb" instance-ref="myDb"/>

and then in my AppTest.java i have following:


@Qualifier
("myDb")CouchDbConnector myDb;

@Test
public void testGetAllAsView() throws Exception{

List<String> docIds = myDb.getAllDocIds();

}

My test fails with following output:

Failed tests:   init(persistence.couchdb.AppTest): Error creating bean with name 'myDb': Cannot create inner bean '(inner bean)' of type [org.ektorp.spring.HttpClientFactoryBean] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Invocation of init method failed; nested exception is java.net.MalformedURLException: no protocol: 

  init(persistence.couchdb.AppTest): Error creating bean with name 'myDb': Cannot create inner bean '(inner bean)' of type [org.ektorp.spring.HttpClientFactoryBean] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Invocation of init method failed; nested exception is java.net.MalformedURLException: no protocol: 

Any help is appreciated please... 

Thanks.

Henrik Lundgren

unread,
Jun 28, 2013, 4:20:03 AM6/28/13
to ektorp-...@googlegroups.com
You must specify the database url:

//Henrik

--
You received this message because you are subscribed to the Google Groups "ektorp-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ektorp-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

sulman sarwar

unread,
Jul 2, 2013, 4:01:04 AM7/2/13
to ektorp-...@googlegroups.com
Ok. Still the same..

here's my app-context.xml:

<?xml version="1.0" encoding="UTF-8"?>

  <context:property-placeholder

    location="file://${aurin.dir}/user-projects-combined.properties" />

<util:properties id="couchdbProperties" location="file:///${aurin.dir}/couchdb.properties" />     

  <couchdb:instance id="myDb" properties="couchdbProperties"/>

  <couchdb:database name="mydb" instance-ref="myaurinDb" url="${persistent.couchdb.server.url}"/>

</beans>

Here's the test code:


@Qualifier
("myDb")CouchDbConnector myDb;

@Test

public void testFetch(){

List<String> docIds = myDb.getAllDocIds();
}


Failed tests:   init(persistence.couchdb.AppTest): Error creating bean with name 'myDb': Cannot create inner bean '(inner bean)' of type [org.ektorp.spring.HttpClientFactoryBean] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Invocation of init method failed; nested exception is java.net.MalformedURLException: no protocol: 
  init(persistence.couchdb.AppTest): Error creating bean with name 'myDb': Cannot create inner bean '(inner bean)' of type [org.ektorp.spring.HttpClientFactoryBean] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Invocation of init method failed; nested exception is java.net.MalformedURLException: no protocol: 




Henrik Lundgren

unread,
Jul 2, 2013, 4:05:28 AM7/2/13
to ektorp-...@googlegroups.com
I'm pretty sure that the db url is wrong or is missing
what does your database url look like?

sulman sarwar

unread,
Jul 2, 2013, 4:12:03 AM7/2/13
to ektorp-...@googlegroups.com

http://db2.aurin.org.au:5984

thats how it looks like...and here's the log entry before the failed tests prompt:

Running TestSuite
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNGMapConfigurator@43ece626
Jul 02, 2013 5:55:06 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@4e04b048: startup date [Tue Jul 02 17:55:06 EST 2013]; root of context hierarchy
Jul 02, 2013 5:55:06 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [test-context.xml]
Jul 02, 2013 5:55:06 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from URL [file:/Users/muhammadsarwar/Documents/workspace/user-projects/target/classes/user-projects-context.xml]
Jul 02, 2013 5:55:07 PM org.springframework.core.io.support.PropertiesLoaderSupport loadProperties
INFO: Loading properties file from URL [file:////Users/muhammadsarwar/aurin/user-projects-combined.properties]
Jul 02, 2013 5:55:07 PM org.springframework.core.io.support.PropertiesLoaderSupport loadProperties
INFO: Loading properties file from URL [file:/Users/muhammadsarwar/aurin/user-projects-combined.properties]
Jul 02, 2013 5:55:07 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@2e371ad5: defining beans [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0,couchConnection,app,couchdbProperties,myaurinDb,myaurin,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
Jul 02, 2013 5:55:07 PM org.springframework.core.io.support.PropertiesLoaderSupport loadProperties
INFO: Loading properties file from URL [file:////Users/muhammadsarwar/aurin/couchdb.properties]
[main] INFO org.ektorp.spring.HttpClientFactoryBean - Starting couchDb connector on http://db2.aurin.org.au:5984...
Jul 02, 2013 5:55:07 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@2e371ad5: defining beans [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0,couchConnection,app,couchdbProperties,myaurinDb,myaurin,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
Tests run: 3, Failures: 2, Errors: 0, Skipped: 1, Time elapsed: 4.803 sec <<< FAILURE!

Henrik Lundgren

unread,
Jul 2, 2013, 4:15:37 AM7/2/13
to ektorp-...@googlegroups.com
I think you have a problem with the property lookup in spring, hardcode the url in the app context and make that work first.
Reply all
Reply to author
Forward
0 new messages