Saturday, March 3, 2012

Mybatis mapper xml file location in Maven project.

mybatis, Spring, Maven, Glassfish are well harmonized.
Development on my local computer was cruising well.

It's almost ready to finish project.

before launching it on production server.
we just fished to set up development server.
As it should be, I deployed it on to development server.

"mvn package" and get the war file.
deploy the war file to glassfish.

Errors occurred, Mybatis Mapper is missing?
"Mapped Statements collection does not contain value for ..."
What? why? I see all mapper xml/ class file. All files are placed right.
and working well on my local PC.

No clue.. for a while and while.
As new at maven, I had no idea that could happen.

Maven won't package except class files.
I knew that, so I located properties, conf files in resource directories.
but, I forgot that xml will be exculded as well.
xml mapper files are located under same mybatis mapper interface directories.
I have opened up the war file, As my guess, there was no mapper xml files on classpath directories.


Development local src directory file. there are mapper xml files are located.



But, Under maven target directory. xml mapper files are missing.



Solution, just re-located xml mapper files under resource directory in same directory hierarchy.
so, I will be packaged under same directory or you can change mapper location and put it.
as you know, you need to reconfigure the mapper location on spring then.

No comments:

Post a Comment