Cannot find implementation for ...

2,187 views
Skip to first unread message

Ritchie Nithoo

unread,
Aug 29, 2016, 9:23:41 AM8/29/16
to mapstruct-users
Hello , 
I am using mapstruct version 1.1.0Beta1. It worked perfectly on my developement branch on GIT (thank you for the wonderful tool :D ). 
However , after merging it on my master branch i now get the error "ClassNotFoundException cannot find implementation for..."

I tried looking a little around the net for my problem and found a solution given by Gunnar at the following address : https://github.com/mapstruct/mapstruct/issues/742 
However , if i'm not mistaken this has already been implemented? Anyhoo , i tried it and it still doesn't work. 

What is the most peculiar , is that i see no difference between my two workspaces and branches , but that it seems to work fine on one but stacks on the other. 

Anyone got an idea of what might be the problem ? I checked all the classpaths , imports and declared source folder (since my implementations are generated in a custom folder called src-generated) . 

Thanks a lot of reading me. 
Ritchie Nithoo

Andreas Gudian

unread,
Aug 29, 2016, 10:09:47 AM8/29/16
to Ritchie Nithoo, mapstruct-users
Hi Ritchie,

Check if your classes directory contains not only the mapper classes, but also the mapper-Impl class files.

Based on that we can further dive down either on a compilation/build config problem, or a runtime classloading issue.

Andreas
--
You received this message because you are subscribed to the Google Groups "mapstruct-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapstruct-users+unsubscribe@googlegroups.com.
To post to this group, send email to mapstruct-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gunnar Morling

unread,
Aug 29, 2016, 10:13:10 AM8/29/16
to Andreas Gudian, Ritchie Nithoo, mapstruct-users
Is this a problem in your IDE or with your project build (Maven, Gradle etc.). If it's only in the IDE, does your project have any error markers? E.g. Eclipse would not trigger the annotation processor and compile the generated classes if there is a general problem with the project (e.g. a missing dependency or so).

--Gunnar

Ritchie Nithoo

unread,
Aug 29, 2016, 10:47:52 AM8/29/16
to mapstruct-users, andreas...@gmail.com, ritchi...@gmail.com, gun...@hibernate.org
Thanks for the quick answer. If i understood both your questions correctly , the answer would be that there are no compile error in my IDE. Furthermore , even if the annotation processor would not have been triggered , i had to commit my generated classes for build purposes. Thus , my classes should be there. (Again please correct me if i'm wrong). 

@Andreas : my classes directories contains the mapper-impl and the mapper classes. Both are in a different package though , would that be a problem ? Because it seems to be working fine on my dev branch. 

Thanks again. 
I will keep looking , this looks like a build/config problem to me if you haven't encountered that type of issue before. 
Ritchie Nithoo

Ritchie Nithoo

unread,
Aug 30, 2016, 10:12:49 AM8/30/16
to mapstruct-users
Hi again , 
I finally figured out what the problem was. On my project for my dev branch i had the annotation processing enable and it was disable on my next branch.
What bothers me is this though : if mapstruct has already generated the code , why would the Mappers.getMapper stack not knowing where the implementation is ? Does the interface + the generated code + the code calling the mapper all have to be in the same project ? 
I will check out your git code (or only your class Mappers) when i get the chance to check this out. 
Anyway thank you for your help ! 
Ritchie Nithoo
Reply all
Reply to author
Forward
0 new messages