Hi All,
I am getting the below error while running my APP using TOMCAT.
My context file is given below:Code:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'supplyService' defined in ServletContext resource [/WEB-INF/conf/spring/sffs-aop-domain.xml]: Invocation of init method failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class it.freshfruits.domain.entity.FruitTypeImpl]: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
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.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
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.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
at
Service class here:Code:<!--
Enable @Configurable Annotation in conjunction with LTW jvm:
(test) -javaagent:<path>/spring-agent.jar
(tomcat) <tomcat6>/lib/spring-tomcat-weaver.jar-->
<context:load-time-weaver /> <!-- enable the use of META-INF/aop.xml -->
<context:spring-configured />
<context:annotation-config />
<!-- Aspects -->
<bean id="cacheAspect" class="it.freshfruits.aspect.CacheAspect"/>
<aop:config proxy-target-class="true">
<aop:pointcut id="customerFactoryReadOperation" expression="execution(* it.freshfruits.domain.factory.CustomerFactoryImpl.get*(..))" />
<aop:pointcut id="customerRepoReadOperation" expression="execution(* it.freshfruits.application.repository.CustomerRepositoryImpl.select*(..))" />
<aop:pointcut id="customerRepoInsertOperation" expression="execution(* it.freshfruits.application.repository.CustomerRepositoryImpl.insert*(..))" />
<aop:pointcut id="customerRepoUpdateOperation" expression="execution(* it.freshfruits.application.repository.CustomerRepositoryImpl.update*(..))" />
<aop:pointcut id="customerRepoDisableOperation" expression="execution(* it.freshfruits.application.repository.CustomerRepositoryImpl.disable*(..))" />
<aop:pointcut id="fruitReadOperation" expression="execution(* it.freshfruits.application.repository.FruitTypeRepositoryImpl.get*(..))" />
<aop:pointcut id="fruitInsertOperation" expression="execution(* it.freshfruits.application.repository.FruitTypeRepositoryImpl.insert*(..))" />
<aop:pointcut id="fruitUpdateOperation" expression="execution(* it.freshfruits.application.repository.FruitTypeRepositoryImpl.update*(..))" />
<aop:aspect id="customerAspect" ref="customerCacheAspect">
<aop:around pointcut-ref="customerFactoryReadOperation" method="invoke" />
<aop:around pointcut-ref="customerRepoReadOperation" method="invoke" />
<aop:before pointcut-ref="customerRepoInsertOperation" method="flush" />
<aop:before pointcut-ref="customerRepoUpdateOperation" method="flush" />
<aop:before pointcut-ref="customerRepoDisableOperation" method="flush" />
</aop:aspect>
<aop:aspect id="fruitAspect" ref="fruitCacheAspect">
<aop:around pointcut-ref="fruitReadOperation" method="invoke" />
<aop:before pointcut-ref="fruitInsertOperation" method="flush" />
<aop:before pointcut-ref="fruitUpdateOperation" method="flush" />
</aop:aspect>
</aop:config>
<!-- Aspects with schema -->
<bean id="customerCacheAspect" class="it.freshfruits.aspect.CacheAspect" >
<property name="cache">
<bean id="customerCache" parent="cache">
<property name="cacheName" value="customerCache" />
</bean>
</property>
</bean>
<bean id="fruitCacheAspect" class="it.freshfruits.aspect.CacheAspect" >
<property name="cache">
<bean id="fruitCache" parent="cache">
<property name="cacheName" value="fruitCache" />
</bean>
</property>
</bean>
<bean id="customer" scope="prototype" class="it.freshfruits.domain.entity.CustomerImpl"
p:orderRepository-ref="orderRepository" p:customerRepository-ref="customerRepository"/>
<bean id="fruitType" scope="prototype" class="it.freshfruits.domain.entity.FruitTypeImpl"/>
<bean id="order" scope="prototype" class="it.freshfruits.domain.entity.OrderImpl"/>
<bean id="supplyService" class="it.freshfruits.domain.service.SupplyServiceImpl" init-method="init"/>
</beans>
jars using :Code:public class SupplyServiceImpl implements SupplyService {
public SupplyServiceImpl() {
this.availableItems = new HashMap<String, QuantityAndItemVO>();
this.reservedItems = new HashMap<String, List<OrderItem>>();
}
public void init() {
FruitType fruit = new FruitTypeImpl.Builder("orange", new Integer(2), new BigDecimal("0.20")).build();
OrderItem item = new OrderItemImpl.Builder(fruit, 400, "1").build();
availableItems.put(item.getFruitType().getId().toString(), new QuantityAndItemVO(item));
FruitType fruitTwo = new FruitTypeImpl.Builder("lemon", new Integer(3), new BigDecimal("0.15")).build();
OrderItem itemTwo = new OrderItemImpl.Builder(fruitTwo, 350, "1").build();
availableItems.put(itemTwo.getFruitType().getId().toString(), new QuantityAndItemVO(itemTwo));
}
public Map<String, QuantityAndItemVO> getItemsAvailable() {
return availableItems;
}
public Map<String, List<OrderItem>> getReservedItems() {
return reservedItems;
}
public Boolean isAvailable(OrderItem item) {
return availableItems.containsKey(item.getFruitType().getId().toString());
}
public Boolean release(String idOrder, String idItem) {
Boolean result = false;
List<OrderItem> listItems = reservedItems.get(idOrder);
if (listItems != null && listItems.size() > 0) {
for (int index = 0; index < listItems.size(); index++) {
OrderItem item = listItems.get(index);
if (item.getFruitType().getId().toString().equals(idItem)) {
listItems.remove(item);
QuantityAndItemVO qat = availableItems.get(idItem);
qat.add(item.getQuantity());
availableItems.put(idItem, qat);
reservedItems.put(idOrder, listItems);
result = true;
}
}
}
return result;
}
public Boolean retainItem(OrderItem item) {
Boolean result = false;
QuantityAndItemVO qat = availableItems.get(item.getFruitType().getId().toString());
if (qat != null) {
if (qat.getQuantity() >= item.getQuantity()) {
List<OrderItem> items = reservedItems.get(item.getIdOrder().toString());
if (items == null) {
items = new ArrayList<OrderItem>();
}
items.add(item);
reservedItems.put(item.getIdOrder().toString(), items);
qat.setQuantity(qat.getQuantity() - item.getQuantity());
availableItems.put(qat.getItem().getFruitType().getId().toString(), qat);
result = true;
}
}
return result;
}
private Map<String, QuantityAndItemVO> availableItems;
private Map<String, List<OrderItem>> reservedItems;
}
aspectjrt-1.6.2.jar
aspectjweaver-1.6.2.jar
spring.jar
spring-aspects.jar
Can anyone figure out what's going wrong?
Thank You,
Manoj

