Is it correct behavior to hide error ? java.lang.NoClassDefFoundError on creating bean 'casSamlServiceSuccessView'

515 views
Skip to first unread message

Yuriy Larin

unread,
Oct 30, 2012, 2:53:14 PM10/30/12
to cas-...@lists.jasig.org
Hi guys.
I don't know if someone else has encountered such error, so I wanted to know is it correct behavior?

Today I struggled with weird error trying to run CAS server with custom classes and libs.

1.
I was getting error in browser with following stack:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'casSamlServiceSuccessView': Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.jasig.cas.web.view.Saml10SuccessResponseView
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:894)
	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
.....

root cause 

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'casSamlServiceSuccessView': Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.jasig.cas.web.view.Saml10SuccessResponseView

	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:997)
.....


All resources in internet say the java.lang.NoClassDefFoundError usually means there is hidden exception somewhere in :
static {...} block.
So I tried to patch local sources in class:

org.jasig.cas.web.view.AbstractSaml10ResponseView.java
..........
    static {
        try {
            // Initialize OpenSAML default configuration
            // (only needed once per classloader)
            DefaultBootstrap.bootstrap();
        } catch (final ConfigurationException e) {
            throw new IllegalStateException("Error initializing OpenSAML library.", e);
        } catch (Exception e) { // ADDED BY ME
            e.printStackTrace();
        }
    }

And I found the the actual reason finally. Stack trace showed me:
2012-10-30 16:59:21,435 INFO [org.jasig.cas.web.flow.InitialFlowSetupAction] - <Setting path for cookies to: /cas/> java.lang.UnsupportedOperationException: This parser does not support specification "null" version "null" at javax.xml.parsers.DocumentBuilderFactory.setSchema(DocumentBuilderFactory.java:561) at org.opensaml.xml.parse.BasicParserPool.initializePool(BasicParserPool.java:510) at org.opensaml.xml.parse.BasicParserPool.<init>(BasicParserPool.java:138) at org.opensaml.xml.XMLConfigurator.<init>(XMLConfigurator.java:87) at org.opensaml.xml.XMLConfigurator.<init>(XMLConfigurator.java:73) at org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:195) at org.opensaml.DefaultBootstrap.bootstrap(DefaultBootstrap.java:91) at org.jasig.cas.web.view.AbstractSaml10ResponseView.<clinit>(AbstractSaml10ResponseView.java:84) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:76)
........

2.
Farther investigation took me to following topic in:

So I had to remove several jars (like xercesImpl-2.xx.jar, xml-apis-1.xx.jar, xmlParserAPIs-xxx.jar) with old org.apache.xerces.parsers implementations from /WEB-INF/lib/ to run it properly.

So I'm post that solution here with my question.

Thanks,
Yuriy.
-- 
You are currently subscribed to cas-...@lists.jasig.org as: jasig-cas-user...@googlegroups.com
To unsubscribe, change settings or access archives, see http://www.ja-sig.org/wiki/display/JSG/cas-user
Reply all
Reply to author
Forward
0 new messages