Wednesday, October 10, 2012

java.lang.reflect.MalformedParameterizedTypeException or (WTH is wrong with my deployment now?)

So the fun part of the MalformedParameterizedTypeException error is that it seems to be caused by many different things at least that is the impression that I get from the Google searches I conducted and the various suggestions for a fix offered on StackOverflow. I think it really comes down to a simple incompatible jar file hanging out on your web server.

I'n my case I am using WebLogic and the local version of WL that I have running right now is 10.3.6, the version on my Dev server is 10.3.5; you wouldn't expects that a version that close together would be such trouble but I cost me a day to figure out what's up. First off I still don't know the name and version of whatever jar is causing the trouble in Dev. I don't have the access to sort it out and now that I know the cause... I just wont do it, problem avoided though not solved. Good enough under a tight deadline.

So on to the point!  Lets say your using Spring as I am and you have a DAO that doesn't require a dataSource because it's just not that kind of DAO. So you don't have to inject anything into the object. Well when you define this DAO and you deploy only to get our friend MalformedParameterizedTypeException  popping up, the cause is defining the bean in an abbreviated xml node such as the following:


<bean class="com.myco.webservices.dao.impl.MyDaoImpl" id="myDao"/>

The fix is so simple:  (Note the ending tag)

<bean class="com.myco.webservices.dao.impl.MyDaoImpl" id="myDao"></bean>


Of course finding that issue in a dozen files with multi-line changes, imports of new packages and implementation of new functionality is um... not so easy.