Comments inline below...

On Sep 15, 2010, at 6:34 PM, jackalista wrote:

> 
> Hi,
> 
> I'm using the modular struts archetype, this is my command for creating the
> project:
> 
> mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes
> -DarchetypeArtifactId=appfuse-modular-struts-archetype
> -DarchetypeVersion=2.1.0-M1 -DgroupId=com.foo.commerce.poc -DartifactId=mdm
> 
> I am following the hibernate tutorial and there are missing imports, I have
> sorted all of them out except the @ExpectedException one for test method
> testAddAndRemovePerson.
> 
> I'm getting this exception without any import for this:
> 
> [INFO] Compilation failure
> /home/jack/java/foo/af/poc/mdm/core/src/test/java/com/foo/commerce/poc/dao/PersonDaoTest.java:[24,5]
> cannot find symbol
> symbol  : class ExpectedException
> location: class com.nike.commerce.poc.dao.PersonDaoTest
> 
> I searched the archives for ExpectedException and found a possible import
> statement in a few posts which is this:
> 
> import org.springframework.test.annotation.ExpectedException;
> 
> However, while this builds, when I run the test all hell breaks loose and
> I'm getting a really strange excpetion I've never seen before from an
> appfuse project, is this the wrong import or what's the problem here?  The
> exception I'm getting is the following, which starts out talking about an
> initial context problem?!?!?  Any help would be greatly appreciated, thanks!
> 
> 
> -------------------------------------------------------
> T E S T S
> -------------------------------------------------------
> Running com.foo.commerce.poc.dao.PersonDaoTest
> [core] WARN [main] SessionFactoryObjectFactory.addInstance(121) | Could not
> bind factory to JNDI
> javax.naming.NoInitialContextException: Need to specify class name in
> environment or system property, or as an applet parameter, or in an
> application resource file:  java.naming.factory.initial
>       at 
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
>       at 
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>       at

I haven't seen this before, so I'm guessing Hibernate isn't getting initialized 
correctly.

<snip/>

> 
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
> [core] ERROR [main] TestContextManager.prepareTestInstance(258) | Caught
> exception while allowing TestExecutionListener
> [org.springframework.test.context.support.dependencyinjectiontestexecutionliste...@189a773]
> to prepare test instance [com.foo.commerce.poc.dao.persondaot...@509df8]
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'com.foo.commerce.poc.dao.PersonDaoTest': Autowiring of fields
> failed; nested exception is
> org.springframework.beans.factory.BeanCreationException: Could not autowire
> field: private com.foo.commerce.poc.dao.PersonDao
> com.foo.commerce.poc.dao.PersonDaoTest.personDao; nested exception is
> org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique
> bean of type [com.foo.commerce.poc.dao.PersonDao] is defined: Unsatisfied
> dependency of type [interface com.foo.commerce.poc.dao.PersonDao]: expected
> at least 1 matching bean

Do you have implementations of PersonDao in your project? If so, does it 
contain a @Repository annotation?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to