No bean named 'parserPool' is defined spring security - java

while integrating Spring Security SAML Extension with sso getting No bean named 'parserPool' is defined spring security error
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'metadata' defined in ServletContext resource [/WEB-INF/spring-config/spring-security.xml]: Cannot create inner bean 'org.opensaml.saml2.metadata.provider.HTTPMetadataProvider#5b357e7c' of type [org.opensaml.saml2.metadata.provider.HTTPMetadataProvider] while setting constructor argument with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.opensaml.saml2.metadata.provider.HTTPMetadataProvider#5b357e7c' defined in ServletContext resource [/WEB-INF/spring-config/spring-security.xml]: Cannot resolve reference to bean 'parserPool' while setting bean property 'parserPool'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'parserPool' is defined

add
#Bean(initMethod = "initialize")
public StaticBasicParserPool parserPool() {
return new StaticBasicParserPool();
}
I don't do xml configuration but I guess you can easily translate this bean declaration.

In xml just add the bean
<!-- XML parser pool needed for OpenSAML parsing -->
<bean id="parserPool"
class="org.opensaml.xml.parse.StaticBasicParserPool"
init-method="initialize">
<property name="builderFeatures">
<map>
<entry
key="http://apache.org/xml/features/dom/defer-node-expansion"
value="false" />
</map>
</property>

Related

Cannot convert value of type JndiRmiProxyFactoryBean no matching editors or conversion strategy found

In my project, I have configured spring beans as follows. (To get the DataSource via JNDI). And the below configurations worked fine when I used spring 3.2.5 along with hibernate 4.
<bean id="dataSource" class="org.springframework.remoting.rmi.JndiRmiProxyFactoryBean">
<property name="jndiName" value="java:/jdbc/mydb"/>
<property name="serviceInterface" value="javax.sql.DataSource"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean" scope="singleton">
<property name="dataSource" ref="dataSource"/>
<property name="packagesToScan" value="com.abc.core.system_configuration.implGeneral.bean.*"/>
<property name="configLocations" value="implGeneral/sysConfigHibernate.cfg.xml"/>
</bean>
However, now when I try to update Spring to 5.1.8 and Hibernate 5, I get the below error.
Initialization of bean failed;
nested exception is org.springframework.beans.ConversionNotSupportedException:
Failed to convert property value of type 'org.springframework.remoting.rmi.JndiRmiProxyFactoryBean' to required type 'javax.sql.DataSource' for property 'dataSource';
nested exception is java.lang.IllegalStateException: Cannot convert value of type 'org.springframework.remoting.rmi.JndiRmiProxyFactoryBean' to required type 'javax.sql.DataSource' for property 'dataSource': no matching editors or conversion strategy found.
why org.springframework.remoting.rmi.JndiRmiProxyFactoryBean cant be casted to javax.sql.DataSource . Does anyone have an idea on this?
UPDATED:
complete error log is as follows
13:59:30,939 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Bean instantiation via factory method failed;
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ruleCacheControler' defined in class path resource [implGeneral/spring-config-systemconfig.xml]: Cannot resolve reference to bean 'ruleHibernatePersister' while setting constructor argument;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ruleHibernatePersister' defined in class path resource [implGeneral/spring-config-systemconfig.xml]: Cannot resolve reference to bean 'sessionFactory' while setting constructor argument;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [implGeneral/spring-config-systemconfig.xml]: Initialization of bean failed;
nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.springframework.remoting.rmi.JndiRmiProxyFactoryBean' to required type 'javax.sql.DataSource' for property 'dataSource';
nested exception is java.lang.IllegalStateException: Cannot convert value of type 'org.springframework.remoting.rmi.JndiRmiProxyFactoryBean' to required type 'javax.sql.DataSource' for property 'dataSource': no matching editors or conversion strategy found

Java8 upgrade done from Java6 and Tomcat7.0 to Tomcat8.0 >bean creation Exception

I'm having issue while upgrading JAVA8 from Java6 and Tomcat7.0 to Tomcat8.0. Before I'm having Spring source suite tool development tool. hibernate3 jar file is used I'm having below issue.
Please let me know which hibernate jar files it will support and other jar files?
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'desecn' defined in ServletContext resource
[/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean
'itracProps' while setting bean property 'icProps';
nested exception is org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'itracProps' defined in ServletContext
resource [/WEB-INF/applicationContext.xml]: Invocation of init method
failed;
nested exception is java.lang.NullPointerException.
WEB-INF/Application-context.xml file:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE beans
PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- COMMON CLASS -->
<bean id="desecn" class="com.appfoundation.itrac3.misc.DesEncrypter">
<property name="icProps" ref="icProps" />
</bean>
<bean id="utility" class="com.appfoundation.itrac3.misc.Utility">
<property name="icProps" ref="icProps"/>
<property name="desecn" ref="desecn"/>
</bean>
<!-- Precept Migration - init method is placed to get Servlet Context from Spring Web Application Context -->
<bean id="icProps" class="com.appfoundation.itrac3.misc.ItProperties" init-method="loadProperties"/>

neo4j allow_store_upgrade causing application not to start

I am trying to setup a spring project with neo4j. However, when I run the application it does not start up and give the following exception:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'videoRepository': Cannot resolve reference to bean 'neo4jTemplate' while setting bean property 'neo4jTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.data.neo4j.config.Neo4jConfiguration#0': Cannot resolve reference to bean 'graphDatabaseService' while setting bean property 'graphDatabaseService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'graphDatabaseService' defined in class path resource [spring/neo4j.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.neo4j.kernel.EmbeddedGraphDatabase]: Constructor threw exception; nested exception is java.lang.RuntimeException: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.impl.transaction.XaDataSourceManager#147e32a' was successfully initialized, but failed to start. Please see attached cause exception.
org.neo4j.kernel.impl.storemigration.StoreUpgrader$UnableToUpgradeException: Not all store files match the version required for successful upgrade
Here is my neo4j.xml
<neo4j:repositories base-package="neo4j.repository"/>
<neo4j:config graphDatabaseService="graphDatabaseService"/>
<bean id="graphDatabaseService" class="org.neo4j.kernel.EmbeddedGraphDatabase" destroy-method="shutdown">
<constructor-arg value="C:/Users/mario/Documents/Neo4j/default.graphdb"/>
<constructor-arg>
<map>
<entry key="allow_store_upgrade" value="true"/>
</map>
</constructor-arg>
</bean>
I am assuming that this problem is caused by allow_store_upgrade. If I remove or set this property to false a exception is thrown suggesting to me to set it to true. What is really causing this problem and how can I fix it?

No bean named authenticationManager [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Getting error org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘springSecurityFilterChain’ is defined
In my Spring Application, I keep getting this error:
No bean named 'org.springframework.security.authenticationManager' is defined: Did you forget to add a gobal <authentication-manager> element to your configuration (with child <authentication-provider> elements)? Alternatively you can use the authentication-manager-ref attribute on your <http> and <global-method-security> elements.
In my Spring Security context xml file, I have defined the following:
<beans:bean id="myUserDetailsService" class="com.myProject.core.security.MyUserDetailsService" />
<beans:bean id="encoder" class="com.myProject.core.security.HmacPasswordEncoder" />
<authentication-manager id="clientAuthenticationManager" >
<authentication-provider user-service-ref="myUserDetailsService">
<password-encoder ref="encoder" />
</authentication-provider>
</authentication-manager>
Any ideas why its complaining, when I have clearly defined my authentication-manager and authentication-provider?
Note: this might help, its a more descriptive error:
org.springframework.beans.factory.BeanCreationException: Error creating bean with
name 'org.springframework.security.filterChains': Cannot resolve reference to bean
'org.springframework.security.web.DefaultSecurityFilterChain#2' while setting bean
property 'sourceList' with key [2]; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#2':
Cannot resolve reference to bean 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0'
while setting constructor argument with key [1]; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with
name 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0':
Cannot resolve reference to bean 'org.springframework.security.authentication.ProviderManager#0'
while setting bean property 'authenticationManager'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with
name 'org.springframework.security.authentication.ProviderManager#0': Cannot resolve
reference to bean 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0'
while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0':
FactoryBean threw exception on object creation; nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named
'org.springframework.security.authenticationManager' is defined: Did you forget to
add a gobal <authentication-manager> element to your configuration (with child
<authentication-provider> elements)? Alternatively you can use the authentication-manager-ref
attribute on your <http> and <global-method-security> elements.
The authenticationManager is looked up by name, so just change it to the following:
<authentication-manager alias="authenticationManager">
<authentication-provider user-service-ref="myUserDetailsService">
<password-encoder ref="encoder" />
</authentication-provider>
</authentication-manager>
You need to change your Spring Security Context file to look for the clientAuthenticationManager. You can add this line to your http setup
<http use-expressions="true" authentication-manager-ref="clientAuthenticationManger">
Look at this link:
Getting error org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'springSecurityFilterChain' is defined
Notice that the filter is actually a DelegatingFilterProxy, and not
the class that will actually implement the logic of the filter. What
DelegatingFilterProxy does is delegate the Filter's methods through to
a bean which is obtained from the Spring application context.
...
You need to define a bean named springSecurityFilterChain that
implements javax.servlet.Filter in your application context.

Getting unknown exception when implementing ServletWrappingController

I've been working on implementing the ServletWrappingController method and I'm having a few issues. Here's my config...
<!-- Setup Spring ServletWrappers -->
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/spellchecker/google-spellchecker.do">tinyMCESpellCheckerWrappingController</prop>
</props>
</property>
</bean>
<bean id="tinyMCESpellCheckerWrappingController" class="org.springframework.web.servlet.mvc.ServletWrappingController">
<property name="servletClass">
<value>org.tinymce.spellchecker.TinyMCESpellCheckerServlet</value>
</property>
<property name="servletName">
<value>doPost</value>
</property>
</bean>
I'm getting a few exceptions...
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMapping' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tinyMCESpellCheckerWrappingController' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.InstantiationException
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tinyMCESpellCheckerWrappingController' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.InstantiationException
I don't see an error message here so I'm unsure where to begin debugging to determine the cause...
I just checked your other post and it seems the class TinyMCESpellCheckerServlet is an abstract class which caused this issue on trying instantiating this class.

Categories

Resources