Giter Club home page Giter Club logo

tut-rest's Issues

Running security version doesn't grant me access

When I spin up the security version of Application inside my IDE, I then try to curl request a token. I get a "Bad Credentials" response:

$ curl -X POST -vu android-bookmarks:123456 http://localhost:8080/oauth/token -H "Accept: application/json" -d "password=password&username=jlong&grant_type=password&scope=write&client_secret=123456&client_id=android-bookmarks"
* Adding handle: conn: 0x7f8568803a00
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7f8568803a00) send_pipe: 1, recv_pipe: 0
* About to connect() to localhost port 8080 (#0)
*   Trying ::1...
* Connected to localhost (::1) port 8080 (#0)
* Server auth using Basic with user 'android-bookmarks'
> POST /oauth/token HTTP/1.1
> Authorization: Basic YW5kcm9pZC1ib29rbWFya3M6MTIzNDU2
> User-Agent: curl/7.30.0
> Host: localhost:8080
> Accept: application/json
> Content-Length: 113
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 113 out of 113 bytes
< HTTP/1.1 400 Bad Request
* Server Apache-Coyote/1.1 is not blacklisted
< Server: Apache-Coyote/1.1
< Access-Control-Allow-Origin: http://localhost:9000
< Access-Control-Allow-Methods: POST,GET,OPTIONS,DELETE
< Access-Control-Max-Age: 3600
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Headers: Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers,Authorization
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< X-Frame-Options: DENY
< Cache-Control: no-store
< Pragma: no-cache
< Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
< Date: Thu, 23 Oct 2014 21:30:19 GMT
< Connection: close
< 
* Closing connection 0
{"error":"invalid_grant","error_description":"Bad credentials"}

This is perplexing given that the init method clearly sets up entries:

    @Bean
    CommandLineRunner init(AccountRepository accountRepository, BookmarkRepository bookmarkRepository) {
        return (evt) ->
                Arrays.asList("jhoeller,dsyer,pwebb,ogierke,rwinch,mfisher,mpollack,jlong".split(",")).forEach(a -> {
                    Account account = accountRepository.save(new Account(a, "password"));
                    bookmarkRepository.save(new Bookmark(account, "http://bookmark.com/1/" + a, "A description"));
                    bookmarkRepository.save(new Bookmark(account, "http://bookmark.com/2/" + a, "A description"));
                });
    }

Thoughts?

Note, I also saw this from the server side logs:

2014-10-23 16:30:19.792  INFO 5839 --- [nio-8080-exec-1] o.s.s.o.provider.endpoint.TokenEndpoint  : Handling error: InvalidGrantException, Bad credentials

No Prerequisites Description

This tutorial begins with the Spring Initializr as if the user is going to be starting from scratch, and then jumps right into model/src/main/java/bookmarks/Account.java which is a folder that does not yet exist.

There are no descriptions of what someone following the tutorial must do to catch up to this point. Even if a user simply copies and pastes the code provided they run into errors with things such as @RestController not being resolved to a type.

This tutorial starts from the beginning and then jumps ahead to somewhere. It should include a disclaimer about the prerequisites for the course, or a full description of what a student needs to do in order to follow the tutorial.

Fix the method for https://github.com/spring-projects/spring-boot/issues/1801

I looked up issue: spring-projects/spring-boot#1801. It seems to be fixed. The following code snippet still exists:

@Override
    public void configure(AuthorizationServerEndpointsConfigurer endpoints)
            throws Exception {
        // Workaround for https://github.com/spring-projects/spring-boot/issues/1801
        endpoints.authenticationManager(new AuthenticationManager() {
            @Override
            public Authentication authenticate(Authentication authentication)
                    throws AuthenticationException {
                return authenticationManager.getOrBuild().authenticate(authentication);
            }
        }).tokenStore(tokenStore())
          .approvalStoreDisabled();
    }

The following seems to be working with 1.3.5:

@Autowired
private AuthenticationManager auth;

@Override
    public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
        // Workaround for
        // https://github.com/spring-projects/spring-boot/issues/1801
        endpoints.authorizationCodeServices(authorizationCodeServices())
                .authenticationManager(auth)
                .tokenStore(tokenStore())
                .approvalStoreDisabled();
    }

Remove deprecated classes

I think a number of classes used in this example have been deprecated in the most recent versions of Spring. It sure would be appreciated to have an example that uses only the most current classes. Thanks!

Details for bookmark nested under 'bookmark' for HATEOAS

Hello,

I have been following the HATEOAS section in an attempt to familurise myself with how I can extend an existing interface with HATEOAS links.

The issue I find with the tutorial is that when I have followed it I get the following output from a single bookmark:

{
    "bookmark": {
        "id": 5,
        "uri": "http://bookmark.com/1/dsyer",
        "description": "A description"
    },
    "links": [
        {
            "rel": "bookmark-uri",
            "href": "http://bookmark.com/1/dsyer",
            "hreflang": null,
            "media": null,
            "title": null,
            "type": null,
            "deprecation": null
        },
        {
            "rel": "bookmarks",
            "href": "http://localhost:8080/dsyer/bookmarks",
            "hreflang": null,
            "media": null,
            "title": null,
            "type": null,
            "deprecation": null
        },
        {
            "rel": "self",
            "href": "http://localhost:8080/dsyer/bookmarks/5",
            "hreflang": null,
            "media": null,
            "title": null,
            "type": null,
            "deprecation": null
        }
    ]
}

What I find surprising is that the bookmark details are nested underneath the heading 'bookmark'.
Taking a look at other tutorials, they seem to suggest that the result should not be nested:
https://docs.spring.io/spring-hateoas/docs/current/reference/html/#fundamentals.resources
http://www.baeldung.com/spring-hateoas-tutorial#link

So, I would expect the result to be instead:

{
    "id": 5,
    "uri": "http://bookmark.com/1/dsyer",
    "description": "A description",
    "links": [
        {
            "rel": "bookmark-uri",
            "href": "http://bookmark.com/1/dsyer",
            "hreflang": null,
            "media": null,
            "title": null,
            "type": null,
            "deprecation": null
        },
        {
            "rel": "bookmarks",
            "href": "http://localhost:8080/dsyer/bookmarks",
            "hreflang": null,
            "media": null,
            "title": null,
            "type": null,
            "deprecation": null
        },
        {
            "rel": "self",
            "href": "http://localhost:8080/dsyer/bookmarks/5",
            "hreflang": null,
            "media": null,
            "title": null,
            "type": null,
            "deprecation": null
        }
    ]
}

If it is in fact supposed to be just an enrichment with the HATEOAS links then the second way makes a lot of sense. We already know we are in the bookmark context here so don't need to have a nested object.

Unable to marshal type "bookmarks.BookmarkResource"

When running the HATEOAS project as is and browsing to http://localhost:8080/jhoeller/bookmarks I get the following error:

There was an unexpected error (type=Internal Server Error, status=500).
Could not marshal [Resources { content: [links: [<http://bookmark.com/1/jhoeller>;rel="bookmark-uri", <http://localhost:8080/jhoeller/bookmarks>;rel="bookmarks", <http://localhost:8080/jhoeller/bookmarks/1>;rel="self"], links: [<http://bookmark.com/2/jhoeller>;rel="bookmark-uri", <http://localhost:8080/jhoeller/bookmarks>;rel="bookmarks", <http://localhost:8080/jhoeller/bookmarks/2>;rel="self"]], links: [] }]: null; 
nested exception is javax.xml.bind.MarshalException - with linked exception: [com.sun.istack.internal.SAXException2: 
unable to marshal type "bookmarks.BookmarkResource" as an element because it is missing an @XmlRootElement annotation]

Is there something missing here or is it just me?

OPTIONS request from Angular returns HTTP 401 Unauthorized status

When I invoke POST request to http://localhost:8080/oauth/token, Angular frontend application is sending preflight OPTIONS request to http://localhost:8080/oauth/token and Authorization header is not sent and I get HTTP 401 Unauthorized status.

I have found many similar issues, but all solutions are referring to use of WebSecurityConfigurerAdapter, but your sample application is using AuthorizationServerConfigurerAdapter and GlobalAuthenticationConfigurerAdapter.

Could you add solution to your sample app so OPTIONS request is not required to send Authorization header to /oauth/token, in order to be compatible to Angular applications?

Required request body is missing: org.springframework.http.ResponseEntity<?>

When you create the POST method add, and you try to call it from a request, it return the next:

{
"timestamp": 1480245744194,
"status": 400,
"error": "Bad Request",
"exception": "org.springframework.http.converter.HttpMessageNotReadableException",
"message": "Required request body is missing: org.springframework.http.ResponseEntity<?> com.garcia.bookmarks.BookmarkRestController.add(java.lang.String,com.garcia.bookmarks.Bookmark)",
"path": "/jhoeller/bookmarks"
}

All the other methods works fine, only this throw an error

Authority should be ROLE_USER not USER

In file https://github.com/spring-guides/tut-bookmarks/blob/master/security/src/main/java/bookmarks/Application.java#L143, AuthorityUtils.createAuthorityList("USER", "write") should be AuthorityUtils.createAuthorityList("ROLE_USER", "write") as Spring Security uses role ROLE_USER to check. This causes basic authentication to fail with 403 error.

Actually in the OAuth2 configuration (https://github.com/spring-guides/tut-bookmarks/blob/master/security/src/main/java/bookmarks/Application.java#L180), it's using the correct ROLE_USER.

Tutorial has insufficient Spring initializer projects

Tutorial has insufficient information to executre, this includes Spring initializer projects, " In this case, we’re going to build a web application. So, select "Web" and then choose "Generate." A .zip will start downloading". It needs atleast JPA, some embedded DB H2 and likely others incl. HATEOS visible via advanced link below.
And there is no step for mvn spring-boot:run

Security sample project: Fix curl examples in Application

In class security/src/main/java/bookmarks/Application.java

At the top of it, we can see the following curl examples:
// curl -X POST -vu android-bookmarks:123456 http://localhost:8080/oauth/token -H "Accept: application/json" -d "password=password&username=jlong&grant_type=password&scope=write&client_secret=123456&client_id=android-bookmarks" // curl -v POST http://127.0.0.1:8080/bookmarks -H "Authorization: Bearer <oauth_token>""

Both are wrong.

To begin with, for a self-signed certificate like the one generated in the tutorial, you need to run curl with the --insecure optional parameter.
The second command is also wrong. Its trying to post but instead of -X is using -v, and there is no actual payload. Double quotes at the end are also wrong.

Working examples (Edit the token in the second and third example):

LOGIN
curl --insecure -X POST -vu android-bookmarks:123456 http://localhost:8080/oauth/token -H "Accept: application/json" -d "password=password&username=jlong&grant_type=password&scope=write&client_secret=123456&client_id=android-bookmarks"

POSTING A NEW BOOKMARK
curl --insecure -X POST -vu android-bookmarks:123456 -H "Authorization: Bearer <token returned in login response>" -H "Accept: application/json" -H "Content-Type: application/json" -d '{"uri": "https://spring.io", "description": "New bookmark!"}' https://127.0.0.1:8443/jlong/bookmarks

RETRIEVING ALL BOOKMARKS
curl -v --insecure -H "Accept: application/json" -H "Authorization: Bearer <token returned in login response>" -X GET https://127.0.0.1:8443/jlong/bookmarks/

json method

I am trying to follow this example in a project. Where is the json method coming from? The same packages are imported the best I can tell.

    String bookmarkJson = json(new Bookmark(
            this.account, "http://spring.io", "a bookmark to the best resource for Spring news and information"));

readBookmark will find bookmarks of other users too

If you put an id of a bookmark belonging to an user different than the one specified in the path, it will return it.

That happens because inside this method you are only searching by the id and not filtering by the user id:

@RequestMapping(method = RequestMethod.GET, value = "/{bookmarkId}")
Bookmark readBookmark(@PathVariable String userId, @PathVariable Long bookmarkId) {
	this.validateUser(userId);
	return this.bookmarkRepository.findOne(bookmarkId);
}

It should be corrected to something like this:

@RequestMapping(method = RequestMethod.GET, value = "/{bookmarkId}")
Bookmark readBookmark(@PathVariable String userId, @PathVariable Long bookmarkId) {
	this.validateUser(userId);
	return this.bookmarkRepository.findByAccountUsername(userId).stream()
	           .filter(bookmark -> bookmark.getId() == bookmarkId)
	           .findFirst()
	           .orElse(null);
}

Question: @RestController with ResponseEntity

Hi,

I was wondering if it's the best practice to use @RestController with ResponseEntity when we need more flexibility (for example to return more than one HTTP status code)?

The concrete example in the code: https://github.com/spring-guides/tut-bookmarks/blob/a5b4d43d63d3c7d8a6107873841526f92d7bad2d/rest/src/main/java/bookmarks/BookmarkRestController.java#L56

Basically, I can see that in this project @RestController is used everywhere, but also I can see that it is used with ResponseEntity (see example above).

Is it ok to do so? I am asking just to confirm my response from here: http://stackoverflow.com/questions/26549379/when-use-responseentityt-and-restcontroller-for-spring-restful-applications/40454751#40454751

Thank you very much!

Security:curl work ,$.ajax got 401

when i use curl to get access_token
curl -X POST -vu android-bookmarks:123456 http://localhost:8080/oauth/token -H "Accept: application/json" -d "password=password&username=jlong&grant_type=password&scope=write&client_secret=123456&client_id=android-bookmarks"
it returns like
{"access_token":"8ac3b71e-9196-4f01-b128-4fe2cf99a1c6","token_type":"bearer","refresh_token":"77a8657a-02fb-4e4a-a8bc-b2af5550540d","expires_in":43199,"scope":"write"}* Connection #0 to host localhost left intact
then i use the token
curl -v http://localhost:8080/bookmarks -H "Authorization: Bearer 8ac3b71e-9196-4f01-b128-4fe2cf99a1c6"
it returns correct result curl -v http://localhost:8080/bookmarks -H "Authorization: Bearer 8ac3b71e-9196-4f01-b128-4fe2cf99a1c6"
but i use ajax in my host "localhost"
$.ajax({ url: 'http://localhost:8080/bookmarks', beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'BEARER 8ac3b71e-9196-4f01-b128-4fe2cf99a1c6'); }, success: function (response) { console.log(response); } });
i use chrome console to run this ,it logs
XMLHttpRequest cannot load http://localhost:8080/bookmarks. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. The response had HTTP status code 401.
i run the app append args :"--tagit.origin=*" to make Access-Control-Allow-Origin is always * ,why it still get that error?

Getting `javax.xml.bind.MarshalException` in "What makes something RESTful?" part of tutorial

I've replaced the @GetMapping("/employees/{id}") and @GetMapping("/employees") methods as specified under the "What makes something RESTful?" heading.

My application was working before I made these changes.

When I go to http://localhost:8080/employees, I get the following:

Whitelabel Error PageThis application has no explicit mapping for /error, so you are seeing this as a fallback.
Fri Oct 19 18:23:16 CEST 2018There was an unexpected error (type=Internal Server Error, status=500).
Could not marshal [Resources { content: [Resource { content: Employee(id=1, name=Bilbo Baggins, role=burglar), links: [<http://localhost:8080/employees/1>;rel="self", <http://localhost:8080/employees>;rel="employees"] }, 
Resource { content: Employee(id=2, name=Frodo Baggins, role=thief), links: [<http://localhost:8080/employees/2>;rel="self", <http://localhost:8080/employees>;rel="employees"] }], links: [<http://localhost:8080/employees>;rel="self"] }]: null; 
nested exception is javax.xml.bind.MarshalException - with linked exception: [com.sun.istack.internal.SAXException2: unable to marshal type "org.springframework.hateoas.Resource" as an element because it is not known to this context.]

When I go to http://localhost:8080/employees/1, I get the following:

Whitelabel Error PageThis application has no explicit mapping for /error, so you are seeing this as a fallback.
Fri Oct 19 18:33:45 CEST 2018There was an unexpected error (type=Internal Server Error, status=500).
Could not marshal [Resource { content: Employee(id=1, name=Bilbo Baggins, role=burglar), links: [<http://localhost:8080/employees/1>;rel="self", <http://localhost:8080/employees>;rel="employees"] }]: null; 
nested exception is javax.xml.bind.MarshalException - with linked exception: [com.sun.istack.internal.SAXException2: class nl.marit.springdemo.payroll.Employee nor any of its super class is known to this context. javax.xml.bind.JAXBException: class xxxxx.payroll.Employee nor any of its super class is known to this context.]

Sidenote: My IDE (IntelliJ) also wants to add imports for linkTo and methodOn, while I cannot find imports for these in rest/src/main/java/payroll/EmployeeController.java.

Link to my project.

Getting Started - Missing Link

Under the Getting Started subtitle, you mention a link to a video demonstrating STS and Spring Boot but it is not provided.

Tutorial needs instructions for launching from command line

I don't actually know how to build or execute this application (using maven from the command line). In my derived example I'm using gradle bootRun, but the mvn spring-boot:run fails:

$ mvn spring-boot:run
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] bookmarks
[INFO] model
[INFO] rest
[INFO] security
[INFO] hateoas
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building bookmarks 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> spring-boot-maven-plugin:1.3.5.RELEASE:run (default-cli) > test-compile @ bookmarks >>>
[INFO] 
[INFO] <<< spring-boot-maven-plugin:1.3.5.RELEASE:run (default-cli) < test-compile @ bookmarks <<<
[INFO] 
[INFO] --- spring-boot-maven-plugin:1.3.5.RELEASE:run (default-cli) @ bookmarks ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] bookmarks .......................................... FAILURE [  0.732 s]
[INFO] model .............................................. SKIPPED
[INFO] rest ............................................... SKIPPED
[INFO] security ........................................... SKIPPED
[INFO] hateoas ............................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.247 s
[INFO] Finished at: 2016-10-25T13:06:06-07:00
[INFO] Final Memory: 18M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.3.5.RELEASE:run (default-cli) on project bookmarks: Unable to find a suitable main class, please add a 'mainClass' property -> [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/display/MAVEN/MojoExecutionException

cd rest

The tutorial mentions cd rest, but no mention of creating a "rest" folder was ever made before.

Clarify CommandLineRunner in Application.java

[Copied in from personal blog comment]
Hello Greg,

A great tutorial on Spring REST with Spring Boot (http://spring.io/guides/tutorials/bookmarks/). I have a question that requires the clarity. In "Application.java", how does the line that has "return (evt) -> ..." returns the CommandLineRunner type? I was searching for everywhere how this works but most point to "implements CommandLineRunner" format...

Username and Password

Can someone help me with the user name and password.

I have used the keytool for creating the keystore password.

Several issues regarding README.adoc

  • Why does the guide use RequestMapping instead of the simpler GetMapping, PostMapping, and so on?

  • Why is the L in @PathVariable Long bookmarkId an uppercase letter?

  • The first HttpMessageConverter is missing an s at the end. The one that does have an s at the end has an extra space before the s that should be removed.

  • Some of the source code is indented with 8 spaces (way too much for presenting it in a narrow column), some is indented with 4 spaces. To save even more space, it should only be indented with 2 spaces, or at least consistently with 4 spaces.

  • The text in the request message should probably be in the response message. The current text doesn't make sense to me.

HATEOAS class BookmarkRestController @RequestMapping(method = RequestMethod.POST)

Getting the error: Cannot infer type argument(s) for map(Function<? super T,? extends U>
For return accountRepository.findByUsername(userId)
.map(account -> {
Bookmark bookmark = bookmarkRepository
.save(new Bookmark(account, input.uri, input.description));

            Link forOneBookmark = new BookmarkResource(bookmark).getLink("self");

            return ResponseEntity.created(URI.create(forOneBookmark.getHref())).build();
        })

Will continue debugging.

Tutorial text does not mention including Spring Security Starter

New to Spring Boot and Java and following the tutorial step by step.

IntelliJ threw errors about not finding symbols: GlobalAuthenticationConfigurerAdapter and AuthorizationServerConfigurerAdapter

I spent time trying to figure this out and I believe I needed to include spring security to my pom file. Adding it fixed GlobalAuthenticationConfigurerAdapter.

But I'm still trying to figure out GlobalAuthenticationConfigurerAdapter.

The tutorial does not mention to include spring-security when using the initilizer.

UserNotFoundException code does not contain imports

The code should be:

package bookmarks;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

@ResponseStatus(HttpStatus.NOT_FOUND)
class UserNotFoundException extends RuntimeException {

public UserNotFoundException(String userId) {
	super("could not find user '" + userId + "'.");
}

}

Employee class needs default constructor

Employee class needs default constructor for JPA. Otherwise you will get an org.hibernate.InstantiationException: No default constructor for entity exception at the step to curl -v localhost:8080/employees.

[run failure] Rest Directory

mvn spring-boot:run

Short:

InvocationTargetException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException: javax.xml.bind.JAXBException -> [Help 1]

All:


  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.0.5.RELEASE)

2018-11-29 11:39:10.542  INFO 8702 --- [           main] payroll.PayrollApplication               : Starting PayrollApplication on debian with PID 8702 (/home/alex/Desktop/tut-rest/rest/target/classes started by alex in /home/alex/Desktop/tut-rest/rest)
2018-11-29 11:39:10.555  INFO 8702 --- [           main] payroll.PayrollApplication               : No active profile set, falling back to default profiles: default
2018-11-29 11:39:10.755  INFO 8702 --- [           main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@3802b01d: startup date [Thu Nov 29 11:39:10 MSK 2018]; root of context hierarchy
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (file:/home/alex/.m2/repository/org/springframework/spring-core/5.0.9.RELEASE/spring-core-5.0.9.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2018-11-29 11:39:14.771  INFO 8702 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$2b149e74] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-11-29 11:39:14.898  INFO 8702 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.hateoas.config.HateoasConfiguration' of type [org.springframework.hateoas.config.HateoasConfiguration$$EnhancerBySpringCGLIB$$aa94eba6] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-11-29 11:39:15.961  INFO 8702 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2018-11-29 11:39:16.051  INFO 8702 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2018-11-29 11:39:16.051  INFO 8702 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.34
2018-11-29 11:39:16.077  INFO 8702 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib]
2018-11-29 11:39:16.324  INFO 8702 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2018-11-29 11:39:16.324  INFO 8702 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 5569 ms
2018-11-29 11:39:16.492  INFO 8702 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Servlet dispatcherServlet mapped to [/]
2018-11-29 11:39:16.506  INFO 8702 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-11-29 11:39:16.506  INFO 8702 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-11-29 11:39:16.507  INFO 8702 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-11-29 11:39:16.507  INFO 8702 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2018-11-29 11:39:16.888  INFO 8702 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2018-11-29 11:39:17.497  INFO 8702 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2018-11-29 11:39:17.661  INFO 8702 --- [           main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2018-11-29 11:39:17.695  INFO 8702 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
	name: default
	...]
2018-11-29 11:39:17.866  INFO 8702 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {5.2.17.Final}
2018-11-29 11:39:17.868  INFO 8702 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2018-11-29 11:39:17.902  WARN 8702 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
2018-11-29 11:39:17.911  INFO 8702 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2018-11-29 11:39:17.922  INFO 8702 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
2018-11-29 11:39:17.926  INFO 8702 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2018-11-29 11:39:18.037  INFO 8702 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-11-29 11:39:18.048 ERROR 8702 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1699) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:573) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1089) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:859) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:780) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:333) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1277) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1265) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
	at payroll.PayrollApplication.main(PayrollApplication.java:10) ~[classes/:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
	at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:497) ~[na:na]
	at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
	at org.hibernate.boot.spi.XmlMappingBinderAccess.<init>(XmlMappingBinderAccess.java:43) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
	at org.hibernate.boot.MetadataSources.<init>(MetadataSources.java:87) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:209) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:164) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
	at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:51) ~[spring-orm-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) ~[spring-orm-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:390) ~[spring-orm-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:377) ~[spring-orm-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1758) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1695) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	... 22 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471) ~[na:na]
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588) ~[na:na]
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
	... 33 common frames omitted

[WARNING] 
java.lang.reflect.InvocationTargetException
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run (AbstractRunMojo.java:497)
    at java.lang.Thread.run (Thread.java:834)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean (AbstractAutowireCapableBeanFactory.java:1699)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean (AbstractAutowireCapableBeanFactory.java:573)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:495)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0 (AbstractBeanFactory.java:317)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (AbstractBeanFactory.java:315)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:199)
    at org.springframework.context.support.AbstractApplicationContext.getBean (AbstractApplicationContext.java:1089)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization (AbstractApplicationContext.java:859)
    at org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:550)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh (ServletWebServerApplicationContext.java:140)
    at org.springframework.boot.SpringApplication.refresh (SpringApplication.java:780)
    at org.springframework.boot.SpringApplication.refreshContext (SpringApplication.java:412)
    at org.springframework.boot.SpringApplication.run (SpringApplication.java:333)
    at org.springframework.boot.SpringApplication.run (SpringApplication.java:1277)
    at org.springframework.boot.SpringApplication.run (SpringApplication.java:1265)
    at payroll.PayrollApplication.main (PayrollApplication.java:10)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run (AbstractRunMojo.java:497)
    at java.lang.Thread.run (Thread.java:834)
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
    at org.hibernate.boot.spi.XmlMappingBinderAccess.<init> (XmlMappingBinderAccess.java:43)
    at org.hibernate.boot.MetadataSources.<init> (MetadataSources.java:87)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init> (EntityManagerFactoryBuilderImpl.java:209)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init> (EntityManagerFactoryBuilderImpl.java:164)
    at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory (SpringHibernateJpaPersistenceProvider.java:51)
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory (LocalContainerEntityManagerFactoryBean.java:365)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory (AbstractEntityManagerFactoryBean.java:390)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet (AbstractEntityManagerFactoryBean.java:377)
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet (LocalContainerEntityManagerFactoryBean.java:341)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods (AbstractAutowireCapableBeanFactory.java:1758)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean (AbstractAutowireCapableBeanFactory.java:1695)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean (AbstractAutowireCapableBeanFactory.java:573)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:495)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0 (AbstractBeanFactory.java:317)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (AbstractBeanFactory.java:315)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:199)
    at org.springframework.context.support.AbstractApplicationContext.getBean (AbstractApplicationContext.java:1089)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization (AbstractApplicationContext.java:859)
    at org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:550)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh (ServletWebServerApplicationContext.java:140)
    at org.springframework.boot.SpringApplication.refresh (SpringApplication.java:780)
    at org.springframework.boot.SpringApplication.refreshContext (SpringApplication.java:412)
    at org.springframework.boot.SpringApplication.run (SpringApplication.java:333)
    at org.springframework.boot.SpringApplication.run (SpringApplication.java:1277)
    at org.springframework.boot.SpringApplication.run (SpringApplication.java:1265)
    at payroll.PayrollApplication.main (PayrollApplication.java:10)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run (AbstractRunMojo.java:497)
    at java.lang.Thread.run (Thread.java:834)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
    at java.net.URLClassLoader.findClass (URLClassLoader.java:471)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:588)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:521)
    at org.hibernate.boot.spi.XmlMappingBinderAccess.<init> (XmlMappingBinderAccess.java:43)
    at org.hibernate.boot.MetadataSources.<init> (MetadataSources.java:87)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init> (EntityManagerFactoryBuilderImpl.java:209)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init> (EntityManagerFactoryBuilderImpl.java:164)
    at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory (SpringHibernateJpaPersistenceProvider.java:51)
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory (LocalContainerEntityManagerFactoryBean.java:365)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory (AbstractEntityManagerFactoryBean.java:390)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet (AbstractEntityManagerFactoryBean.java:377)
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet (LocalContainerEntityManagerFactoryBean.java:341)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods (AbstractAutowireCapableBeanFactory.java:1758)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean (AbstractAutowireCapableBeanFactory.java:1695)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean (AbstractAutowireCapableBeanFactory.java:573)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:495)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0 (AbstractBeanFactory.java:317)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (AbstractBeanFactory.java:315)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:199)
    at org.springframework.context.support.AbstractApplicationContext.getBean (AbstractApplicationContext.java:1089)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization (AbstractApplicationContext.java:859)
    at org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:550)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh (ServletWebServerApplicationContext.java:140)
    at org.springframework.boot.SpringApplication.refresh (SpringApplication.java:780)
    at org.springframework.boot.SpringApplication.refreshContext (SpringApplication.java:412)
    at org.springframework.boot.SpringApplication.run (SpringApplication.java:333)
    at org.springframework.boot.SpringApplication.run (SpringApplication.java:1277)
    at org.springframework.boot.SpringApplication.run (SpringApplication.java:1265)
    at payroll.PayrollApplication.main (PayrollApplication.java:10)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run (AbstractRunMojo.java:497)
    at java.lang.Thread.run (Thread.java:834)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  48.224 s
[INFO] Finished at: 2018-11-29T11:39:18+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.5.RELEASE:run (default-cli) on project rest: An exception occurred while running. null: InvocationTargetException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException: javax.xml.bind.JAXBException -> [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/display/MAVEN/MojoExecutionException

BookmarkControllerAdvice no imports

The tutorial does not contain the imports for this class.

Is there some norm I don't know where I have to copy and paste from the source code instead of the tutorial copy?

findOne in interface cannot be applied to given types

Hey there, loving the tutorial - thanks for putting it together!

When I ran the first maven install I got an error regarding this line in BookmarkRestController.java:

return this.bookmarkRepository.findOne(bookmarkId);

Here's the error:

[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /Users/is5960/Code/tutorials/demo/src/main/java/com/example/demo/BookmarkRestController.java:[55,39] method findOne in interface org.springframework.data.repository.query.QueryByExampleExecutor<T> cannot be applied to given types;
  required: org.springframework.data.domain.Example<S>
  found: java.lang.Long
  reason: cannot infer type-variable(s) S
    (argument mismatch; java.lang.Long cannot be converted to org.springframework.data.domain.Example<S>)
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.538 s
[INFO] Finished at: 2018-04-20T14:51:10-05:00
[INFO] Final Memory: 32M/383M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project demo: Compilation failure
[ERROR] /Users/is5960/Code/tutorials/demo/src/main/java/com/example/demo/BookmarkRestController.java:[55,39] method findOne in interface org.springframework.data.repository.query.QueryByExampleExecutor<T> cannot be applied to given types;
[ERROR]   required: org.springframework.data.domain.Example<S>
[ERROR]   found: java.lang.Long
[ERROR]   reason: cannot infer type-variable(s) S
[ERROR]     (argument mismatch; java.lang.Long cannot be converted to org.springframework.data.domain.Example<S>)
[ERROR] 
[ERROR] -> [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/display/MAVEN/MojoFailureException

After digging in a little, I found this Stack Overflow question that implies maybe the tutorial should use getOne or findOneByEmail. When I change the line of code I can compile fine:

return this.bookmarkRepository.getOne(bookmarkId);

I'm a total Java and Spring newbie, so maybe I'm totally off-the-mark. Just thought I'd share this issue in case someone else runs into it.

Missing word POST

"Methods that don’t specify a path just inherit the path mapped at the type level. The add method responds to the URI specified at the type level, but it only responds to HTTP requests with the verb"

->

Methods that don’t specify a path just inherit the path mapped at the type level. The add method responds to the URI specified at the type level, but it only responds to HTTP requests with the verb POST.

RESTController does not contain imports

The code for BookmarkRESTController in the tutorial should contain what the source code here does:

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;

import java.net.URI;
import java.util.Collection;

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.