is it possible to use class.forname to load a class that exists within a module wired up with Spring?

I have two maven modules and a need for class A in module 1 to load class B in module 2 using class.forname. this works very well and I can call the right methods on class B no problem at all. module 1 is wired up using spring and I'd like to wire module 2 up in the same way for consistency. I tried this and compiled it up no issue. but when I try to run the code I get so many problems. First that it can't find various spring classes such as ApplicationContext. The dependencies exist in module 2's pom. to solve the problem I had to add all the spring jar's to my lib folder in JBoss.

Once they're added it seems to clear those issues, but then I get the following issue:-

org.springframework.beans.FatalBeanException: Class [org.springframework.beans.factory.xml.UtilNamespaceHandler] for namespace [http://www.springframework.org/schema/util] does not implement the [org.springframework.beans.factory.xml.NamespaceHandler] interface

and I can't understand why. Is what I am trying to do achieveable?

1
задан mhaller 26 September 2010 в 22:17
поделиться