Wildfly JNDI issue
jak1 Apr 18, 2018 4:23 AMHI Team,
I am trying to migrate Aspose spring application from tomcat to JBOSS, I done successfully JNDI(oracle) connection from Jboss(stanalone).
But while i try to run application i am getting bean initialization issue, But it will run in tomcat server.
Please find below code
Step 1 : ApplicationContext-resource.xml
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="resourceRef" value="false" />
<property name="jndiName" value="java:/comp/env/Coalition_DBSOURCE" />
</bean>
Step 2: applicationContext-dao.xml
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean" destroy-method="destroy">
<property name="dataSource" ref="dataSource"/>
I am getting below exception, it related to initialize JNDI in session factory.
Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext-dao.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource';
13:20:51,172 INFO [org.jboss.as.controller] (management task-4) WFLYCTL0183: Service status report
WFLYCTL0186: Services which failed to start: service jboss.undertow.deployment.default-server.default-host./analytics: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./analytics: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#5' while setting bean property 'sourceList' with key [5]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#5': Cannot create inner bean '(inner bean)' of type [org.springframework.security.web.session.ConcurrentSessionFilter] while setting constructor argument with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#11': Cannot resolve reference to bean 'org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices#0' while setting bean property 'logoutHandlers' with key [2]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices#0': Cannot create inner bean '(inner bean)' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#14': Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [org.springframework.security.core.userdetails.UserDetailsService org.springframework.security.config.http.UserDetailsServiceFactoryBean.cachingUserDetailsService(java.lang.String)] threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext-dao.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Post-processing of the FactoryBean's object failed; nested exception is java.lang.IllegalArgumentException: warning no match for this type name: org.appfuse.dao.hibernate.UserDaoHibernate [Xlint:invalidAbsoluteTypeName]
Please help to fix this issue, Please do needful. Thank's in advance.
Thank you
Javeed