Question

First of all I apologize for being unable to share exact stack trace and code contents. There is an airgap between my development system and the internet and it is impossible to just copy paste.

My issue is that the typeAlias for my DTO is causing a ClassNotFound exception when the mapper attempts to parse the config xml. The confusing part is that there is a very VERY similar DAO/DTO in the next package over that works fine. I mirrored all of their settings when I added the new one .. but the new one is wreaking havoc.

Pseudo code setup:

org.com.somesystem.common.database:

spring-prod-db-coolDaoBeans.xml (containing config information and bean IDs that sort of thing) sql-map-config.xml (containing settings, typeAliases mapping resultTypes to DTO object names, Mappers)

org.com.somesystem.common.database.cooltable:

CoolTableDAO.java (interface with insert, delete, update, count, selectAll methods) CoolTableDTO.java (public class with setters and getters) CoolTable.DAO.xml (the sql definitions for inserts, selects, deletes etc on coolTable)

This works great, I build a jar.. and call REST services that use the DAO/DTO without issue, then I add

org.com.somesystem.common.database.muchcoolertable

MuchCoolerTableDAO.java (interface with insert, delete, update, count, selectAll methods) MuchCoolerTableDTO.java (public class with setters and getters) MuchCoolerTable.DAO.xml (the sql definitions for inserts, selects, deletes etc on muchCoolerTable)

I also make mirrored entries for the typeAlias' , mappers etc in the mapper and config files at the .database level.

I have doulble checked the jar file created, MuchCoolerTableDTO.class is there with bells on but when I deploy it to the web server and start the web service up it blows up because it can't find the class defined in the typeAlias definition.

I have had two colleages double check all of the code, there are no spaces or typos, everything for MuchCoolerTable classes is exactly like CoolTable. Has anyone seen this issue? ring any bells? I am banging my head against it for 3 days now.

Was it helpful?

Solution

Figured out what the issue was .. thanks to all who posed suggestions. Thought I would answer it in the event someone else comes looking for the same problem.

The ClassNotFoundException is confusing because the CLASS is THERE. The problem is that you MUST start with a barebones DTO, declare your members to ONLY match the columns in the database then create exact setters and getters for those members.

It only takes one of them to be slightly off for it to result in ClassNotFoundException. Hope this saves someone some time in the future!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top