Spring social /connect return 404 -


i'm trying configure spring social inside (maven)spring mvc secured(spring security) application when try access /connect/ or /connect/providerid , error 404

here glassfish server log when try access:

info:   mapped "{[/connect/{providerid}],methods=[post],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.view.redirectview org.springframework.social.connect.web.connectcontroller.connect(java.lang.string,org.springframework.web.context.request.nativewebrequest) info:   mapped "{[/connect/{providerid}],methods=[delete],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.view.redirectview org.springframework.social.connect.web.connectcontroller.removeconnections(java.lang.string,org.springframework.web.context.request.nativewebrequest) info:   mapped "{[/connect/{providerid}],methods=[get],params=[error],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.view.redirectview org.springframework.social.connect.web.connectcontroller.oauth2errorcallback(java.lang.string,java.lang.string,java.lang.string,java.lang.string,org.springframework.web.context.request.nativewebrequest) info:   mapped "{[/connect/{providerid}/{provideruserid}],methods=[delete],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.view.redirectview org.springframework.social.connect.web.connectcontroller.removeconnection(java.lang.string,java.lang.string,org.springframework.web.context.request.nativewebrequest) info:   mapped "{[/connect],methods=[get],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.string org.springframework.social.connect.web.connectcontroller.connectionstatus(org.springframework.web.context.request.nativewebrequest,org.springframework.ui.model) info:   mapped "{[/connect/{providerid}],methods=[get],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.string org.springframework.social.connect.web.connectcontroller.connectionstatus(java.lang.string,org.springframework.web.context.request.nativewebrequest,org.springframework.ui.model) info:   mapped "{[/connect/{providerid}],methods=[get],params=[oauth_token],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.view.redirectview org.springframework.social.connect.web.connectcontroller.oauth1callback(java.lang.string,org.springframework.web.context.request.nativewebrequest) info:   mapped "{[/connect/{providerid}],methods=[get],params=[code],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.view.redirectview org.springframework.social.connect.web.connectcontroller.oauth2callback(java.lang.string,org.springframework.web.context.request.nativewebrequest) info:   mapped url path [/resources/**] onto handler of type [class org.springframework.web.servlet.resource.resourcehttprequesthandler] info:   looking @controlleradvice: root webapplicationcontext: startup date [thu may 14 16:06:15 pdt 2015]; root of context hierarchy info:   using datasource [org.apache.commons.dbcp2.basicdatasource@65a12534] of hibernate sessionfactory hibernatetransactionmanager info:   creating filter chain: org.springframework.security.web.util.matcher.anyrequestmatcher@1, [org.springframework.security.web.context.request.async.webasyncmanagerintegrationfilter@5b252c00, org.springframework.security.web.context.securitycontextpersistencefilter@22de3dd7, org.springframework.security.web.header.headerwriterfilter@17b3d10, org.springframework.security.web.csrf.csrffilter@2bffe1ad, org.springframework.security.web.authentication.logout.logoutfilter@68a35517, org.springframework.security.web.authentication.usernamepasswordauthenticationfilter@4d85d53d, org.springframework.security.web.savedrequest.requestcacheawarefilter@3d704ff, org.springframework.security.web.servletapi.securitycontextholderawarerequestfilter@57243fe2, org.springframework.security.web.authentication.anonymousauthenticationfilter@53e99103, org.springframework.security.web.session.sessionmanagementfilter@1917c313, org.springframework.security.web.access.exceptiontranslationfilter@7977c9b0, org.springframework.security.web.access.intercept.filtersecurityinterceptor@a742949] info:   root webapplicationcontext: initialization completed in 3718 ms info:   webmodule[null] servletcontext.log():initializing spring frameworkservlet 'dispatcherservlet' info:   frameworkservlet 'dispatcherservlet': initialization started info:   frameworkservlet 'dispatcherservlet': initialization completed in 37 ms info:   loading application [social] @ [/social] info:   social deployed in 6,291 milliseconds. severe:   pwc6117: file "null" not found 

here social config class:

@configuration @enablesocial public class socialconfig implements socialconfigurer {      @autowired     datasource datasource;      @override     public void addconnectionfactories(connectionfactoryconfigurer cfconfig, environment env) {         cfconfig.addconnectionfactory(new linkedinconnectionfactory("consumerkey", "consumersecret"));     }      @override     public usersconnectionrepository getusersconnectionrepository(connectionfactorylocator connectionfactorylocator) {         return new jdbcusersconnectionrepository(datasource, connectionfactorylocator, encryptors.nooptext());     }      @override     public useridsource getuseridsource() {         return new authenticationnameuseridsource();     }      @bean     public connectcontroller connectcontroller(connectionfactorylocator connectionfactorylocator, connectionrepository connectionrepository) {         return new connectcontroller(connectionfactorylocator, connectionrepository);     } } 

here webappliactioninitializer class:

public class webinitializer implements webapplicationinitializer {  @override  public void onstartup(servletcontext servletcontext) throws servletexception {     webapplicationcontext context = getcontext();     servletcontext.addlistener(new contextloaderlistener(context));     servletregistration.dynamic dispatcher = servletcontext.addservlet("dispatcherservlet", new dispatcherservlet(context));     dispatcher.setloadonstartup(1);     dispatcher.addmapping("/"); }   private annotationconfigwebapplicationcontext getcontext() {     annotationconfigwebapplicationcontext context = new annotationconfigwebapplicationcontext();     context.setconfiglocation("com.gfz.social.springmvc.config"); // java package configs     return context; } 

}

i checked pom.xml

<!-- spring social --> <dependency>     <groupid>org.springframework.social</groupid>     <artifactid>spring-social-core</artifactid>         <version>1.1.0.release</version>     </dependency>  <dependency>     <groupid>org.springframework.social</groupid>     <artifactid>spring-social-web</artifactid>     <version>1.1.0.release</version> </dependency>  <dependency>     <groupid>org.springframework.social</groupid>     <artifactid>spring-social-security</artifactid>     <version>1.1.0.release</version> </dependency>  <dependency>     <groupid>org.springframework.social</groupid>     <artifactid>spring-social-config</artifactid>     <version>1.1.0.release</version> </dependency> 

someone can me? (i've tried read reference code , showcase examples) thanks

just guess, happen have views (jsp, thymeleaf, or otherwise) @ "connect/{providerid}connect" or "connect/{providerid}connected"? have view @ "connect/status" ? if not, that's 1 possibility 404s.

the controller method answering @ "/connect" path collects connection status information known providers in app , sends on view named "connect/status". projects (those using jsp), means need jsp file named "status.jsp" in directory named "/connect" (relative views kept).

for provider, you'll need 2 files each provider. example, if you're dealing facebook, you'll request "/connect/facebook" , controller collect connection information , send on view named "connect/facebookconnect" (if don't have connection) or "connect/facebookconnected" (if have connection). means (in jsp case) you'll need jsps @ "/connect/facebookconnect.jsp" , "/connect/facebookconnected.jsp".

take @ https://github.com/spring-projects/spring-social-samples/tree/master/spring-social-showcase. example uses thymeleaf instead of jsp, demonstrates basic idea. you'll find templates in src/main/resources/views/connect. if jsp-viewed application, you'd put them in src/main/webapp or directory underneath src/main/webapp.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -