0

I've a problem with my build and it caused a huge headache for me.

I had an old class and I was using it to fetch data from it, and I created a new class with the same methods. When I test it locally on my machine, everything works fine, but when I try to do a build, it broke because it's unstable and I got this error in the log file:

Caused by: java.lang.NoSuchMethodError: com.mashvisor.bean.Neighborhood.getTraditionalRates()Lcom/mashvisor/database/dao/views/NeighborhoodRentalRates;
at com.mashvisor.database.dao.PropertyDao.retrieve(PropertyDao.java:91)

The NeighborhoodRentalRates class is the old class, and in my code I'm sure im not using it nor trying to access it in that line, here's my code for that line:

Hibernate.initialize(property.getNeighborhood().getTraditionalRates());

and here's it's declaration

public TraditionalNeighborhoodRentalRates getTraditionalRates() {
    return traditionalRates;
}

The TraditionalNeighborhoodRentalRates is the new class, and the only change here is the class name.

Could any body help?

1
  • What build tool do you use? If you use maven, try to call mvn clean and then mvn install. Commented Dec 29, 2015 at 9:16

1 Answer 1

1

Your code is still calling the old method, i.e. it is looking for a method with the signature:

public NeighborhoodRentalRates getTraditionalRates() { ... }

Just using the same names it not enough. To have classes with the same (method-)interface, you have to have the same names, return types and argument types in all methods.

So you need to go through your calling code and make sure the new type is expected everywhere as return type and recompile the calling code.

Sign up to request clarification or add additional context in comments.

1 Comment

Did it answer your question? If so, please accept the answer. Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.