Giter VIP home page Giter VIP logo

Comments (17)

gregturn avatar gregturn commented on August 22, 2024

Did you start from the initial configuration and copy-and-paste bits from the guide or did you start with the completed section?

from gs-rest-service.

only-gale avatar only-gale commented on August 22, 2024

@gregturn I followed this guide http://spring.io/guides/gs/rest-service/ step by step, created the folders, copy-and-paste the java code, until successfully I ran "mvn clean package", but the last step was failed when I ran "java -jar target/gs-rest-service-0.1.0.jar". I was using jdk 1.8.0_77.

from gs-rest-service.

only-gale avatar only-gale commented on August 22, 2024

@gregturn I've tried another guide http://spring.io/guides/gs/messaging-rabbitmq/ in the same environment as the previous one, I got the jar file, but it didn't work successfully either.It almost drives me crazy. I just want to figure one of them out, just one, buddy, then the others would be easier. So please help me.

from gs-rest-service.

only-gale avatar only-gale commented on August 22, 2024

@gregturn BTW, I love spring so much, and the guides listed on the index page are amazing, even though I haven't succeeded in the first one, but thank you guys anyway.

from gs-rest-service.

gregturn avatar gregturn commented on August 22, 2024

Switched to the "complete" version and run that see if it works.

from gs-rest-service.

only-gale avatar only-gale commented on August 22, 2024

@gregturn Yeah, I've already switched to the "complete" version and it ran perfectly, I've been trying to find the difference.

from gs-rest-service.

gregturn avatar gregturn commented on August 22, 2024

@only-gale Would you be willing to push your copy that doesn't work to a separate place in github so I can peek at it?

from gs-rest-service.

Timeriovo avatar Timeriovo commented on August 22, 2024

sorry,what is "complete"? I have a similar problem with you.
ide: eclipse jdk:1.8 maven:3.5.2

from gs-rest-service.

gregturn avatar gregturn commented on August 22, 2024

This guide like many others has two folders, initial and complete. Complete one has all the code for the solution.

from gs-rest-service.

Pyronia avatar Pyronia commented on August 22, 2024

Hi!

I had troubles with this guide as well, after few tries the best way to deal with this was to remove:

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.8.RELEASE</version>
    </parent>

from pom.xml. As the consequence maven will download some additional libraries.

Basically the root cause is difference between used spring versions.
My first attempt was to remove versions from each of the spring dependency after which the project started to work UNTIL I invalidated Cache and restarted my Intellij.

So far everything is working for me now.

Edit: I also moved the java files into separated package instead of my original src-main-java folder

from gs-rest-service.

mystyle2006 avatar mystyle2006 commented on August 22, 2024

Hi guys, as someone who has the same issue, can you please share any information if you got this solved?
email : [email protected]

from gs-rest-service.

GWReeves avatar GWReeves commented on August 22, 2024

Hi Guys,
I am having a problem running the Spring Rest Service Tutorial... gs-rest-service
(See: "https://spring.io/guides/gs/rest-service/")

There appears to be issues around mapping Java/JSON.

The error I get is...
"No converter found for return value of type: class hello.Greeting"
The URL I'm using...
"http://localhost:8080/greeting?name=User"
I'm running the app from within STS as...
"Spring Boot App"

My environment is:

  • Windows 7
  • Java 8 (1.8.0_144)
  • Maven 3.5.2
  • Spring Tool Suite Version: 3.9.1.RELEASE ( Platform: Eclipse Oxygen.1a (4.7.1a) )

It happens with both the self-built "gs-rest-service-initial" and the completed version "gs-rest-service-complete"

These are things I've already checked after reading other peoples suggestions...

  1. Yes, the Greeting does have getters
  2. The jackson databind, annotaions and core libraries are present (all at version 2.8.10)
  3. I tried commenting out the org.springframework.boot in the pom.xml but it made it worse
  4. I also tried restarting STS but it had no effect

I also tied exporting it as a jar to run outside of STS but I got all kinds of issues but that may have been my "jar-ing"
I did an export as runnable jar with the option "Package required libraries into generated jar"

Anyone have any ideas?

Thanks

from gs-rest-service.

YuzongG avatar YuzongG commented on August 22, 2024

If you put your Application.java in the default package, that might be the reason.

from gs-rest-service.

bicodoc avatar bicodoc commented on August 22, 2024

The guide leaves a few crucial details unclear to those of us only vaguely familiar with gradle and the OSX terminal. These comments are based on the directions provided in the "Building a RESTful Web service" guide - https://spring.io/guides/gs/rest-service/

If you get the error "Main class name has not been configured and it could not be resolved", run "gradle bootRun --info" from the "hello" directory and check the "Task:CompileJava" section to ensure you have everything in the correct directories (described below).

  1. The initial gradle build file (build.gradle) should be placed in the eclipse-workspace folder, NOT the source/main/java/hello folder.
  2. The Greeting.java, GreetingController.java and Application.java files should be placed, as indicated, in the source/main/java/hello. They do not need to be compiled (and compilation will fail for GreetingController.java and Application.java).
  3. run "gradle build" from the eclipse-workspace folder - it will create the gs-rest-service-0.1.0.jar in eclipse-workspace/build/libs.
  4. from the eclipse-workspace folder, run "java -jar build/libs/gs-rest-service-0.1.0.jar". After some messages, the service is up and running. You can proceed to http://localhost:8080/greeting to test the results.

from gs-rest-service.

wild-o avatar wild-o commented on August 22, 2024

I'm having problems with this guide too. Over and over again it has been saying that I do not have a main method defined. I removed one of the default plugins that the original POM file came with and now I am getting an error that says that an exception occurred while running.

from gs-rest-service.

wild-o avatar wild-o commented on August 22, 2024

Update: I tried this again using their version with the complete Maven build, and it did not work for me when I tried to use ./mvnw spring-boot:run

I was able to build the jar file but then when I tried to run the jar file... nada.

I'm just gonna move on to another guide. I don't know what I'm doing wrong.

from gs-rest-service.

dsyer avatar dsyer commented on August 22, 2024

This is now a collection of many different gripes and user errors. No-one so far has provided any steps to reproduce their problem or sample projects. I'm going to close this issue. Please open a new one if you have trouble building the samples in the guide (and be sure to check out the code and run it from the "complete" sample).

from gs-rest-service.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.