Foros del Web » Programación para mayores de 30 ;) » Java »

error with RMI + SpringSecurity

Estas en el tema de error with RMI + SpringSecurity en el foro de Java en Foros del Web. Hi people I am programming using spring(spring security in this case) with RMI... in this proyecto i have to vinculate spring security with RMI but ...
  #1 (permalink)  
Antiguo 26/10/2009, 09:40
 
Fecha de Ingreso: octubre-2009
Mensajes: 1
Antigüedad: 14 años, 6 meses
Puntos: 0
error with RMI + SpringSecurity

Hi people
I am programming using spring(spring security in this case) with RMI...
in this proyecto i have to vinculate spring security with RMI
but when i try to do this get this error

Cita:
26-oct-2009 10:19:47 org.apache.catalina.core.StandardContext listenerStart
GRAVE: Excepción enviando evento inicializado de contexto a instancia de escuchador de clase org.springframework.web.context.ContextLoaderListe ner
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.remoting.rmi.RmiServiceExport er#0' defined in class path resource [cu/uci/serwap/services/services/config/rmi-config.xml]: Invocation of init method failed; nested exception is org.springframework.security.AuthenticationCredent ialsNotFoundException: An Authentication object was not found in the SecurityContext
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1337)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:473)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 64)
at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:221)
at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:261 )
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:429)
at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:729)
at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:381)
at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 45)
at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:3827)
at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4334)
at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:719)
at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:443)
at org.apache.catalina.core.StandardService.start(Sta ndardService.java:516)
at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalin a.java:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:413)
Caused by: org.springframework.security.AuthenticationCredent ialsNotFoundException: An Authentication object was not found in the SecurityContext
at org.springframework.security.intercept.AbstractSec urityInterceptor.credentialsNotFound(AbstractSecur ityInterceptor.java:342)
at org.springframework.security.intercept.AbstractSec urityInterceptor.beforeInvocation(AbstractSecurity Interceptor.java:254)
at org.springframework.security.intercept.method.aopa lliance.MethodSecurityInterceptor.invoke(MethodSec urityInterceptor.java:63)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy0.toString(Unknown Source)
at java.lang.String.valueOf(Unknown Source)
at java.lang.StringBuffer.append(Unknown Source)
at org.springframework.remoting.rmi.RmiBasedExporter. getObjectToExport(RmiBasedExporter.java:59)
at org.springframework.remoting.rmi.RmiServiceExporte r.prepare(RmiServiceExporter.java:268)
at org.springframework.remoting.rmi.RmiServiceExporte r.afterPropertiesSet(RmiServiceExporter.java:227)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1368)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1334)
... 30 more
26-oct-2009 10:19:47 org.apache.catalina.core.ApplicationContext log

here i have my web.xml

Cita:
<listener>
<listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>
</listener>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:com/core/exceptions/config/exceptions-config.xml
classpath:com/business/config/business-config.xml
classpath:com/services/config/rmi-config.xml
classpath:com/core/security/security-config.xml
</param-value>
</context-param>

<!--
- Location of the Log4J config file, for initialization and refresh checks.
- Applied by Log4jConfigListener.
-->
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:config/log4j.xml</param-value>
</context-param>

<listener>
<listener-class>org.springframework.web.util.Log4jConfigList ener</listener-class>
</listener>
this is my security-config.xml

Cita:

<bean id="authenticationManager" class="org.springframework.security.providers.Prov iderManager">
<property name="providers">
<list>
<ref bean="daoAuthenticationProvider" />
</list>
</property>
</bean>


<bean id="daoAuthenticationProvider"
class="org.springframework.security.providers.dao. DaoAuthenticationProvider">
<property name="userDetailsService" ref="authenticationDao">
</property>
<property name="passwordEncoder">
<bean class="org.springframework.security.providers.enco ding.PlaintextPasswordEncoder" />
</property>
<property name="userCache">
<bean class="org.springframework.security.providers.dao. cache.EhCacheBasedUserCache">
<property name="cache" ref="ehcache" />
</bean>
</property>
</bean>

<bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheFa ctoryBean">
<property name="cacheManager" ref="cacheManager" />
<property name="cacheName" value="userCache" />
</bean>

<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheMa nagerFactoryBean">
<property name="configLocation" value="classpath:cu/uci/serwap/services/core/cache/ehcache.xml" />
</bean>


<bean id="authenticationDao" class="org.springframework.security.userdetails.jd bc.JdbcDaoImpl">
<!-- here goes the conecction with the database -->
</bean>

<bean id="accessDecisionManager" class="org.springframework.security.vote.Affirmati veBased">
<property name="allowIfAllAbstainDecisions" value="false" />
<property name="decisionVoters">
<list>
<ref bean="roleVoter"/>
</list>
</property>
</bean>

<bean id="roleVoter" class="org.springframework.security.vote.RoleVoter ">
<property name="rolePrefix" value="ROLE_" />
</bean>


<bean id="methodSecurityInterceptor"
class="org.springframework.security.intercept.meth od.aopalliance.MethodSecurityInterceptor">
<property name="authenticationManager" ref="authenticationManager" />
<property name="accessDecisionManager" ref="accessDecisionManager" />
<property name="objectDefinitionSource">
<value>
com.services.push.implement.push.*=ROLE_ADMIN
</value>
</property>
</bean>

<bean id="autoProxyCreator"
class="org.springframework.aop.framework.autoproxy .BeanNameAutoProxyCreator">
<property name="beanNames">
<list>
<value>pushRMI</value>
</list>
</property>
<property name="interceptorNames">
<list>
<value>methodSecurityInterceptor</value>
</list>
</property>
</bean>
and finally my xml when i publish my rmi service

Cita:
<bean id="pushRMI" class="com.services.push.implement.pushRMI">
<property name="service" ref="pushService"/>
</bean>

<bean id="ServiceRMI" class="org.springframework.remoting.rmi.RmiService Exporter">
<property name="serviceName" value="pushRMI"/>
<property name="service" ref="pushRMI"/>
<property name="serviceInterface" value="com.services.push.interfaces.IpushRMI" />
<property name="registryPort" value="1234"/>
</bean>
if anyone can help, i will thank....

Última edición por kresnik; 26/10/2009 a las 14:22
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:48.