Wednesday, 18 March 2009

Grails Openid plugin and Xerces

I just created a grails 1.1 application, and installed the openid plugin. When starting the application, I got the following exception:

2009-03-17 22:25:41,090 [main] ERROR context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'consumerManager': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.openid4java.consumer.ConsumerManager]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/xerces/parsers/DOMParser
at Method)
Caused by: java.lang.NoClassDefFoundError: org/apache/xerces/parsers/DOMParser
at org.openid4java.discovery.Discovery.(
at org.openid4java.consumer.ConsumerManager.(
... 21 more

I worked around this by dropping xercesImpl-2.6.2.jar in the lib directory of my grails app. This seems to work - I've successfully logged in via my yahoo openid account.

I haven't looked any further into this - time is short already, but I hope this helps you if you stumble across this problem.