Impala Creating A CalculationService in New Module

7 views
Skip to first unread message

Peter Pilgrim

unread,
May 27, 2010, 5:09:59 AM5/27/10
to JAVAWUG
Hi Phil

I am playing with the sample Impala application.

I created a second module called `module2'.
It has a new context called `module2-context.xml' with a
`CalculationServiceImpl.java' (concrete)
I modified the `main' module to have a new interface `CalculationService.java'
I then created a new web controller in the `web' module called
`CalculationController.java'

I am getting an exception running the StartServer. Somehow the
`CalculationController' cannot find the `calculationService' Spring
Bean.

In module2-context I have exported this bean.


<?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:service="http://www.impalaframework.org/schema/service"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.impalaframework.org/schema/service
http://impala.googlecode.com/svn/schema/service-registry.xsd">

<service:export beanName="calculationService"/>
<bean id="calculationService"
class="com.application.module2.CalculationServiceImpl" />
</beans>

Here is the error log


INFO : log - Logging to
org.slf4j.impl.Log4jLoggerAdapter(org.mortbay.log) via
org.mortbay.log.Slf4jLog
INFO : log - jetty-6.1.21
INFO : /host - Initializing Spring root WebApplicationContext
INFO : BaseLocationsRetriever -
org.impalaframework.bootstrap.ConfigurationSettings@49d67c
Context locations: [META-INF/impala-bootstrap.xml,
META-INF/impala-web-bootstrap.xml,
META-INF/impala-graph-bootstrap.xml,
META-INF/impala-jmx-bootstrap.xml,
META-INF/impala-web-listener-bootstrap.xml,
META-INF/impala-web-path-mapper-bootstrap.xml]
Property settings:
all.locations: [null]
auto.reload.check.delay: 10 (default)
auto.reload.check.interval: 2 (default)
auto.reload.extension.excludes: (default)
auto.reload.extension.includes: (default)
auto.reload.modules: true
auto.reload.monitoring.type: default (default)
classloader.type: graph (default)
embedded.mode: true
enable.web.jmx.operations: false (default)
expose.jmx.operations: true (default)
expose.mx4j.adaptor: false (default)
external.root.module.name: (default)
extra.locations: [null]
graph.bean.visibility.type: graphOrdered (default)
jmx.locate.existing.server: false (default)
load.time.weaving.enabled: false (default)
module.class.dir: bin,target/classes (default)
module.prefix.mapping.enabled: true
module.resource.dir: resources,target/classes (default)
parent.classloader.first: false (default)
partitioned.servlet.context: true
preserve.session.on.reload.failure: true (default)
proxy.allow.no.service: false (default)
proxy.missing.service.retry.count: 0 (default)
proxy.missing.service.retry.interval: 1000 (default)
proxy.set.context.classloader: true (default)
session.module.protection: true
touch.file: /WEB-INF/modules/touch.txt (default)
use.touch.file: false (default)
web.module.prefix: (default)
workspace.root: ../ (default)
--------
INFO : BaseLocationsRetriever - Property source:
org.impalaframework.config.PrefixedCompositePropertySource@1a42792 -
propertySources:
[org.impalaframework.web.config.ContextPathAwareSystemPropertySource@2200d5,
org.impalaframework.config.SystemPropertiesPropertySource@64ab4d,
org.impalaframework.config.StaticPropertiesPropertySource@12a55aa,
org.impalaframework.web.config.ServletContextPropertySource@5e13ad]
INFO : BaseImpalaContextLoader - Impala context locations:
[META-INF/impala-bootstrap.xml, META-INF/impala-web-bootstrap.xml,
META-INF/impala-graph-bootstrap.xml,
META-INF/impala-jmx-bootstrap.xml,
META-INF/impala-web-listener-bootstrap.xml,
META-INF/impala-web-path-mapper-bootstrap.xml]
INFO : BaseImpalaContextLoader - Loading bootstrap context from
locations [META-INF/impala-bootstrap.xml,
META-INF/impala-web-bootstrap.xml,
META-INF/impala-graph-bootstrap.xml,
META-INF/impala-jmx-bootstrap.xml,
META-INF/impala-web-listener-bootstrap.xml,
META-INF/impala-web-path-mapper-bootstrap.xml]
INFO : ScheduledModuleChangeMonitor - Starting
org.impalaframework.web.module.listener.WebScheduledModuleChangeMonitorBean
with fixed delay of 10 and interval of 2
INFO : LoadTransitionProcessor - Loading definition main
INFO : DefaultModuleRuntimeManager - Loading definition main
INFO : ScheduledModuleChangeMonitor - Monitoring for changes in module
main: [file [C:\Users\Peter\Documents\workspace-sts\impala-simple\host\..\main\bin],
file [C:\Users\Peter\Documents\workspace-sts\impala-simple\host\..\main\resources]]
INFO : LoadTransitionProcessor - Loading definition module1
INFO : DefaultModuleRuntimeManager - Loading definition module1
INFO : ScheduledModuleChangeMonitor - Monitoring for changes in module
module1: [file [C:\Users\Peter\Documents\workspace-sts\impala-simple\host\..\module1\bin],
file [C:\Users\Peter\Documents\workspace-sts\impala-simple\host\..\module1\resources]]
INFO : LoadTransitionProcessor - Loading definition module2
INFO : DefaultModuleRuntimeManager - Loading definition module2
INFO : ScheduledModuleChangeMonitor - Monitoring for changes in module
module2: [file [C:\Users\Peter\Documents\workspace-sts\impala-simple\host\..\module2\bin],
file [C:\Users\Peter\Documents\workspace-sts\impala-simple\host\..\module2\resources]]
INFO : LoadTransitionProcessor - Loading definition web
INFO : DefaultModuleRuntimeManager - Loading definition web
INFO : /host - Initializing Spring FrameworkServlet 'dispatcher'
INFO : InternalModuleServlet - FrameworkServlet 'dispatcher':
initialization started
ERROR : InternalModuleServlet - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping':
Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'com.application.web.CalculationController#0'
defined in class path resource [web-context.xml]: Cannot resolve
reference to bean 'calculationService' while setting bean property
'calculationService'; nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
bean named 'calculationService' is defined
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:255)
at org.springframework.web.servlet.DispatcherServlet.createDefaultStrategy(DispatcherServlet.java:770)
at org.springframework.web.servlet.DispatcherServlet.getDefaultStrategies(DispatcherServlet.java:737)
at org.springframework.web.servlet.DispatcherServlet.initHandlerMappings(DispatcherServlet.java:518)
at org.springframework.web.servlet.DispatcherServlet.initStrategies(DispatcherServlet.java:410)
at org.springframework.web.servlet.DispatcherServlet.onRefresh(DispatcherServlet.java:398)
at org.impalaframework.web.spring.servlet.InternalModuleServlet.initWebApplicationContext(InternalModuleServlet.java:64)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:282)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)
==////==
at StartServer.main(StartServer.java:21)
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name
'com.application.web.CalculationController#0' defined in class path
resource [web-context.xml]: Cannot resolve reference to bean
'calculationService' while setting bean property 'calculationService';
nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
bean named 'calculationService' is defined
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
==////===
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
... 75 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:
No bean named 'calculationService' is defined
at org.impalaframework.spring.module.graph.GraphDelegatingApplicationContext.getBean(GraphDelegatingApplicationContext.java:116)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:238)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
... 99 more
==/////==

INFO : log - Started SelectChann...@0.0.0.0:8080


--
Peter A. Pilgrim
Java Champion /
JavaFX / Java EE Software Development / Design / ScrumMaster

**** See you at Martin Odersky's London Scala Workshop 2010 ****

:: http://audio.fm/profile/peter_pilgrim ::
:: http://jroller.com/peter_pilgrim ::
:: http://jroller.com/javawug ::
:: https://java-champions.dev.java.net/ ::
:: http://www.linkedin.com/in/peterpilgrim2000 ::
:: http://www.facebook.com/profile.php?id=570597454 ::
:: http://twitter.com/peter_pilgrim ::
:: http://twitter.com/javawugcom ::
:: A Sun Certified Enterprise Architect for Java EE 5 platform ::

Phil Zoio

unread,
May 27, 2010, 5:56:24 AM5/27/10
to jav...@googlegroups.com
Hi Peter,

Could I suggest you post these questions to the Impala user's mailing
list - this is probably a bit too much detail for the JavaWUG list. See
http://groups.google.com/group/impala_group/

Regarding this particular question, it looks like you are missing the
corresponding import for the exported bean:

e.g. <service:import id = "calculationService" proxyTypes =
"...CalculationService"/>

which you can add either in the web module's Spring context file (or if
you like, you can add it to the context file of any parent e.g. main).

Cheers,
Phil

Peter Pilgrim

unread,
May 27, 2010, 11:22:35 AM5/27/10
to impala...@googlegroups.com, JAVAWUG
Thanks Phil

Sent it to the wrong email address earlier on.

If U have specific Impala questions then post over there. If it just
general and relevant to the user group keep on the JAVAWUG.

On 27 May 2010 11:48, Peter Pilgrim <peter....@gmail.com> wrote:
> Thanks Phil


>
>
> On 27 May 2010 10:56, Phil Zoio <phil...@realsolve.co.uk> wrote:
>> Hi Peter,
>>
>> Could I suggest you post these questions to the Impala user's mailing
>> list - this is probably a bit too much detail for the JavaWUG list. See
>> http://groups.google.com/group/impala_group/
>>
>> Regarding this particular question, it looks like you are missing the
>> corresponding import for the exported bean:
>>
>> e.g. <service:import id = "calculationService" proxyTypes =
>> "...CalculationService"/>
>
>

> I added this configuration setting to the web-context.xml file. Thanks
> it worked.
>
> However now when I go to http://localhost:8080/host/web/message.htm I get a 503
> Problem accessing /host/web/message.htm. Reason:
>
>    SERVICE_UNAVAILABLE.
>
> I seem to have broken the only Spring MVC message controller.

>> --
>> You received this message because you are subscribed to the Google Groups "JAVAWUG" group.
>> To post to this group, send email to jav...@googlegroups.com.
>> To unsubscribe from this group, send email to javawug+u...@googlegroups.com.
>> For more options, visit this group at http://groups.google.com/group/javawug?hl=en.

Reply all
Reply to author
Forward
0 new messages