If you run "mvn resources:testResources", you should be able to
refresh your project in Eclipse and run tests. The reason for this is
jdbc.properties needs to be parsed and replaced with the proper values
from your pom.xml.

If that doesn't work for you, you can make jdbc.properties your source
of information for pom.xml. I'd like to do everything to make testing
as easy as possible, so it's possible this is a better solution
anyway.

Matt

On 8/6/07, arief <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Anybody able to run junit test in eclipse?
> my environment:
> - appfuse 2.0 rc1
> - struts 2.0.9
> - ibatis with oracle9
>
> I'm a newbie on appfuse. Tried following the tutorial. I could build it
> using "mvn test" but if i could do run test inside eclipse, that would be
> great.
>
> my eclipse stack trace is as follows:
>
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'transactionManager' defined in URL
> [jar:file:/D:/xxx/Maven-Repo/repository/org/appfuse/appfuse-ibatis/2.0-rc1-SNAPSHOT/appfuse-ibatis-2.0-rc1-SNAPSHOT.jar!/applicationContext-dao.xml]:
> Cannot resolve reference to bean 'dataSource' while setting bean property
> 'dataSource'; nested exception is
> org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
> named 'dataSource' is defined
> Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:
> No bean named 'dataSource' is defined
>         at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:356)
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:916)
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:243)
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
>         at
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:261)
>         at
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:109)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1099)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:861)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireC....
>
> I have copied the application-dao.xml into my own folder. Not sure if that
> causes this problem.
> Any kind help is very much appreciated.
>
> Thanks
>
>
>
>
> wnqq wrote:
> >
> > Dear Matt,
> >
> > Thanks for the guidance.
> > I haven't got any luck yet. Anyway, I will give it some more tries later.
> >
> >
> > mraible wrote:
> >>
> >> You may need to turn off "build automatically" in Eclipse.  It's
> >> likely overriding your target/classes/jdbc.properties with the
> >> unparsed one in src/main/resources/jdbc.properties.  Another option
> >> (which I haven't tried) is to make src/main/resources/jdbc.properties
> >> the source and modify pom.xml to use it as a filter.
> >>
> >> Matt
> >>
> >> On 4/2/07, wnqq <[EMAIL PROTECTED]> wrote:
> >>>
> >>> I tried "mvn clean compile" and refresh eclipse, but still got the
> >>> "circular
> >>> placeholder reference" errors.
> >>> It looks like it has nothing to do with jdbc.properties.
> >>>
> >>>
> >>> mraible wrote:
> >>> >
> >>> > You probably need to run "mvn compile" from the command line first -
> >>> > so jdbc.properties gets copied to the target directory and its values
> >>> > get replaced.
> >>> >
> >>> > Matt
> >>> >
> >>> > On 4/2/07, wnqq <[EMAIL PROTECTED]> wrote:
> >>> >>
> >>> >> Have anyone successfully executed junit tests in eclipse?
> >>> >>
> >>> >> My environment:
> >>> >> * Appfuse v2.0M4 + struts + hibernate
> >>> >> * eclipse v3.2.1
> >>> >>
> >>> >> I can successfully run PersonManagerTest, however, I am unable to
> >>> finish
> >>> >> the
> >>> >> tests of PersonDaoTest nor PersonActionTest.
> >>> >> The steps I did are: right click on PersonDao/ActionTest.java => Run
> >>> As
> >>> >> =>
> >>> >> JUnit Test
> >>> >>
> >>> >> The error message while running PersonDaoTest is as follows:
> >>> >>
> >>> >> ==========================================================
> >>> >>
> >>> >> org.springframework.beans.factory.BeanDefinitionStoreException: Error
> >>> >> registering bean with name 'sessionFactory' defined in URL
> >>> >>
> >>> [jar:file:/C:/Res/Platform/.m2/repository/org/appfuse/appfuse-hibernate/2.0-m4/appfuse-hibernate-2.0-m4.jar!/applicationContext-dao.xml]:
> >>> >> Circular placeholder reference 'hibernate.dialect' in property
> >>> >> definitions
> >>> >>         at
> >>> >>
> >>> org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:249)
> >>> >>         at
> >>> >>
> >>> org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75)
> >>> >>         at
> >>> >>
> >>> org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:422)
> >>> >>         at
> >>> >>
> >>> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:334)
> >>> >>         at
> >>> >>
> >>> org.springframework.test.AbstractSingleSpringContextTests.createApplicationContext(AbstractSingleSpringContextTests.java:199)
> >>> >>         at
> >>> >>
> >>> org.springframework.test.AbstractSingleSpringContextTests.loadContextLocations(AbstractSingleSpringContextTests.java:179)
> >>> >>         at
> >>> >>
> >>> org.springframework.test.AbstractSingleSpringContextTests.loadContext(AbstractSingleSpringContextTests.java:158)
> >>> >>         at
> >>> >>
> >>> org.springframework.test.AbstractSpringContextTests.getContext(AbstractSpringContextTests.java:105)
> >>> >>         at
> >>> >>
> >>> org.springframework.test.AbstractSingleSpringContextTests.setUp(AbstractSingleSpringContextTests.java:87)
> >>> >>         at junit.framework.TestCase.runBare(TestCase.java:128)
> >>> >>         at
> >>> >>
> >>> org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
> >>> >>         at junit.framework.TestResult$1.protect(TestResult.java:106)
> >>> >>         at
> >>> junit.framework.TestResult.runProtected(TestResult.java:124)
> >>> >>         at junit.framework.TestResult.run(TestResult.java:109)
> >>> >>         at junit.framework.TestCase.run(TestCase.java:120)
> >>> >>         at junit.framework.TestSuite.runTest(TestSuite.java:230)
> >>> >>         at junit.framework.TestSuite.run(TestSuite.java:225)
> >>> >>         at
> >>> >>
> >>> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
> >>> >>         at
> >>> >>
> >>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> >>> >>         at
> >>> >>
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> >>> >>         at
> >>> >>
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> >>> >>         at
> >>> >>
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> >>> >>         at
> >>> >>
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> >>> >>
> >>> >> ==========================================================
> >>> >>
> >>> >> Any hints?
> >>> >> --
> >>
> >>
> >
> >
>
> --
>
> View this message in context: 
> http://www.nabble.com/execute-junit-tests-in-eclipse-tf3504799s2369.html#a12023490
>
> Sent from the AppFuse - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
http://raibledesigns.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to