Announcement Announcement Module
Collapse
No announcement yet.
STS, Pro Spring 3, can't work with samples Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • STS, Pro Spring 3, can't work with samples

    I am new to Spring. I loaded STS 2.9.2 and I have two Spring books (Apress) that I'm using to try and learn Spring and Spring Flow. I'm having difficulty with the samples provided in the Pro Spring MVC: With Web Flow book. I can't get the samples to compile. When I try to execute gradlew from the command line or import the gradle project into STS I get the following error. Can somebody please provide some assistance.

    Thank You.

    FAILURE: Build failed with an exception.

    * What went wrong:
    Could not resolve all dependencies for configuration ':classpath'.
    > Could not find group:bmuschko, module:gradle-tomcat-plugin, version:0.9.2.
    Required by:
    :bookstore:unspecified
    > Could not find group:bmuschko, module:gradle-cargo-plugin, version:0.5.2.
    Required by:
    :bookstore:unspecified
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug
    option to get more log output.

    BUILD FAILED
    Total time: 36.604 secs



  • #2
    First of all thanks for buying the book and we are sorry that the sample isn't working as flawlessly as we hoped.

    Please make sure you are using gradlew and not your own gradle version (this happens sometimes with older gradle versions). If that doesn't help can you provide us with some information regarding your environment and possible the debug information (you can attach as a .txt or .log file here).

    Also you might run into a Gradle issue when importing the projects into STS, this is due to a bug in the Gradle Eclipse plugin. We are trying to create a workaround for that and you might want to keep an eye on our source repository.

    Again we are really sorry that the samples don't work as we envisioned and as you as a reader expect.

    Comment


    • #3
      Thanks for the quick reply. My environment is Windows 7 x64. I have installed the necessary software; tomcat 7.0.29, jdk1.6.0_20 and STS 2.9.2. I downloaded the bookstore application source code from the Apress site. I am running the gradlew.bat command that is included in that distribution. I've attached a debug.txt and error.txt that were generated when I ran the following command: gradelw.bat --debug > debug.txt 2> error.txt

      And yes, I am having problems importing Gradle projects in STS. I downloaded the build.gradle update from the Github link you provided in your response. I replaced the contents of the original file with the content in this link, but I'm still getting the same errors; both when running command line and importing via STS.

      BTW- when I access the Github site I keep getting a popup "message from webapge For security reasons framing is not allowed". I have to keep clicking OK until the web page displays completely. I don't recall this happening before when I accessed the Github site- it is very frustrating!! Is there a setting in IE8 that I can change to prevent this?


      Thanks again.
      Last edited by rangelot; Aug 2nd, 2012, 08:10 AM.

      Comment


      • #4
        BTW- when I access the Github site I keep getting a popup "message from webapge For security reasons framing is not allowed". I have to keep clicking OK until the web page displays completely. I don't recall this happening before when I accessed the Github site- it is very frustrating!! Is there a setting in IE8 that I can change to prevent this?
        Not sure why that happens it is just a normal link... No problems here (tested in Chrome, Firefox, IE8 with and without compatibility mode). You should be able to download a zip from the repo (or clone it) we have fixed the issue so importing should be ok now (unless you get the situation as described here).

        Thanks for the logging will take a look and get back.

        Edit: According to the logging you have an old version of the sources. Could you try again with a new version downloaded from github (the new version should be available [s]in the next couple of days[/s] tommorrow on the Apress site). We have upgraded to Gradle 1.0 shortly after releasing the sources, you where probably very quick in downloading ).

        Edit2: You also might want to clean your .gradle directory before trying again just to make sure the caches are empty and retrieval is done again instead of cached.

        Edit3:

        And yes, I am having problems importing Gradle projects in STS. I downloaded the build.gradle update from the Github link you provided in your response. I replaced the contents of the original file with the content in this link, but I'm still getting the same errors; both when running command line and importing via STS.
        You should download the full zip as you are now still using an old version of gradle, you at least need the gradle directory as that contains the information for the gradle wrapper and I'm pretty sure it has to do with the Gradle version.
        Last edited by Marten Deinum; Aug 2nd, 2012, 09:30 AM.

        Comment


        • #5
          ok, I downloaded the latest sources using the following command: git clone http://github.com/mdeinum/pro-spring-mvc-code.git

          This created a folder named pro-spring-mvc-code

          I deleted the .gradle directory and ran gradlew.bat, but now I'm getting a connection time out problem (see below). I'm sitting behind a corporate firewall and I am wondering how I was able to execute the last gradlew command without this type of problem. I searched the web for similar problems and I do see some suggestions but I don't recall performing any of the recommendations.

          C:\Users\rangelot\Documents\GitHub\pro-spring-mvc-code>gradlew
          Downloading http://services.gradle.org/distribut...le-1.0-bin.zip

          Exception in thread "main" java.net.ConnectException: Connection timed out: connect
          at java.net.PlainSocketImpl.socketConnect(Native Method)
          at java.net.PlainSocketImpl.doConnect(PlainSocketImpl .java:333)
          at java.net.PlainSocketImpl.connectToAddress(PlainSoc ketImpl.java:195)
          at java.net.PlainSocketImpl.connect(PlainSocketImpl.j ava:182)
          at java.net.SocksSocketImpl.connect(SocksSocketImpl.j ava:366)
          at java.net.Socket.connect(Socket.java:529)
          at java.net.Socket.connect(Socket.java:478)
          at sun.net.NetworkClient.doConnect(NetworkClient.java :163)
          at sun.net.http://www.http.HttpClient.openServe...ient.java:394)
          at sun.net.http://www.http.HttpClient.openServe...ient.java:529)
          at sun.net.www.http.HttpClient.<init>(HttpClient.java :233)
          at sun.net.www.http.HttpClient.New(HttpClient.java:306)
          at sun.net.www.http.HttpClient.New(HttpClient.java:323)
          at sun.net.http://www.protocol.http.HttpURLConn...lient(HttpURLC
          onnection.java:860)
          at sun.net.http://www.protocol.http.HttpURLConn...t(HttpURLConne
          ction.java:801)
          at sun.net.http://www.protocol.http.HttpURLConn...pURLConnection
          .java:726)
          at sun.net.http://www.protocol.http.HttpURLConn...eam(HttpURLCon
          nection.java:1049)
          at org.gradle.wrapper.Download.downloadInternal(Downl oad.java:49)
          at org.gradle.wrapper.Download.download(Download.java :37)
          at org.gradle.wrapper.Install.createDist(Install.java :54)
          at org.gradle.wrapper.Wrapper.execute(Wrapper.java:80 )
          at org.gradle.wrapper.GradleWrapperMain.main(GradleWr apperMain.java:37)

          Comment


          • #6
            Please use [ code][/code ] tags when posting code/stacktraces that way they remain readable.

            Apparently there is something in your environment (proxy?) that prevents the download/connection. Or maybe the gradle website is being hammered. If you are behind a firewall it might be that it requires authentication (connections etc. changed considerably between gradle versions).

            You can add a gradle.properties file to the directory which contains the security settings. It might also be that the firewall is simply blocking you or is virus checking the download (I have a very slow download when I'm behind the corporate firewall).

            However this is not something we can do much about as that is more or less your environment that is now blocking you.

            Comment


            • #7
              I created a file called gradle.properties in my .gradle directory and set appropriate values for the systemProp.http.proxyHost and
              systemProp.http.proxyPort variables. The same timout issue occurs.
              The proxyUser and proxyPassword values are not required for our environment. I tested the url http://services.gradle.org/distribut...le-1.0-bin.zip using my browser and I was able to download the zip file this way. I'm not sure why I would be able to access the file via IE but not java. I also enabled the proxy server setting in my browser to try and emulate url access via the proxy. Is there anything I can do with the gradle-1.0-bin.zip that I was able to download?

              [EDIT]
              Ok, my bad.. I must have mispelled something in the gradle.properties file. I am now able to get gradlew to run. I will see if I can proceed with running the examples using tomcat (non-STS). Hopefully I will be able to solve the STS import issue as well.
              Last edited by rangelot; Aug 2nd, 2012, 03:08 PM.

              Comment


              • #8
                IE uses the proxy settings from the OS, java doesn't and requires additional settings. Also if the proxy uses single sign on it actually does require a username/password.

                You can drop the zip in .gradle/wrapper/dists directory in your user.dir. Although I haven't tried it in theory the gradle wrapper should detect it and unzip it.

                I would also suggest a search (maybe stack overflow) as this is a gradle behind firewall/proxy issue. Which might again occur when the artifacts are downloaded, so it probably would be best if the settings where correct.

                Edit: Maybe this blog is of some help. You also might want to ask the question on the gradle support forum, there are several threads/questions regarding gradle(w) behind firewalls and proxies.
                Last edited by Marten Deinum; Aug 2nd, 2012, 03:17 PM.

                Comment


                • #9
                  I was able to run the gradlew build command inside GitHub\pro-spring-mvc-code folder, but the build failed when compiling chapter2-samples. I was also able to get STS to the point where it allows me to import the gradle projects, but I suspect I will run into problems when working with chapter 2. Any ideas?

                  Comment


                  • #10
                    Here are the logs produced during the build

                    Comment


                    • #11
                      Edit: Just checked again for some reason the classpath gets screwed for this specific project :S...

                      Importing should still work you will probably get a compilation error (although it might simply work due to all libraries are included on the classpath).

                      Edit2: Fixing/cleaning the build file for another issue introduced this. The springframework-test should be a compile not testCompile dependency (to much cleanup) and it works in STS flawlessly because everything is merged into a single classpath. It only fails on the command line. (This is what you get without a CI server ).

                      Download the build.gradle for chapter2-samples from github and replace your current one with it or add the code snippet below to the build.gradle for chapter2-samples.

                      Code:
                          compile "org.springframework:spring-test:$springVersion"
                      Last edited by Marten Deinum; Aug 4th, 2012, 05:41 AM.

                      Comment

                      Working...
                      X