Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpringComponentFinderStrategy #91

Closed
TVDSC opened this issue Apr 11, 2018 · 2 comments
Closed

SpringComponentFinderStrategy #91

TVDSC opened this issue Apr 11, 2018 · 2 comments

Comments

@TVDSC
Copy link

TVDSC commented Apr 11, 2018

Hi guys,

I'm like using Structurizr to create my architecture documentation.
But i have recently ran into a class not found exception:

Container apiBackend = company.addContainer("Backend API", "Provides and Receives company data via JSON/HTTPS API.", "js");

ComponentFinder serviceFinder = new ComponentFinder(apiMiddleware, "com.company.services", new SpringComponentFinderStrategy(
                new ReferencedTypesSupportingTypesStrategy(false)
        ));

This package only contains @service annotations.

But when i run this i get:

Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.NoClassDefFoundError: org/springframework/data/jpa/repository/JpaRepository
	at com.structurizr.analysis.SpringRepositoryComponentFinderStrategy.findSpringRepositoryInterfaces(SpringRepositoryComponentFinderStrategy.java:41)
	at com.structurizr.analysis.SpringRepositoryComponentFinderStrategy.doFindComponents(SpringRepositoryComponentFinderStrategy.java:28)
	at com.structurizr.analysis.AbstractComponentFinderStrategy.findComponents(AbstractComponentFinderStrategy.java:57)
	at com.structurizr.analysis.SpringComponentFinderStrategy.doFindComponents(SpringComponentFinderStrategy.java:61)
	at com.structurizr.analysis.AbstractComponentFinderStrategy.findComponents(AbstractComponentFinderStrategy.java:57)
	at com.structurizr.analysis.ComponentFinder.findComponents(ComponentFinder.java:74)
	at com.neanex.MiddlewareApplication.main(MiddlewareApplication.java:79)
	... 5 more
Caused by: java.lang.ClassNotFoundException: org.springframework.data.jpa.repository.JpaRepository
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 12 more```

Can you guys point me in the right direction?
Extra info: I'm only using 1 CrudRepository for redis and it's not situated in that package, but in a repositories package.

kind regards
@roxspring
Copy link
Contributor

SpringComponentFinderStrategy uses SpringRepositoryComponentFinderStrategy which references and therefore depends on JpaRepository. If you're only looking for @Service annotated components then try directly using SpringServiceComponentFinderStrategy instead and you should get a little further.

@simonbrowndotje
Copy link
Contributor

How are you using the library? Are you building from source, or including a dependency on structurizr-spring in your Maven/Gradle/etc build/project file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants