First off, I have seen others in the past (2007) have similar issues but it
did not seem to match the problem I am experiencing. I am working on a
rebuild of our SSO environment using best practices and an HA approach. I
was in the process of implementing the Argument Extractor for our Google
Apps domain and came across this issue (using MVN overlay per best practices
on version 3.4.11):

 

org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'googleAccountsArgumentExtractor' defined in ServletContext
resource
[/WEB-INF/spring-configuration/argumentExtractorsConfiguration.xml]: Cannot
resolve reference to bean 'privateKeyFactoryBean' while setting bean
property 'privateKey'; nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
named 'privateKeyFactoryBean' is defined

 

A sample of my argumentExtractorsConfiguration.xml is as follows:

 

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans";

       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

       xmlns:p="http://www.springframework.org/schema/p";

       xmlns:util="http://www.springframework.org/schema/util";

       xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

       http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.0.xsd";>

        <description>

                Argument Extractors are what are used to translate HTTP
requests into requests of the appropriate protocol (i.e. CAS, SAML, SAML2,

                OpenId, etc.).  By default CAS and SAML are enabled.

        </description>

        <bean

                id="casArgumentExtractor"

                class="org.jasig.cas.web.support.CasArgumentExtractor"

                 p:httpClient-ref="httpClient" />

 

        <bean id="samlArgumentExtractor"
class="org.jasig.cas.web.support.SamlArgumentExtractor"

                p:httpClient-ref="httpClient" />

 

        <bean

                name="googleAccountsArgumentExtractor"

 
class="org.jasig.cas.web.support.GoogleAccountsArgumentExtractor"

                p:httpClient-ref="httpClient"

                p:privateKey-ref="privateKeyFactoryBean"

                p:publicKey-ref="publicKeyFactoryBean"

                p:alternateUsername="EmailAddress"

                />

 

        <util:list id="argumentExtractors">

                <ref bean="casArgumentExtractor" />

                <ref bean="samlArgumentExtractor" />

                <ref bean="googleAccountsArgumentExtractor" />

        </util:list>

 

        <bean

                id="privateKeyFactoryBean"

                class="org.jasig.cas.util.PrivateKeyFactoryBean"

                p:location="classpath:private.p8"

                p:algorithm="RSA" />

 

        <bean

                id="publicKeyFactoryBean"

                class="org.jasig.cas.util.PublicKeyFactoryBean"

                p:location="classpath:public.key"

                p:algorithm="RSA" />

 

</beans>

 

 

I've generated the certificates and uploaded the x509.pem per the
documentation here:
https://wiki.jasig.org/display/CASUM/SAML+2.0+%28Google+Accounts+Integration
%29.

The snippet of the certificate creation is:

openssl genrsa -out private.key 1024

openssl rsa -pubout -in private.key -out public.key -inform PEM -outform DER

openssl pkcs8 -topk8 -inform PER -outform DER -nocrypt -in private.key -out
private.p8

openssl req -new -x509 -key private.key -out x509.pem -days 365

 

 

 

I am using the Maven Overlay method, so this file exists in
src/main/webapp/WEB-INF/spring-configuration/ and is copied into the war
when I do a mvn clean package. I also have placed the certificates in the
src/main/webapp/WEB-INF/classes/ directory.

 

Any ideas on how to approach this error? Also, if I copy my config from my
current production machine, I also receive the same error. The complete
error can be found below.

 

 

Regards,

Patrick

 

 

 

 

The Spring ContextLoaderListener we wrap threw on contextInitialized.

But for our having caught this error, the web application context would not
have initialized.

org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'googleAccountsArgumentExtractor' defined in ServletContext
resource
[/WEB-INF/spring-configuration/argumentExtractorsConfiguration.xml]: Cannot
resolve reference to bean 'privateKeyFactoryBean' while setting bean
property 'privateKey'; nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
named 'privateKeyFactoryBean' is defined

        at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eReference(BeanDefinitionValueResolver.java:328)

        at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eValueIfNecessary(BeanDefinitionValueResolver.java:106)

        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)

        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.populateBean(AbstractAutowireCapableBeanFactory.java:1086)

        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)

        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.createBean(AbstractAutowireCapableBeanFactory.java:456)

        at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(Ab
stractBeanFactory.java:291)

        at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSi
ngleton(DefaultSingletonBeanRegistry.java:222)

        at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(Abst
ractBeanFactory.java:288)

        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstra
ctBeanFactory.java:190)

        at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInst
antiateSingletons(DefaultListableBeanFactory.java:580)

        at
org.springframework.context.support.AbstractApplicationContext.finishBeanFac
toryInitialization(AbstractApplicationContext.java:895)

        at
org.springframework.context.support.AbstractApplicationContext.refresh(Abstr
actApplicationContext.java:425)

        at
org.springframework.web.context.ContextLoader.createWebApplicationContext(Co
ntextLoader.java:276)

        at
org.springframework.web.context.ContextLoader.initWebApplicationContext(Cont
extLoader.java:197)

        at
org.springframework.web.context.ContextLoaderListener.contextInitialized(Con
textLoaderListener.java:47)

        at
org.jasig.cas.web.init.SafeContextLoaderListener.contextInitialized_aroundBo
dy0(SafeContextLoaderListener.java:62)

        at
org.jasig.cas.web.init.SafeContextLoaderListener.contextInitialized_aroundBo
dy1$advice(SafeContextLoaderListener.java:44)

        at
org.jasig.cas.web.init.SafeContextLoaderListener.contextInitialized(SafeCont
extLoaderListener.java:1)

        at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:
4206)

        at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)

        at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:7
99)

        at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)

        at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)

        at
org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)

        at
org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:778)

        at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:504)

        at
org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)

        at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)

        at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
t.java:142)

        at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)

        at
org.apache.catalina.core.StandardHost.start(StandardHost.java:840)

        at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)

        at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)

        at
org.apache.catalina.core.StandardService.start(StandardService.java:525)

        at
org.apache.catalina.core.StandardServer.start(StandardServer.java:754)

        at org.apache.catalina.startup.Catalina.start(Catalina.java:595)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57
)

        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:43)

        at java.lang.reflect.Method.invoke(Method.java:601)

        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)

        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:
No bean named 'privateKeyFactoryBean' is defined

        at
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean
Definition(DefaultListableBeanFactory.java:527)

        at
org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocal
BeanDefinition(AbstractBeanFactory.java:1083)

        at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(Abst
ractBeanFactory.java:274)

        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstra
ctBeanFactory.java:190)

        at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eReference(BeanDefinitionValueResolver.java:322)

        ... 42 more

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to