From: Rajesh Battala [mailto:nore...@reviews.apache.org] On Behalf Of Rajesh 
Battala
Sent: Friday, August 24, 2012 5:20 AM
To: Kishan Kavala; Prachi Damle; Alex Huang
Cc: Rajesh Battala; cloudstack
Subject: Re: Review Request: Moved Awsapi (EC2/S3) from Hibernate framework to 
CloudStack Generic Dao Framework

This is an automatically generated e-mail. To reply, visit: 
https://reviews.apache.org/r/6749/



On August 24th, 2012, 8:29 a.m., Kishan Kavala wrote:

Dao should be injected using the interface and not its Implementing class. 
ComponentLocator will then find the appropriate Implementing class using 
components.xml



Below code:



protected final CloudStackConfigurationDao csDao = 
ComponentLocator.inject(CloudStackConfigurationDaoImpl.class);



should change to:



@Inject

CloudStackConfigurationDao csDao = null;



or



csDao = locator.getDao(CloudStackConfigurationDao.class);



Same applies to Dao injection everywhere else in the patch.





Kishan,

I had tried to both the above approaches, its not working. server is getting 
crashed.





So I had tried another method to load the Dao with inject method by specify the 
Dao class only. That is also failing.



java.lang.AbstractMethodError: 
com.cloud.bridge.persist.dao.CloudStackConfigurationDao$$EnhancerByCGLIB$$227521c6.getConfigValue(Ljava/lang/String;)Ljava/lang/String;

     [java]   at 
com.cloud.bridge.service.EC2MainServlet.init(EC2MainServlet.java:62)

     [java]   at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)

     [java]   at 
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)

     [java]   at 
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4421)

     [java]   at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:4734)

     [java]   at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)

     [java]   at 
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)

     [java]   at 
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)

     [java]   at 
org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)

     [java]   at 
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)

     [java]   at 
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)

     [java]   at 
org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)

     [java]   at 
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)



with the above crash.



I had observed in HostDaoImpl, the Dao's are loaded with 
ComponentLocato.inject.(*Impl.class) only.



The current way is using the *Dao interface and inject with DaoImpl class.

like protected final SHostDao shostDao = 
ComponentLocator.inject(SHostDaoImpl.class);



and executing the methods with shostDao. This is work fine.

Shall I leave it the way as I was using now. ?


- Rajesh
Yes.  It only works if awsapi is also a component.  It isn’t so the only way it 
works would be what Rajesh has done.

--Alex

Reply via email to