Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Building and using Spring Social example (showcase)

  1. #1
    Join Date
    Sep 2011
    Posts
    5

    Default Building and using Spring Social example (showcase)

    Hi all,
    I've imported the spring-social-showcase project to Eclipse (from here: https://github.com/SpringSource/spring-social-samples).
    While running a Maven build (mvn clean install), I get the following build errors:

    Downloading: http://maven.springframework.org/mil...b-3.1.0.M2.pom
    Downloading: http://repo1.maven.org/maven2/org/sp...b-3.1.0.M2.pom
    Downloading: http://maven.springframework.org/rel...c-3.1.0.M2.pom
    Downloading: http://maven.springframework.org/mil...c-3.1.0.M2.pom
    Downloading: http://repo1.maven.org/maven2/org/sp...c-3.1.0.M2.pom
    Downloading: http://maven.springframework.org/rel...b-3.1.0.M2.pom
    Downloading: http://maven.springframework.org/mil...b-3.1.0.M2.pom
    Downloading: http://repo1.maven.org/maven2/org/sp...b-3.1.0.M2.pom
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 3.214s
    [INFO] Finished at: Wed Sep 21 15:38:59 IDT 2011
    [INFO] Final Memory: 3M/15M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal on project spring-social-showcase: Could not resolve dependencies for project org.springframework.social.samples:spring-social-showcase:war:1.0.0: Failed to collect dependencies for [org.springframework:spring-context:jar:3.1.0.BUILD-SNAPSHOT (compile), org.springframework:spring-webmvc:jar:3.1.0.BUILD-SNAPSHOT (compile), org.springframework:spring-jdbc:jar:3.1.0.BUILD-SNAPSHOT (compile), org.springframework:spring-tx:jar:3.1.0.BUILD-SNAPSHOT (compile), org.springframework.security:spring-security-web:jar:3.1.0.RC3 (compile), org.springframework.security:spring-security-taglibs:jar:3.1.0.RC3 (compile), org.springframework.security:spring-security-config:jar:3.1.0.RC3 (compile), org.springframework.social:spring-social-core:jar:1.0.0.RELEASE (compile), org.springframework.social:spring-social-facebook:jar:1.0.0.RELEASE (compile), org.springframework.social:spring-social-twitter:jar:1.0.0.RELEASE (compile), org.springframework.social:spring-social-web:jar:1.0.0.RELEASE (compile), org.apache.httpcomponents:httpclient:jar:4.1.2 (compile), javax.validation:validation-api:jar:1.0.0.GA (compile), org.hibernate:hibernate-validator:jar:4.1.0.Final (compile), org.slf4j:slf4j-api:jar:1.6.1 (compile), org.slf4j:jcl-over-slf4j:jar:1.6.1 (runtime), org.slf4j:slf4j-log4j12:jar:1.6.1 (runtime), log4j:log4j:jar:1.2.16 (runtime), com.h2database:h2:jar:1.3.159 (compile), cglib:cglib-nodep:jar:2.2 (compile), org.apache.tiles:tiles-jsp:jar:2.2.2 (compile), org.apache.tiles:tiles-el:jar:2.2.2 (compile), javax.inject:javax.inject:jar:1 (compile), javax.servlet:servlet-api:jar:2.5 (provided), javax.servlet.jsp:jsp-api:jar:2.1 (provided), javax.servlet.jsp.jstl:jstl-api:jar:1.2 (compile), org.glassfish.web:jstl-impl:jar:1.2 (compile)]: Failed to read artifact descriptor for org.springframework:spring-context:jar:3.1.0.BUILD-SNAPSHOT: Could not transfer artifact org.springframework:spring-contextom:3.1.0.BUILD-SNAPSHOT from/to org.springframework.maven.snapshot (http://maven.springframework.org/snapshot): ConnectException: UnresolvedAddressException -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/d...utionException
    It seems like it can't find some dependencies such org.springframework.security:spring-security-taglibs:jar:3.1.0.RC3 (compile), org.springframework.security:spring-security-config:jar:3.1.0.RC3 and more.
    What can be the problem here? It can be that these jars are missing in the repository I'm searching in?

    The repositories that defined in the pom.xml are:
    <repositories>
    <repository>
    <id>org.springframework.maven.release</id>
    <name>Spring Maven Release Repository</name>
    <url>http://maven.springframework.org/release</url>
    <releases><enabled>true</enabled></releases>
    <snapshots><enabled>false</enabled></snapshots>
    </repository>
    <!-- For testing against latest Spring snapshots -->
    <repository>
    <id>org.springframework.maven.snapshot</id>
    <name>Spring Maven Snapshot Repository</name>
    <url>http://maven.springframework.org/snapshot</url>
    <releases><enabled>false</enabled></releases>
    <snapshots><enabled>true</enabled></snapshots>
    </repository>
    <!-- For developing against latest Spring milestones -->
    <repository>
    <id>org.springframework.maven.milestone</id>
    <name>Spring Maven Milestone Repository</name>
    <url>http://maven.springframework.org/milestone</url>
    <snapshots><enabled>false</enabled></snapshots>
    </repository>
    </repositories>
    Thanks,
    Tomer

  2. #2
    Join Date
    Aug 2004
    Posts
    1,075

    Default

    It is odd that you can't build and resolve those dependencies. For grins, I just removed my local Maven repo and did a build on the showcase (mvn clean install) and it resolved everything perfectly. Furthermore, I've looked in the repository and can see that those dependencies are there.

    Looking at your error, it appears that all (or almost all) of the dependencies, including those that should be available in the central repo (such as javax.inject). My guess is that your build is failing because of network reasons...it can't see the repos to fetch the dependencies. But that's just a guess and I can't confirm that from here.
    Craig Walls
    Spring Social Project Lead

  3. #3
    Join Date
    Sep 2011
    Posts
    5

    Default

    You were right. It was a problem with my proxy settings... Thanks!

    I have another problem:
    When I run the showcase app, and trying to connecting my Facebook account, I get this response:
    Code:
    {
       "error": {
          "message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration.",
          "type": "OAuthException"
       }
    }
    I run it on a local Tomcat. Maybe I need to configure the referrer URL somewhere?
    I manage to connect Twitter though.

    Tomer

  4. #4
    Join Date
    Aug 2004
    Posts
    1,075

    Default

    When you registered your app with Facebook, you had to give it a site URL. This URL must be the base URL of the redirect URI. For example, the Spring Social Showcase is configured in Facebook with "http://localhost:8080/spring-social-showcase/" as its site URL. And, when running it locally, the redirect URI is "http://localhost:8080/spring-social-showcase/connect/facebook", so it matches up and Facebook doesn't complain.

    So, my guess is that you just need to go into your app's settings on Facebook and adjust the site URL.
    Craig Walls
    Spring Social Project Lead

  5. #5
    Join Date
    Sep 2011
    Posts
    5

    Default

    I'm not using my own Facebook app, but the showcase's sample app.
    For some reason I only manage to access the application from: http://localhost:8080/spring-social-...nnect/facebook
    And when I'm trying from: http://localhost:8080/spring-social-...nnect/facebook, I get 404. Do you know why (i'm running it on a Tomcat 7)?

    Thank you.

  6. #6
    Join Date
    Aug 2004
    Posts
    1,075

    Default

    Ah, I'm guessing that you did a "mvn package" (or some such Maven goal that gave you a WAR file) and that WAR file is named spring-social-showcase-1.0.0.war. Then when you deploy it into Tomcat, the app is given a context name based on the WAR file's name, thus "spring-social-showcase-1.0.0".

    I should probably tweak the pom.xml file to produce a war file without the version number in it. In the meantime, you have a couple of options: (1) Run it with "mvn tomcat:run" which will use the Maven Tomcat plugin to run it or (2) rename the war file to spring-social-showcase.war before deploying it. There are other options, too, but those are probably the easiest for now.
    Craig Walls
    Spring Social Project Lead

  7. #7
    Join Date
    Sep 2011
    Posts
    5

    Default

    Got you. Thanks a lot!

  8. #8
    Join Date
    Sep 2007
    Posts
    138

    Default

    Tomer, if you'd rather tweak your pom so that it generate a war without the version number add a plugin to your pom:

    Code:
    <plugin>
    	<groupId>org.apache.maven.plugins</groupId>
    	<artifactId>maven-war-plugin</artifactId>
    	<version>2.1.1</version>
    	<configuration>
    		<warName>spring-social-showcase</warName>
    	</configuration>
    </plugin>

  9. #9
    Join Date
    Sep 2011
    Posts
    5

    Default

    That's exactly what I did. Thank you anyway

  10. #10
    Join Date
    Aug 2004
    Posts
    1,075

    Default

    I've also applies the same change to each of the sample apps.
    Craig Walls
    Spring Social Project Lead

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •