antalk / Tapestry-Spring-Security

A Tapestry 5.3.x spring based security library
11 stars 6 forks source link

Error #1

Closed tnodev closed 12 years ago

tnodev commented 12 years ago

Hi ! I'm using your package to move to T5.3 but I have an error.

Did I miss something ?

Thanks Tom

ERROR 20:45:09.251 Error invoking method public static org.springframework.security.web.authentication.RememberMeServices nu.localhost.tapestry5.springsecurity.services.SecurityModule.build(org.springframework.security.core.userdetails.UserDetailsService,java.lang.String): org.springframework.util.ReflectionUtils.findMethod(Ljava/lang/Class;Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;  (OperationTrackerImpl.java:127) 
ERROR 20:45:09.252 Operations trace:  (OperationTrackerImpl.java:128) 
ERROR 20:45:09.252 [ 1] Realizing service RememberMeServices  (OperationTrackerImpl.java:137) 
ERROR 20:45:09.253 [ 2] Instantiating service RememberMeServices implementation via nu.localhost.tapestry5.springsecurity.services.SecurityModule.build(UserDetailsService, String) (at SecurityModule.java:295)  (OperationTrackerImpl.java:137) 
ERROR 20:45:09.253 [ 3] Constructing service implementation via nu.localhost.tapestry5.springsecurity.services.SecurityModule.build(UserDetailsService, String) (at SecurityModule.java:295)  (OperationTrackerImpl.java:137) 
ERROR 20:45:09.258 Construction of service RememberMeServices failed: Error invoking method public static org.springframework.security.web.authentication.RememberMeServices nu.localhost.tapestry5.springsecurity.services.SecurityModule.build(org.springframework.security.core.userdetails.UserDetailsService,java.lang.String): org.springframework.util.ReflectionUtils.findMethod(Ljava/lang/Class;Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;  (RecursiveServiceCreationCheckWrapper.java:64) 
org.apache.tapestry5.ioc.internal.OperationException: Error invoking method public static org.springframework.security.web.authentication.RememberMeServices nu.localhost.tapestry5.springsecurity.services.SecurityModule.build(org.springframework.security.core.userdetails.UserDetailsService,java.lang.String): org.springframework.util.ReflectionUtils.findMethod(Ljava/lang/Class;Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
antalk commented 12 years ago

Hi,

Are you including the module in your own Tapestry App ? Then i would search for other Spring dependencies which are added to the classpath through maven and conflict in some way.

arterzatij commented 12 years ago

Hi, I´m getting this exception could you helpme?

Do you have an example with this new version...

java.lang.IllegalArgumentException: Contribution com.rimsamex.app.security.services.AuthenticationModule.contributeProviderManager(Ordered Configuration, AuthenticationProvider) (at AuthenticationModule.java:39) is for service 'ProviderManager', which does not exist. at org.apache.tapestry5.ioc.internal.RegistryImpl.validateContributeDefs(RegistryImpl.java:238) at org.apache.tapestry5.ioc.internal.RegistryImpl.(RegistryImpl.java:202) at org.apache.tapestry5.ioc.RegistryBuilder.build(RegistryBuilder.java:177) at org.apache.tapestry5.internal.TapestryAppInitializer.createRegistry(TapestryAppInitializer.java:200) at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:109) at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:653) at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1239) at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517) at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:466) at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:124) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152) at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.jetty.Server.doStart(Server.java:222) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132) at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:441) at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:383) at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:210) at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) 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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) 2012-03-22 18:01:50.230::INFO: Started SelectChannelConnector@0.0.0.0:8090

antalk commented 12 years ago

Looks like again a maven dependency issue.

ProviderManager is part of the spring-security-core package which is included as dependency on spring-security-web. Tapestry Spring Security only depends on spring-security-web and have Maven resolve the other required libraries. Maybe your project does not define the correct dependencies, exclude some or is missing this jar ?!

If you run 'mvn dependency:list' from the commandline on your project, does it display the spring-core jar ?

arterzatij commented 12 years ago

Hi,

This is the dependecy list for my project and its display the spring-core jar:

[INFO] org.springframework:spring-aop:jar:3.1.0.RELEASE:compile [INFO] org.springframework:spring-asm:jar:3.1.0.RELEASE:compile [INFO] org.springframework:spring-beans:jar:3.1.0.RELEASE:compile [INFO] org.springframework:spring-context:jar:3.1.0.RELEASE:compile [INFO] org.springframework:spring-core:jar:3.1.0.RELEASE:compile [INFO] org.springframework:spring-expression:jar:3.1.0.RELEASE:compile [INFO] org.springframework:spring-jdbc:jar:3.0.6.RELEASE:compile [INFO] org.springframework:spring-tx:jar:3.0.6.RELEASE:compile [INFO] org.springframework:spring-web:jar:3.1.0.RELEASE:compile [INFO] org.springframework.security:spring-security-core:jar:3.1.0.RELEASE:compile [INFO] org.springframework.security:spring-security-crypto:jar:3.1.0.RELEASE:compile [INFO] org.springframework.security:spring-security-web:jar:3.1.0.RELEASE:compile

The project example from localhost.nu should works with this current version, I mean the AppModule should be changed or I can keep it as is?

antalk commented 12 years ago

My bad,

The new SecurityModule creates an AuthenticationManager iso ProviderManager see:

@Marker( SpringSecurityServices.class ) public static AuthenticationManager buildAuthenticationManager( final List providers ) throws Exception {

    final ProviderManager manager = new ProviderManager(providers);
    manager.afterPropertiesSet();
    return manager;
}

So you'll have to contribute to the AuthenticationManager interface

arterzatij commented 12 years ago

Thanks, it was the problem...

drsoares commented 10 years ago

Hi all, can you post here how the AppModule should look like? I have the same problem. Im usign tapestry-spring-security 4.2.0.

arterzatij commented 10 years ago
public static UserDetailsService buildUserDetailsService(
        @Inject LoginService loginService, @Inject PasswordEncoder encoder,
        @Inject SaltSource salt) {

    return new AuthenticationService(loginService, encoder, salt);
}

public static void contributeAuthenticationManager(
        OrderedConfiguration<AuthenticationProvider> configuration,
        @InjectService("DaoAuthenticationProvider") AuthenticationProvider daoAuthenticationProvider) {

    configuration.add("daoAuthenticationProvider",
            daoAuthenticationProvider);

}