Hello All,
I'm writing an article<http://www.ociweb.com/articles/publications/jnb.html>on
appfuse for my consulting firm (due out May 1st) and as a result I'm
passing through the tutorial. I noticed the same issues which have been
mentioned in the Jira issue APF-998<http://issues.appfuse.org/browse/APF-998>.
I tried the posted solution 'mvn -U' which did not work for me. The only
thing which seemed to help was modifying the testResources area adding the
WEB-INF to the directory. I emailed a colleague earlier today concerning
this, and I've pasted a snippet from that email below. I'm trying to follow
the struts2-basic example with hibernate. Please let me know if further
information is needed:
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.52 sec <<<
FAILURE!
testFindEntryByProjectNumber(com.oci.jnb.timeEntry.dao.TimeEntryDAOTest)
Time elapsed: 1.482 sec <<< ERROR!
org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name 'com.oci.jnb.timeEntry.dao.TimeEntryDAOTest':
Unsatisfied dependency expressed through bean property 'timeEntryDao': Set
this property value or disable dependency checking for this bean.
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.checkDependencies(AbstractAutowireCapableBeanFactory.java:1213)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1038)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:291)
at
org.springframework.test.AbstractDependencyInjectionSpringContextTests.injectDependencies(AbstractDependencyInjectionSpringContextTests.java:230)
at
org.springframework.test.AbstractDependencyInjectionSpringContextTests.prepareTestInstance(AbstractDependencyInjectionSpringContextTests.java:195)
So in my ApplicationContext I have the following definition, this file is
located in the src/main/webapp/web-inf/ directory.
<bean id="timeEntryDao"
class="com.oci.jnb.timeEntry.dao.hibernate.TimeEntryDaoImpl">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
The TimeEntryDAOTest has the setter that I'm interested in injecting. So
from the xml fragment above I'm trying to inject the "bean id=timeEntryDao"
with the class TimeEntryDaoImpl. This setter is defined as:
private TimeEntryDao dao = null;
public void setTimeEntryDao(TimeEntryDao timeEntryDao) {
dao = timeEntryDao;
}
The other interesting thing to note about the TimeEntryDAOTest is that it
extends from BaseDaoTestCase which is an appFuse provided class and that
extends from AbstractTransactionalDataSourceSpringContextTests. Inside the
BaseDaoTestCase there is the following method returning config locations:
protected String[] getConfigLocations() {
setAutowireMode(AUTOWIRE_BY_NAME);
return new String[] {
"classpath:/applicationContext-resources.xml",
"classpath:/applicationContext-dao.xml",
"classpath*:/applicationContext.xml", // for modular
projects
"classpath:**/applicationContext*.xml" // for web projects
};
}
There are a couple things I don't understand about the method above, one is
the asterisks surrounding the file names. It seems like the entry
classpath*:/applicationContext.xml could be incorrect.
Thanks in advance,
Ryan