If you remove the appfuse-data-common from the warpath dependency,
does it still work? Also, you shouldn't need to exclude
appfuse-hibernate from the second dependency. If you're using JPA or
iBATIS, it may be different.
Matt
On 6/7/07, fadhli <[EMAIL PROTECTED]> wrote:
It seems that I had to add the exclusion at the appfuse-${dao.framework}
artifact id too. Then all my DAO's and Manager Test will pass.
<dependency>
<groupId>org.appfuse</groupId>
<artifactId>appfuse-${web.framework}</artifactId>
<version>${appfuse.version}</version>
<type>warpath</type>
<!-- This exclusion and the dependency following this one allow
DAO framework switching. -->
<!-- You only need these if you want to use JPA or iBATIS. See
APF-565 for more information. -->
<!-- It does no harm to leave it in for Hibernate, but it's not
needed. -->
<exclusions>
<exclusion>
<groupId>org.appfuse</groupId>
<artifactId>appfuse-data-common</artifactId>
</exclusion>
<exclusion>
<groupId>org.appfuse</groupId>
<artifactId>appfuse-hibernate</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.appfuse</groupId>
<artifactId>appfuse-${dao.framework}</artifactId>
<version>${appfuse.version}</version>
<exclusions>
<exclusion>
<groupId>org.appfuse</groupId>
<artifactId>appfuse-data-common</artifactId>
</exclusion>
<exclusion>
<groupId>org.appfuse</groupId>
<artifactId>appfuse-hibernate</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>${jdbc.groupId}</groupId>
<artifactId>${ jdbc.artifactId}</artifactId>
<version>${jdbc.version}</version>
</dependency>
On 6/7/07, fadhli < [EMAIL PROTECTED]> wrote:
> Hi Matt, sorry for the late reply.
>
> Yes, I did run mvn clean compile integration-test all in one swoop. But I
still got the same error.
>
>
>
>
> On 6/7/07, Matt Raible <[EMAIL PROTECTED]> wrote:
> > Did you run "mvn clean" after making the change?
> >
> > On 6/5/07, fadhli <[EMAIL PROTECTED] > wrote:
> > > Hi all, I'm using Appfuse2.0-m5 with Spring MVC Basic.
> > >
> > > I recently exported the Appfuse core classes into my own project. I
followed
> > > the instructions to include the following exclusions of the dependency
in my
> > > project's pom.xml.
> > >
> > > <dependency>
> > > <groupId>org.appfuse</groupId>
> > > <artifactId>appfuse-${web.framework}</artifactId>
> > > <version>${appfuse.version }</version>
> > > <type>warpath</type>
> > > <!-- This exclusion and the dependency following this one
allow
> > > DAO framework switching. -->
> > > <!-- You only need these if you want to use JPA or iBATIS.
See
> > > APF-565 for more information. -->
> > > <!-- It does no harm to leave it in for Hibernate, but
it's not
> > > needed. -->
> > > <exclusions>
> > > <exclusion>
> > > <groupId>org.appfuse </groupId>
> > >
> > > <artifactId>appfuse-data-common</artifactId>
> > > </exclusion>
> > > <exclusion>
> > > <groupId>org.appfuse </groupId>
> > >
> > > <artifactId>appfuse-hibernate</artifactId>
> > > </exclusion>
> > > </exclusions>
> > > </dependency>
> > >
> > > In my project, the User class has a bidirectional OneToMany
relationship
> > > with Contact class.
> > >
> > > So I did my unit test ContatDaoTest and tried to test it mvn
test-compile
> > > test -Dtest=ContactDaoTest and it fails for this one method and got
the
> > > following error:
> > >
> > >
testAddAndRemoveContact(com.jungoot.contact.dao.ContactDaoTest
> > > ) Time elapsed: 0.015 sec <<< ERROR!
> > > java.lang.NoSuchMethodError:
> > >
org.appfuse.model.User.addContact(Lcom/jungoot/contact/model/Contact;)V
> > > at
> > >
com.jungoot.contact.dao.ContactDaoTest.testAddAndRemoveContact
> > > (ContactDaoTest.java :77)
> > > at
> > >
com.jungoot.contact.dao.ContactDaoTest.testAddAndRemoveContact(ContactDaoTest.java:77)
> > > at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > Method)
> > > at sun.reflect.NativeMethodAccessorImpl.invoke
> > > (NativeMethodAccessorImpl.java:39)
> > > at
> > >
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > > at java.lang.reflect.Method.invoke(Method.java:597)
> > > at junit.framework.TestCase.runTest
(TestCase.java:164)
> > > at
junit.framework.TestCase.runBare(TestCase.java:130)
> > > 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
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > Method)
> > > at sun.reflect.NativeMethodAccessorImpl.invoke
> > > (NativeMethodAccessorImpl.java:39)
> > > at
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
> > > at java.lang.reflect.Method.invoke(Method.java:597)
> > > at
org.apache.maven.surefire.junit.JUnitTestSet.execute
> > > (JUnitTestSet.java:213)
> > > at
> > >
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:138)
> > > at
> > >
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute
> > > (AbstractDirectoryTestSuite.java :125)
> > > at
> > >
org.apache.maven.surefire.Surefire.run(Surefire.java:132)
> > > at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > Method)
> > > at sun.reflect.NativeMethodAccessorImpl.invoke
> > > (NativeMethodAccessorImpl.java:39)
> > > at
> > >
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > > at java.lang.reflect.Method.invoke(Method.java:597)
> > > at
> > >
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess
> > > (SurefireBooter.java:290)
> > > at
> > >
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:818)
> > >
> > > This is the method in my ContactDaoTest class
> > >
> > > public void testAddAndRemoveContact() throws Exception {
> > > User user = new User();
> > > user = userDao.get(new Long(1));
> > > Contact contact = new Contact();
> > > contact.setContactId(new Long(1));
> > > contact.setFirstName("Fadhli");
> > > contact.setLastName("Rahim");
> > > contact.setEmail(" [EMAIL PROTECTED]");
> > > Address address = new Address();
> > > address.setCity ("Denver");
> > > address.setProvince("CO");
> > > address.setCountry ("USA");
> > > address.setPostalCode("80210");
> > > contact.setContactAddress(address);
> > > contactDao.saveContact(contact);
> > > user.addContact(contact);
> > > user = userDao.saveUser(user);
> > >
> > > flush();
> > >
> > > contact = contactDao.get(contact.getContactId());
> > >
> > > assertEquals("Fadhli", contact.getFirstName ());
> > > assertNotNull(contact.getContactId());
> > >
> > > log.debug("removing contact...");
> > > contactDao.remove(contact.getContactId ());
> > > flush();
> > >
> > > try {
> > > contactDao.get(contact.getContactId());
> > > fail("Contact found in database!");
> > > } catch (DataAccessException dae){
> > > log.debug ("Expected exception: " + dae.getMessage() + ".
This
> > > means contact is already removed from record");
> > > assertNotNull(dae);
> > > }
> > > }
> > >
> > >
> > > Here's the code that I added into the User class file:
> > >
> > > /**
> > > * Map user and contact bidirectional association
> > > * Cascade equivalent to cascade="save-update"
> > > * Enables transitive persistence for Contact instances.
> > > */
> > > @OneToMany(cascade ={ CascadeType.PERSIST,
> > > CascadeType.MERGE,
> > > CascadeType.REMOVE},
> > > mappedBy="user")
> > > @org.hibernate.annotations.Cascade(value =
> > > org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
> > > public Set<Contact> getContacts() {
> > > return contacts;
> > > }
> > >
> > > public void addContact(Contact contact) {
> > > contact.setUser (this);
> > > contacts.add(contact);
> > > }
> > >
> > > public void setContacts(Set<Contact> contacts) {
> > > this.contacts = contacts;
> > > }
> > >
> > >
> > > Can anyone point me in the right direction? It seems the error
message, it
> > > can't find the method addContact in the User class.
> > >
> > > Your help is deeply appreciated.
> > >
> > > Thanks
> > >
> > > --
> > > /fadhli
> >
> >
> > --
> > http://raibledesigns.com
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
[EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
>
> --
> /fadhli
--
/fadhli
--
http://raibledesigns.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]