[midPoint] Error creating bean with name 'keyStoreFactory'

Pavol Mederly pavol.mederly at evolveum.com
Thu Aug 18 18:31:53 CEST 2016


Matt, 

from the logfile it is clear. The reason is that midPoint needs some other configuration parameters besides repository configuration. In particular, this error is caused by missing keyStorePath parameter. 
(I'll fix midPoint to produce more meaningful error message.) 

So, your whole config file should look like this: 

<configuration> 
<midpoint> 
<webApplication> 
<importFolder>${midpoint.home}/import</importFolder> 
</webApplication> 
<repository> 
< repositoryServiceFactoryClass >com.evolveum.midpoint.repo.sql.SqlRepositoryFactory</ repositoryServiceFactoryClass > 
< database >mysql</ database > 
< jdbcUsername >midpoint</ jdbcUsername > 
< jdbcPassword >password</ jdbcPassword > 
< jdbcUrl >jdbc:mysql://localhost:3306/midpoint?characterEncoding=utf8</ jdbcUrl > 
</repository> 
<audit> <!-- select audit service(s) you want: either log-based or DB-based, both, or none --> 
<auditService> 
<auditServiceFactoryClass>com.evolveum.midpoint.audit.impl.LoggerAuditServiceFactory</auditServiceFactoryClass> 
</auditService> 
<auditService> 
<auditServiceFactoryClass>com.evolveum.midpoint.repo.sql.SqlAuditServiceFactory</auditServiceFactoryClass> 
</auditService> 
</audit> 
<icf> 
<scanClasspath>true</scanClasspath> 
<scanDirectory>${midpoint.home}/icf-connectors</scanDirectory> 
</icf> 
<keystore> 
<keyStorePath>${midpoint.home}/keystore.jceks</keyStorePath> 
<keyStorePassword>changeit</keyStorePassword> 
<encryptionKeyAlias>default</encryptionKeyAlias> 
</keystore> 
</midpoint> 
</configuration> 

(The wiki page you mentioned deals only with the repository configuration, not with the whole content of config.xml.) 

Hope this helps, 
Pavol 

----- Original Message -----

From: "Matt Mencel" <mr-mencel at wiu.edu> 
To: "midPoint General Discussion" <midpoint at lists.evolveum.com> 
Sent: Thursday, August 18, 2016 5:54:38 PM 
Subject: Re: [midPoint] Error creating bean with name 'keyStoreFactory' 

Hi Pavel, 

I'll put the full stacktrace below. I think I used the config.xml example from the main Repository Configuration page here.... https://wiki.evolveum.com/display/midPoint/Repository+Configuration 

I modified the config.xml to look like the MySQL example you gave. Seems I'm getting a similar if not the same error. 


This is the full stacktrace from my original config.xml.... 


2016-08-18 10:38:33,776 [] [localhost-startStop-1] INFO (com.evolveum.midpoint.init.StartupConfiguration): Loading midPoint configuration from file /opt/midpoint/config.xml 
2016-08-18 10:38:34,107 [] [localhost-startStop-1] WARN (org.springframework.web.context.support.XmlWebApplicationContext): Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'keyStoreFactory' defined in class path resource [ctx-configuration.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException 
2016-08-18 10:38:34,125 [] [localhost-startStop-1] ERROR (org.springframework.web.context.ContextLoader): Context initialization failed 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'keyStoreFactory' defined in class path resource [ctx-configuration.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444) ~[spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326) ~[spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) [spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4716) [catalina.jar:8.5.4] 
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5178) [catalina.jar:8.5.4] 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152) [catalina.jar:8.5.4] 
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724) [catalina.jar:8.5.4] 
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700) [catalina.jar:8.5.4] 
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) [catalina.jar:8.5.4] 
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952) [catalina.jar:8.5.4] 
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823) [catalina.jar:8.5.4] 
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_101] 
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_101] 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_101] 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_101] 
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_101] 
Caused by: java.lang.NullPointerException: null 
at java.io.File.<init>(File.java:277) ~[na:1.8.0_101] 
at com.evolveum.midpoint.init.ConfigurableProtectorFactory.init(ConfigurableProtectorFactory.java:55) ~[system-init-3.4.jar:na] 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_101] 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_101] 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_101] 
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_101] 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1706) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1645) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
... 25 common frames omitted 


This is the full stacktrace using the config.xml with the mysql db details in it. 

2016-08-18 10:51:23,453 [] [localhost-startStop-1] INFO (com.evolveum.midpoint.init.StartupConfiguration): Loading midPoint configuration from file /opt/midpoint/config.xml 
2016-08-18 10:51:23,779 [] [localhost-startStop-1] WARN (org.springframework.web.context.support.XmlWebApplicationContext): Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'keyStoreFactory' defined in class path resource [ctx-configuration.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException 
2016-08-18 10:51:23,798 [] [localhost-startStop-1] ERROR (org.springframework.web.context.ContextLoader): Context initialization failed 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'keyStoreFactory' defined in class path resource [ctx-configuration.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444) ~[spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326) ~[spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) [spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4716) [catalina.jar:8.5.4] 
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5178) [catalina.jar:8.5.4] 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152) [catalina.jar:8.5.4] 
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724) [catalina.jar:8.5.4] 
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700) [catalina.jar:8.5.4] 
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) [catalina.jar:8.5.4] 
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952) [catalina.jar:8.5.4] 
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823) [catalina.jar:8.5.4] 
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_101] 
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_101] 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_101] 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_101] 
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_101] 
Caused by: java.lang.NullPointerException: null 
at java.io.File.<init>(File.java:277) ~[na:1.8.0_101] 
at com.evolveum.midpoint.init.ConfigurableProtectorFactory.init(ConfigurableProtectorFactory.java:55) ~[system-init-3.4.jar:na] 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_101] 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_101] 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_101] 
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_101] 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1706) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1645) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
... 25 common frames omitted 


On Thu, Aug 18, 2016 at 10:39 AM, Pavol Mederly < pavol.mederly at evolveum.com > wrote: 



Hello Matt, 

it seems to me that the real reason of the problem is written in the log just a few lines under the text you've posted. Please, could you send here the whole exception stack trace? 

As for your question: No, it is generally not needed to put the database name into data source name: the data source name can be anything that you consider descriptive enough. What is needed, though, is that the data source should be correctly defined in your application server configuration. (Of course, also with the database name.) 

But using data source is something I would call "advanced use". If you're not familiar with Tomcat data source configuration, I would suggest more straightforward way: configure DB connection directly in midPoint config.xml, like this: 

< configuration > 
< midpoint > 
< repository > 
< repositoryServiceFactoryClass >com.evolveum.midpoint.repo.sql.SqlRepositoryFactory</ repositoryServiceFactoryClass > 
< database >mysql</ database > 
< jdbcUsername >midpoint</ jdbcUsername > 
< jdbcPassword >password</ jdbcPassword > 
< jdbcUrl >jdbc:mysql://localhost:3306/midpoint?characterEncoding=utf8</ jdbcUrl > 
</ repository > 
</ midpoint > 
</ configuration > 

Here the database name is "midpoint", and is a part of jdbcUrl. 

You could also check https://wiki.evolveum.com/display/midPoint/MySQL , but beware; this page is quite old and probably needs a little update. 

Hope this helps, 
Pavol 


From: "Matt Mencel" < mr-mencel at wiu.edu > 
To: midpoint at lists.evolveum.com 
Sent: Thursday, August 18, 2016 5:12:11 PM 
Subject: [midPoint] Error creating bean with name 'keyStoreFactory' 


I'm trying to setup Midpoint with a MySQL db. I think I have all the configs right, but I'm getting this error when Tomcat starts. 


<blockquote>
2016-08-17 23:41:15,829 [] [localhost-startStop-1] INFO (com.evolveum.midpoint.init.StartupConfiguration): Loading midPoint configuration from 
file /opt/midpoint/config.xml 
2016-08-17 23:41:16,165 [] [localhost-startStop-1] WARN (org.springframework.web.context.support.XmlWebApplicationContext): Exception encounte 
red during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean w 
ith name 'keyStoreFactory' defined in class path resource [ctx-configuration.xml]: Invocation of init method failed; nested exception is java. 
lang.NullPointerException 
2016-08-17 23:41:16,184 [] [localhost-startStop-1] ERROR (org.springframework.web.context.ContextLoader): Context initialization failed 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'keyStoreFactory' defined in class path resource [ctx-c 
onfiguration.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java 
:1578) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 




etc... 

Here is my config.xml 


<blockquote>
<configuration> 
<midpoint> 
<repository> 
<repositoryServiceFactoryClass>com.evolveum.midpoint.repo.sql.SqlRepositoryFactory</repositoryServiceFactoryClass> 
<embedded>false</embedded> 
<hibernateDialect>com.evolveum.midpoint.repo.sql.util.MidPointMySQLDialect</hibernateDialect> 
<hibernateHbm2ddl>validate</hibernateHbm2ddl> 
<dataSource>java:comp/env/jdbc/mysql</dataSource> 
</repository> 
</midpoint> 
</configuration> 
</blockquote>


Does the dataSource need to have the database name in it? In my case I named the DB 'midpoint'. 

Thanks, 
Matt 

_______________________________________________ 
midPoint mailing list 
midPoint at lists.evolveum.com 
http://lists.evolveum.com/mailman/listinfo/midpoint 


_______________________________________________ 
midPoint mailing list 
midPoint at lists.evolveum.com 
http://lists.evolveum.com/mailman/listinfo/midpoint 


</blockquote>



_______________________________________________ 
midPoint mailing list 
midPoint at lists.evolveum.com 
http://lists.evolveum.com/mailman/listinfo/midpoint 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20160818/4b689114/attachment.htm>


More information about the midPoint mailing list