Pointcut is not well-formed: expecting ')' at character position 12 - spring-aop

public interface Performance {
public void perform();
}
#Component
public class PerformanceImpl implements Performance {
#Override
public void perform() {
// TODO Auto-generated method stub
System.out.println(this.getClass()+"演出...");
}
}
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
//1、创建Spring的IOC的容器
ApplicationContext ctx = new ClassPathXmlApplicationContext("springXml/concertConfig.xml");
Performance p = ctx.getBean(Performance.class);
p.perform();
}
}
#Component
#Aspect
public class Audience {
#Pointcut("exection(** concert.Performance.perform(..))")
public void performance(){}
#Before("performance()")
public void silenceCellPhones(){
System.out.println("Silence cell phones");
}
#Before("performance")
public void takeSeats(){
System.out.println("Taking seats");
}
#AfterReturning("performance()")
public void applause(){
System.out.println("CLAP CLAP CLAP!");
}
#AfterThrowing("performance()")
public void demandRefund(){
System.out.println("Demanding a refund");
}
}
I have attention to this problem, I cannot solve finally
The config xml:
<context:component-scan base-package="concert"></context:component-scan>
<aop:aspectj-autoproxy> </aop:aspectj-autoproxy>
the problem I meet fellow
六月 01, 2017 6:41:12 上午 org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext#49c2faae: startup date [Thu Jun 01 06:41:12 CST 2017]; root of context hierarchy
六月 01, 2017 6:41:13 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [springXml/concertConfig.xml]
六月 01, 2017 6:41:13 上午 org.springframework.context.support.ClassPathXmlApplicationContext refresh
警告: Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'performanceImpl' defined in file [D:\cmj\MyProject\eclipse\springWorkspace\spring2\bin\concert\PerformanceImpl.class]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting ')' at character position 12
exection(** concert.Performance.perform(..))
^^^^^^^
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:834)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at concert.Main.main(Main.java:11)
Caused by: java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting ')' at character position 12
exection(** concert.Performance.perform(..))
^^^^^^^
at org.aspectj.weaver.tools.PointcutParser.resolvePointcutExpression(PointcutParser.java:316)
at org.aspectj.weaver.reflect.InternalUseOnlyPointcutParser.resolvePointcutExpression(InternalUseOnlyPointcutParser.java:36)
at org.aspectj.weaver.reflect.Java15ReflectionBasedReferenceTypeDelegate.getDeclaredPointcuts(Java15ReflectionBasedReferenceTypeDelegate.java:299)
at org.aspectj.weaver.ReferenceType.getDeclaredPointcuts(ReferenceType.java:790)
at org.aspectj.weaver.ResolvedType$PointcutGetter.get(ResolvedType.java:237)
at org.aspectj.weaver.ResolvedType$PointcutGetter.get(ResolvedType.java:235)
at org.aspectj.weaver.Iterators$4$1.hasNext(Iterators.java:213)
at org.aspectj.weaver.Iterators$4.hasNext(Iterators.java:230)
at org.aspectj.weaver.ResolvedType.findPointcut(ResolvedType.java:722)
at org.aspectj.weaver.patterns.ReferencePointcut.resolveBindings(ReferencePointcut.java:149)
at org.aspectj.weaver.patterns.Pointcut.resolve(Pointcut.java:188)
at org.aspectj.weaver.tools.PointcutParser.resolvePointcutExpression(PointcutParser.java:313)
at org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:294)
at org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:207)
at org.springframework.aop.aspectj.AspectJExpressionPointcut.checkReadyToMatch(AspectJExpressionPointcut.java:193)
at org.springframework.aop.aspectj.AspectJExpressionPointcut.getClassFilter(AspectJExpressionPointcut.java:170)
at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:194)
at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:248)
at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:280)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findAdvisorsThatCanApply(AbstractAdvisorAutoProxyCreator.java:118)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:88)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:69)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:330)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:293)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:422)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1583)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
... 11 more
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'performanceImpl' defined in file [D:\cmj\MyProject\eclipse\springWorkspace\spring2\bin\concert\PerformanceImpl.class]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting ')' at character position 12
exection(** concert.Performance.perform(..))
^^^^^^^
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:834)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at concert.Main.main(Main.java:11)
Caused by: java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting ')' at character position 12
exection(** concert.Performance.perform(..))
^^^^^^^
at org.aspectj.weaver.tools.PointcutParser.resolvePointcutExpression(PointcutParser.java:316)
at org.aspectj.weaver.reflect.InternalUseOnlyPointcutParser.resolvePointcutExpression(InternalUseOnlyPointcutParser.java:36)
at org.aspectj.weaver.reflect.Java15ReflectionBasedReferenceTypeDelegate.getDeclaredPointcuts(Java15ReflectionBasedReferenceTypeDelegate.java:299)
at org.aspectj.weaver.ReferenceType.getDeclaredPointcuts(ReferenceType.java:790)
at org.aspectj.weaver.ResolvedType$PointcutGetter.get(ResolvedType.java:237)
at org.aspectj.weaver.ResolvedType$PointcutGetter.get(ResolvedType.java:235)
at org.aspectj.weaver.Iterators$4$1.hasNext(Iterators.java:213)
at org.aspectj.weaver.Iterators$4.hasNext(Iterators.java:230)
at org.aspectj.weaver.ResolvedType.findPointcut(ResolvedType.java:722)
at org.aspectj.weaver.patterns.ReferencePointcut.resolveBindings(ReferencePointcut.java:149)
at org.aspectj.weaver.patterns.Pointcut.resolve(Pointcut.java:188)
at org.aspectj.weaver.tools.PointcutParser.resolvePointcutExpression(PointcutParser.java:313)
at org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:294)
at org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:207)
at org.springframework.aop.aspectj.AspectJExpressionPointcut.checkReadyToMatch(AspectJExpressionPointcut.java:193)
at org.springframework.aop.aspectj.AspectJExpressionPointcut.getClassFilter(AspectJExpressionPointcut.java:170)
at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:194)
at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:248)
at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:280)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findAdvisorsThatCanApply(AbstractAdvisorAutoProxyCreator.java:118)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:88)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:69)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:330)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:293)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:422)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1583)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
... 11 more
I have see the problem similar, but it cannot solve my problem. Why such bug appear?

The pointcut name should not be exection but execution and ** should be *:
execution(* concert.Performance.perform(..))

Related

camel route test - the registry for: mock:result

Hi I have complex camel route and in between the route I am sending mesage to MQ using Bean.
.bean("{{tp.mqservice}}")
application.yaml
mqservice: bean:mqService
application-test.yaml
mqservice: mock:result
Below is my PortfolioRouteTest
#ActiveProfiles("test")
#RunWith(CamelSpringBootRunner.class)
#SpringBootTest(classes = MainApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
#MockEndpoints
public class PortfolioTncRouteTest {
#EndpointInject(value = "{{trade-publisher.portfolio-tnc.source-endpoint}}")
private ProducerTemplate producerTemplate;
#EndpointInject(value = "{{trade-publisher.mqservice}}")
private MockEndpoint mock;
}
Junit
#Test
public void portfolioTncRouteTest() throws InterruptedException {
data = ...
Mockito.when(service.search(Mockito.any(....class))).thenReturn(...);
producerTemplate.sendBody(data);
mock.expectedMessageCount(1);
mock.assertIsSatisfied(30000);
}
however when I run the test I am getting below error. Am I missing something?
Stacktrace
Caused by: org.apache.camel.NoSuchBeanException: No bean could be found in the registry for: mock:result
at org.apache.camel.component.bean.RegistryBean.getBean(RegistryBean.java:92)
at org.apache.camel.component.bean.RegistryBean.createCacheHolder(RegistryBean.java:67)
at org.apache.camel.reifier.BeanReifier.createProcessor(BeanReifier.java:57)
at org.apache.camel.reifier.ProcessorReifier.createProcessor(ProcessorReifier.java:485)
at org.apache.camel.reifier.ProcessorReifier.createOutputsProcessorImpl(ProcessorReifier.java:448)
at org.apache.camel.reifier.ProcessorReifier.createOutputsProcessor(ProcessorReifier.java:415)
at org.apache.camel.reifier.ProcessorReifier.createOutputsProcessor(ProcessorReifier.java:212)
at org.apache.camel.reifier.ExpressionReifier.createFilterProcessor(ExpressionReifier.java:39)
at org.apache.camel.reifier.WhenReifier.createProcessor(WhenReifier.java:32)
at org.apache.camel.reifier.WhenReifier.createProcessor(WhenReifier.java:24)
at org.apache.camel.reifier.ProcessorReifier.createProcessor(ProcessorReifier.java:485)
at org.apache.camel.reifier.ChoiceReifier.createProcessor(ChoiceReifier.java:54)
at org.apache.camel.reifier.ProcessorReifier.createProcessor(ProcessorReifier.java:485)
at org.apache.camel.reifier.ProcessorReifier.createOutputsProcessorImpl(ProcessorReifier.java:448)
at org.apache.camel.reifier.ProcessorReifier.createOutputsProcessor(ProcessorReifier.java:415)
at org.apache.camel.reifier.TryReifier.createProcessor(TryReifier.java:38)
at org.apache.camel.reifier.ProcessorReifier.createProcessor(ProcessorReifier.java:485)
at org.apache.camel.reifier.ProcessorReifier.createOutputsProcessorImpl(ProcessorReifier.java:448)
at org.apache.camel.reifier.ProcessorReifier.createOutputsProcessor(ProcessorReifier.java:415)
at org.apache.camel.reifier.ProcessorReifier.createOutputsProcessor(ProcessorReifier.java:212)
at org.apache.camel.reifier.ProcessorReifier.createChildProcessor(ProcessorReifier.java:231)
at org.apache.camel.reifier.SplitReifier.createProcessor(SplitReifier.java:42)
at org.apache.camel.reifier.ProcessorReifier.makeProcessorImpl(ProcessorReifier.java:536)
at org.apache.camel.reifier.ProcessorReifier.makeProcessor(ProcessorReifier.java:497)
at org.apache.camel.reifier.ProcessorReifier.addRoutes(ProcessorReifier.java:241)
at org.apache.camel.reifier.RouteReifier.addRoutes(RouteReifier.java:358)
... 56 more
Use .to instead of .bean so its sending to a Camel endpoint, then you can send to the mock endpoint. When using .bean then its for calling a POJO Java bean only.

Could not read JSON Can not instantiate value of type [simple type, class org.joda.time.DateTime] from String value

Produce.java(Entity class)
#Column(name="productionStartFrom")
private DateTime productionStartFrom;
#Column(name="lastDateForBid")
private DateTime lastDateForBid;
#Column(name="produceDate")
private DateTime produceDate;
html code
<div class="col-sm-4 form-group datepicker">
<input style="width: 200px;" type="text" class="form-control"
name="productionStartFrom" ng-model="produce.productionStartFrom" placeholder="Production Starts From"required />
</div>
This is my controller class,If type="text" using angular js. I am getting error as mentioned above.
#RequestMapping(value ={"/produce"}, method = RequestMethod.POST)
#ResponseBody
public Produce saveProduce(#RequestBody Produce produce,
Model model,HttpSession session,BindingResult bindingResult, HttpServletResponse
response,HttpServletRequest request) throws IOException, SQLException
{
System.out.println("Control to spring" + produce);
System.out.println(produce.getProductionStartFrom());
}
Stack trace
2017-03-02 11:19:09 DEBUG DefaultHandlerExceptionResolver:134 - Resolving exception from handler [public com.tta.abcd.model.Produce com.tta.abcd.controller.ProduceController.saveProduce(com.tta.abcd.model.Produce,org.springframework.ui.Model,javax.servlet.http.HttpSession,org.springframework.validation.BindingResult,javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpServletRequest) throws java.io.IOException,java.sql.SQLException]: org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Can not instantiate value of type [simple type, class org.joda.time.DateTime] from String value ('Thu Mar 09 2017 00:00:00 GMT+0530 (IST)'); no single-String constructor/factory method
at [Source: org.apache.catalina.connector.CoyoteInputStream#13d0b05; line: 1, column: 19] (through reference chain: com.tta.abcd.model.Produce["productionStartFrom"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not instantiate value of type [simple type, class org.joda.time.DateTime] from String value ('Thu Mar 09 2017 00:00:00 GMT+0530 (IST)'); no single-String constructor/factory method
at [Source: org.apache.catalina.connector.CoyoteInputStream#13d0b05; line: 1, column: 19] (through reference chain: com.tta.abcd.model.Produce["productionStartFrom"])
2017-03-02 11:19:09 DEBUG DispatcherServlet:999 - Null ModelAndView returned to DispatcherServlet with name 'dispatcher': assuming HandlerAdapter completed request handling
2017-03-02 11:19:09 DEBUG DispatcherServlet:976 - Successfully completed request
The error says:
Can not instantiate value of type [simple type, class
org.joda.time.DateTime] from String value ('Thu Mar 09 2017 00:00:00
GMT+0530 (IST)'); no single-String constructor/factory method
To Solve the issue you can have setter methods for your entity that takes String as input and create the Joda DateTime objects.
public void setProductionStartFrom(String productionStartFrom) {
DateTimeFormatter formatter = DateTimeFormat.forPattern("dd/MM/yyyy HH:mm:ss");
this.productionStartFrom = formatter.parseDateTime(productionStartFrom);
}

Indexing with simple expression broken in Apache Camel 2.18

The following sample code works fine with all versions of Camel, excluding 2.18.x
from("direct:process")
.process(new Processor() {
public void process(Exchange exchange) {
List<String> alist = new ArrayList<String>();
alist.add("1");
alist.add("99");
exchange.getIn().setHeader("ITEMS", alist);
exchange.getIn().setHeader("TOTAL_LOOPS", alist.size());
}
})
.loop(simple("${header.TOTAL_LOOPS}", Integer.class))
.setHeader("item", simple("${header.ITEMS[${property.CamelLoopIndex}]}", String.class))
.log(LoggingLevel.INFO, LOG_CLASS_NAME, simple("item = ${header.item} and TOTAL_MAPS = ${header.TOTAL_LOOPS}").getText())
.end()
.end();
However with 2.18.x, the following exception gets thrown:
2017-02-03 21:13:31 ERROR DefaultErrorHandler:204 - Failed delivery
for (MessageId: ID-CATL0W10D4DG4R1-55822-1486174410756-0-1 on
ExchangeId: ID-CATL0W10D4DG4R1-55822-1486174410756-0-2). Exhausted
after delivery attempt: 1 caught:
org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed
to invoke method: [${property.CamelLoopIndex}] on java.util.ArrayList
due to: java.lang.IndexOutOfBoundsException: Key:
${property.CamelLoopIndex} not found in bean: [1, 99] of type:
java.util.ArrayList using OGNL path [[${property.CamelLoopIndex}]]

Hazelcast-- Apache Camel integration

I am new to hazelcast and camel.
While creating a map-loader using camel, I am calling camel route within the the "load" method. Although the container shows "dataSyncLoad" container is present, but still while loading data on startup of the application, it gives error listed below.
Hazelcast Maploader
#Produce(uri = "direct:dataSyncLoad")
private ProducerTemplate dataSyncLoad;
#Override
public synchronized DataSyncServiceRequest load(CellDataSyncKey key) {
DataSyncServiceRequest dataSynchTemplateVO = dataSyncLoad.requestBody("direct:dataSyncLoad",key , DataSyncServiceRequest.class);
if (null != dataSynchTemplateVO) {
LOGGER.info("Cache Loaded: {}", key);
} else {
LOGGER.info("No data found for the key : {}", key);
}
return dataSynchTemplateVO;
}
Map Configuration
<hz:map name="getsToolCcaDatasyncMap" backup-count="0" max-size="100" eviction-percentage="25" eviction-policy="LRU"
read-backup-data="0">
<hz:map-store enabled="true" initial-mode="EAGER" write-delay-seconds="0" implementation="getsToolCcaDatasyncMapLoader"
/>
</hz:map>
Could not load keys from map store
org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[Message: CellDataSyncKey
[locoid=20695, dataTemplate=3, deviceName=CCA]] at
org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1379)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
at
org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:622)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
at
org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:467)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:133)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:149)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
at
org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:297)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
at
org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:327)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
at
com.ge.trans.loader.cell.cache.mapstore.GetsToolCcaDatasyncMap.load(GetsToolCcaDatasyncMap.java:40)[295:cell-cache-service:2.0.0]
at
com.ge.trans.loader.cell.cache.mapstore.GetsToolCcaDatasyncMap.loadAll(GetsToolCcaDatasyncMap.java:57)[295:cell-cache-service:2.0.0]
at
com.hazelcast.map.impl.MapStoreWrapper.loadAll(MapStoreWrapper.java:143)[276:com.hazelcast:3.6.5]
at
com.hazelcast.map.impl.mapstore.AbstractMapDataStore.loadAll(AbstractMapDataStore.java:56)[276:com.hazelcast:3.6.5]
at
com.hazelcast.map.impl.recordstore.BasicRecordStoreLoader.loadAndGet(BasicRecordStoreLoader.java:161)[276:com.hazelcast:3.6.5]
at
com.hazelcast.map.impl.recordstore.BasicRecordStoreLoader.doBatchLoad(BasicRecordStoreLoader.java:134)[276:com.hazelcast:3.6.5]
at
com.hazelcast.map.impl.recordstore.BasicRecordStoreLoader.loadValuesInternal(BasicRecordStoreLoader.java:120)[276:com.hazelcast:3.6.5]
at
com.hazelcast.map.impl.recordstore.BasicRecordStoreLoader.access$100(BasicRecordStoreLoader.java:54)[276:com.hazelcast:3.6.5]
at
com.hazelcast.map.impl.recordstore.BasicRecordStoreLoader$GivenKeysLoaderTask.call(BasicRecordStoreLoader.java:107)[276:com.hazelcast:3.6.5]
at
com.hazelcast.util.executor.CompletableFutureTask.run(CompletableFutureTask.java:67)[276:com.hazelcast:3.6.5]
at
com.hazelcast.util.executor.CachedExecutorServiceDelegate$Worker.run(CachedExecutorServiceDelegate.java:212)[276:com.hazelcast:3.6.5]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_67]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_67]
at java.lang.Thread.run(Thread.java:745)[:1.7.0_67] at
com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:76)[276:com.hazelcast:3.6.5]
at
com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:92)[276:com.hazelcast:3.6.5]
Caused by:
org.apache.camel.component.direct.DirectConsumerNotAvailableException:
No consumers available on endpoint: Endpoint[direct://dataSyncLoad].
Exchange[Message: CellDataSyncKey [locoid=20695, dataTemplate=3,
deviceName=CCA]] at
org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:47)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
at
org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:73)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
at
org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:378)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
at
org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:346)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
at
org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:242)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
at
org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:346)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
at
org.apache.camel.impl.ProducerCache.send(ProducerCache.java:201)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
at
org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:128)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:132)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
... 19 more

WPF unity Activation error occured while trying to get instance of type

I am getting the following error when trying to Initialise the Module using Unity and Prism. The DLL is found by
return new DirectoryModuleCatalog() { ModulePath = #".\Modules" };
The dll is found and the Name is Found
#region Constructors
public AdminModule(
IUnityContainer container,
IScreenFactoryRegistry screenFactoryRegistry,
IEventAggregator eventAggregator,
IBusyService busyService
)
: base(container, screenFactoryRegistry)
{
this.EventAggregator = eventAggregator;
this.BusyService = busyService;
}
#endregion
#region Properties
protected IEventAggregator EventAggregator { get; set; }
protected IBusyService BusyService { get; set; }
#endregion
public override void Initialize()
{
base.Initialize();
}
#region Register Screen Factories
protected override void RegisterScreenFactories()
{
this.ScreenFactoryRegistry.Register(ScreenKeyType.ApplicationAdmin, typeof(AdminScreenFactory));
}
#endregion
#region Register Views and Various Services
protected override void RegisterViewsAndServices()
{
//View Models
this.Container.RegisterType<IAdminViewModel, AdminViewModel>();
}
#endregion
the code that produces the error is:
namespace Microsoft.Practices.Composite.Modularity
protected virtual IModule CreateModule(string typeName)
{
Type moduleType = Type.GetType(typeName);
if (moduleType == null)
{
throw new ModuleInitializeException(string.Format(CultureInfo.CurrentCulture, Properties.Resources.FailedToGetType, typeName));
}
return (IModule)this.serviceLocator.GetInstance(moduleType); <-- Error Here
}
Can Anyone Help Me
Error Log Below:
General Information
Additional Info:
ExceptionManager.MachineName: xxxxx
ExceptionManager.TimeStamp: 22/02/2010 10:16:55 AM
ExceptionManager.FullName: Microsoft.ApplicationBlocks.ExceptionManagement, Version=1.0.3591.32238, Culture=neutral, PublicKeyToken=null
ExceptionManager.AppDomainName: Infinity.vshost.exe
ExceptionManager.ThreadIdentity:
ExceptionManager.WindowsIdentity: xxxxx
1) Exception Information
Exception Type: Microsoft.Practices.Composite.Modularity.ModuleInitializeException
ModuleName: AdminModule
Message: An exception occurred while initializing module 'AdminModule'.
- The exception message was: Activation error occured while trying to get instance of type AdminModule, key ""
Check the InnerException property of the exception for more information. If the exception occurred
while creating an object in a DI container, you can exception.GetRootException() to help locate the
root cause of the problem.
Data: System.Collections.ListDictionaryInternal
TargetSite: Void HandleModuleInitializationError(Microsoft.Practices.Composite.Modularity.ModuleInfo, System.String, System.Exception)
HelpLink: NULL
Source: Microsoft.Practices.Composite
StackTrace Information
at Microsoft.Practices.Composite.Modularity.ModuleInitializer.HandleModuleInitializationError(ModuleInfo moduleInfo, String assemblyName, Exception exception)
at Microsoft.Practices.Composite.Modularity.ModuleInitializer.Initialize(ModuleInfo moduleInfo)
at Microsoft.Practices.Composite.Modularity.ModuleManager.InitializeModule(ModuleInfo moduleInfo)
at Microsoft.Practices.Composite.Modularity.ModuleManager.LoadModulesThatAreReadyForLoad()
at Microsoft.Practices.Composite.Modularity.ModuleManager.OnModuleTypeLoaded(ModuleInfo typeLoadedModuleInfo, Exception error)
at Microsoft.Practices.Composite.Modularity.FileModuleTypeLoader.BeginLoadModuleType(ModuleInfo moduleInfo, ModuleTypeLoadedCallback callback)
at Microsoft.Practices.Composite.Modularity.ModuleManager.BeginRetrievingModule(ModuleInfo moduleInfo)
at Microsoft.Practices.Composite.Modularity.ModuleManager.LoadModuleTypes(IEnumerable`1 moduleInfos)
at Microsoft.Practices.Composite.Modularity.ModuleManager.LoadModulesWhenAvailable()
at Microsoft.Practices.Composite.Modularity.ModuleManager.Run()
at Microsoft.Practices.Composite.UnityExtensions.UnityBootstrapper.InitializeModules()
at Infinity.Bootstrapper.InitializeModules() in D:\Projects\dotNet\Infinity\source\Inifinty\Infinity\Application Modules\BootStrapper.cs:line 75
at Microsoft.Practices.Composite.UnityExtensions.UnityBootstrapper.Run(Boolean runWithDefaultConfiguration)
at Microsoft.Practices.Composite.UnityExtensions.UnityBootstrapper.Run()
at Infinity.App.Application_Startup(Object sender, StartupEventArgs e) in D:\Projects\dotNet\Infinity\source\Inifinty\Infinity\App.xaml.cs:line 37
at System.Windows.Application.OnStartup(StartupEventArgs e)
at System.Windows.Application.<.ctor>b__0(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
2) Exception Information
Exception Type: Microsoft.Practices.ServiceLocation.ActivationException
Message: Activation error occured while trying to get instance of type AdminModule, key ""
Data: System.Collections.ListDictionaryInternal
TargetSite: System.Object GetInstance(System.Type, System.String)
HelpLink: NULL
Source: Microsoft.Practices.ServiceLocation
StackTrace Information
at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)
at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType)
at Microsoft.Practices.Composite.Modularity.ModuleInitializer.CreateModule(String typeName)
at Microsoft.Practices.Composite.Modularity.ModuleInitializer.Initialize(ModuleInfo moduleInfo)
3) Exception Information
Exception Type: Microsoft.Practices.Unity.ResolutionFailedException
TypeRequested: AdminModule
NameRequested: NULL
Message: Resolution of the dependency failed, type = "Infinity.Modules.Admin.AdminModule", name = "". Exception message is: The current build operation (build key Build Key[Infinity.Modules.Admin.AdminModule, null]) failed: The parameter screenFactoryRegistry could not be resolved when attempting to call constructor Infinity.Modules.Admin.AdminModule(Microsoft.Practices.Unity.IUnityContainer container, PhoenixIT.IScreenFactoryRegistry screenFactoryRegistry, Microsoft.Practices.Composite.Events.IEventAggregator eventAggregator, PhoenixIT.IBusyService busyService). (Strategy type BuildPlanStrategy, index 3)
Data: System.Collections.ListDictionaryInternal
TargetSite: System.Object DoBuildUp(System.Type, System.Object, System.String)
HelpLink: NULL
Source: Microsoft.Practices.Unity
StackTrace Information
*********************************************
at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name)
at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, String name)
at Microsoft.Practices.Unity.UnityContainer.Resolve(Type t, String name)
at Microsoft.Practices.Composite.UnityExtensions.UnityServiceLocatorAdapter.DoGetInstance(Type serviceType, String key)
at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)
4) Exception Information
Exception Type: Microsoft.Practices.ObjectBuilder2.BuildFailedException
ExecutingStrategyTypeName: BuildPlanStrategy
ExecutingStrategyIndex: 3
BuildKey: Build Key[Infinity.Modules.Admin.AdminModule, null]
Message: The current build operation (build key Build Key[Infinity.Modules.Admin.AdminModule, null]) failed: The parameter screenFactoryRegistry could not be resolved when attempting to call constructor Infinity.Modules.Admin.AdminModule(Microsoft.Practices.Unity.IUnityContainer container, PhoenixIT.IScreenFactoryRegistry screenFactoryRegistry, Microsoft.Practices.Composite.Events.IEventAggregator eventAggregator, PhoenixIT.IBusyService busyService). (Strategy type BuildPlanStrategy, index 3)
Data: System.Collections.ListDictionaryInternal
TargetSite: System.Object ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext)
HelpLink: NULL
Source: Microsoft.Practices.ObjectBuilder2
StackTrace Information
at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.Builder.BuildUp(IReadWriteLocator locator, ILifetimeContainer lifetime, IPolicyList policies, IStrategyChain strategies, Object buildKey, Object existing)
at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name)
5) Exception Information
Exception Type: System.InvalidOperationException
Message: The parameter screenFactoryRegistry could not be resolved when attempting to call constructor Infinity.Modules.Admin.AdminModule(Microsoft.Practices.Unity.IUnityContainer container, PhoenixIT.IScreenFactoryRegistry screenFactoryRegistry, Microsoft.Practices.Composite.Events.IEventAggregator eventAggregator, PhoenixIT.IBusyService busyService).
Data: System.Collections.ListDictionaryInternal
TargetSite: Void ThrowForResolutionFailed(System.Exception, System.String, System.String, Microsoft.Practices.ObjectBuilder2.IBuilderContext)
HelpLink: NULL
Source: Microsoft.Practices.ObjectBuilder2
StackTrace Information
at Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.ThrowForResolutionFailed(Exception inner, String parameterName, String constructorSignature, IBuilderContext context)
at BuildUp_Infinity.Modules.Admin.AdminModule(IBuilderContext )
at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
6) Exception Information
Exception Type: Microsoft.Practices.ObjectBuilder2.BuildFailedException
ExecutingStrategyTypeName: BuildPlanStrategy
ExecutingStrategyIndex: 3
BuildKey: Build Key[PhoenixIT.IScreenFactoryRegistry, null]
Message: The current build operation (build key Build Key[PhoenixIT.IScreenFactoryRegistry, null]) failed: The current type, PhoenixIT.IScreenFactoryRegistry, is an interface and cannot be constructed. Are you missing a type mapping? (Strategy type BuildPlanStrategy, index 3)
Data: System.Collections.ListDictionaryInternal
TargetSite: System.Object ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext)
HelpLink: NULL
Source: Microsoft.Practices.ObjectBuilder2
StackTrace Information
at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
at Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(IBuilderContext context)
at BuildUp_Infinity.Modules.Admin.AdminModule(IBuilderContext )
7) Exception Information
Exception Type: System.InvalidOperationException
Message: The current type, PhoenixIT.IScreenFactoryRegistry, is an interface and cannot be constructed. Are you missing a type mapping?
Data: System.Collections.ListDictionaryInternal
TargetSite: Void ThrowForAttemptingToConstructInterface(Microsoft.Practices.ObjectBuilder2.IBuilderContext)
HelpLink: NULL
Source: Microsoft.Practices.ObjectBuilder2
StackTrace Information
at Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.ThrowForAttemptingToConstructInterface(IBuilderContext context)
at BuildUp_PhoenixIT.IScreenFactoryRegistry(IBuilderContext )
at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
The innermost exception is the issue.
Your Module type needs a parameter called "screenFactoryRegistry" of type IScreenFactoryRegistry. Since IScreenFactoryRegistry is an interface and you apparently have not done a Register in the container to map that interface to a concrete type, the Unity container throws an exception.
To resolve this, you'd need to map that type in Unity, probably in the ConfigureContainer method of your bootstrapper:
Container.RegisterType<IScreenFactoryRegistry, MyScreenFactoryRegistryImplementation>();

Resources