Spring controllers extending external class abstract classes classNotFoundException

So I have a spring controller that looks like this:

@Controller // the org.springframework.stereotype.Controller
@RequestMapping("/test")
public class TestController extends BaseController {
    ...
}

      

And it works great. However, when I try to refactor the code to move the BaseController to an external "shared" project, the project build fails followed by a stttrace:

SEVERE: Servlet /mee threw load() exception
java.io.FileNotFoundException: class path resource [ca/wherego/common/controllers/BaseController.class] cannot be opened because it does not exist
    at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:157)
    at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:49)
    at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)

      

I've tried two ways of using an external project:

1) Let maven use it like:

<dependency>
    <groupId>my.api</groupId>
    <artifactId>common</artifactId>
    <version>1.0.1</version>
    <scope>system</scope>
    <systemPath>${basedir}/lib/common-1.0.1.jar</systemPath>
</dependency>

      

and put maven in the correct folder (I don't have a personal maven build, so I can't download it correctly as I'm using other public maven dependencies).

2) I tried to use the "shared" project as a project dependency on the build path.

However, none of the methods work. Did I miss something? Thank!

+3


source to share





All Articles