Hi again, I think this is a syntax issue when you call the endpoint.
I did run mvn clean package -DskipTests tomee:run Then ran, > 11.0 ~/Downloads/provaweb714plume on master! ⌚ 11:42:14 > $ curl -XGET http://localhost:8080/webresources/book/count > 2% > > > > > > 11.0 ~/Downloads/provaweb714plume on master! ⌚ 11:42:17 > $ curl -XGET http://localhost:8080/webresources/book/ > <?xml version="1.0" > encoding="UTF-8"?><books><book><author>a</author><id>1</id><title>Armagedon</title></book><book><author>a</author><id>2</id><title>curl</title></book></books>% > > > > 11.0 ~/Downloads/provaweb714plume on master! ⌚ 11:42:21 > $ curl -XGET http://localhost:8080/webresources/book/1 > <?xml version="1.0" encoding="UTF-8" > standalone="yes"?><book><author>a</author><id>1</id><title>Armagedon</title></book>% > > > > > 11.0 ~/Downloads/provaweb714plume on master! ⌚ 11:42:25 > $ curl -XGET http://localhost:8080/webresources/book/2 > <?xml version="1.0" encoding="UTF-8" > standalone="yes"?><book><author>a</author><id>2</id><title>curl</title></book>% > > > > > 11.0 ~/Downloads/provaweb714plume on master! ⌚ 11:42:27 > $ curl -XPOST -H "Content-Type: application/xml" -d '<?xml version="1.0" > encoding="UTF-8" standalone="yes"?><book><author>a</author><title>soemthing > to test</title></book>' http://localhost:8080/webresources/book/ > > > 11.0 ~/Downloads/provaweb714plume on master! ⌚ 11:42:50 > $ curl -XGET http://localhost:8080/webresources/book/ > > > <?xml version="1.0" > encoding="UTF-8"?><books><book><author>a</author><id>1</id><title>Armagedon</title></book><book><author>a</author><id>2</id><title>curl</title></book><book><author>a</author><id>3</id><title>soemthing > to test</title></book></books>% > > > 11.0 ~/Downloads/provaweb714plume on master! ⌚ 11:42:55 > $ curl -XGET http://localhost:8080/webresources/book/2 > > > > > 11.0 ~/Downloads/provaweb714plume on master! ⌚ 11:42:59 > If you want to try in JSON > 11.0 ~/Downloads/provaweb714plume on master! ⌚ 11:44:06 > $ curl -H "Accept: application/json" -XGET > http://localhost:8080/webresources/book/ > [{"author":"a","id":1,"title":"Armagedon"},{"author":"a","id":2,"title":"curl"},{"author":"a","id":3,"title":"soemthing > to test"}]% > > 11.0 ~/Downloads/provaweb714plume on master! ⌚ 11:47:57 > $ curl -XPOST -H "Content-Type: application/json" -d > '{"title":"primo","author":"mauro"}' > http://localhost:8080/webresources/book/ > > > 11.0 ~/Downloads/provaweb714plume on master! ⌚ 11:48:20 > $ curl -H "Accept: application/json" -XGET > http://localhost:8080/webresources/book/ > > [{"author":"a","id":1,"title":"Armagedon"},{"author":"a","id":2,"title":"curl"},{"author":"a","id":3,"title":"soemthing > to test"},{"author":"mauro","id":4,"title":"primo"}]% > The exception you were reporting were giving you the right hints 17-Jan-2022 00:23:32.804 AVVERTENZA [http-nio-8080-exec-9] org.apache.cxf.phase.PhaseInterceptorChain.doDefaultLogging Application {http://service.bookstore/}BookFacadeREST has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: java.util.HashMap cannot be cast to bookstore.entity.Book while invoking public void bookstore.service.BookFacadeREST.create(java.lang.Object) with params [{title=primo, author=mauro}]. You were sending [{title=primo, author=mauro}] 1/ create accepts A book and not MANY books, so you should send an JSON object and not a JSON array 2/ the payload you are sending isn't a valid JSON payload. Something like this is better {"title":"primo","author":"mauro"} Hope it helps -- Jean-Louis Monteiro http://twitter.com/jlouismonteiro http://www.tomitribe.com On Mon, Jan 17, 2022 at 10:48 AM Jean-Louis Monteiro < jlmonte...@tomitribe.com> wrote: > Morning, > > Haven't got time over the weekend but I'll give it a try now > -- > Jean-Louis Monteiro > http://twitter.com/jlouismonteiro > http://www.tomitribe.com > > > On Mon, Jan 17, 2022 at 12:43 AM naciu <naci...@gmail.com> wrote: > >> i created another repo with the same example but without hibernate. >> >> Here i use only tomee7.1.4Plume whit eclipse-link. >> >> https://github.com/maurojava/provaweb714plume.git >> >> try this repo please. >> Il 15/01/2022 11:14, Jean-Louis Monteiro ha scritto: >> >> Hi, >> >> I'll try to have a look over the weekend or Monday morning at the office >> if that's ok with you >> >> Best >> >> Le sam. 15 janv. 2022 à 10:02, naciu <naci...@gmail.com> a écrit : >> >>> Ho Jean-Louis. >>> >>> I writed on the users@tomee.apache.org about post request not working >>> into tomee7.1.4plume. >>> >>> The exception i get Is: >>> >>> Caused by: java.lang.ClassCastException: java.util.HashMap cannot be >>> cast to bookstore.entity.Book ``` >>> >>> >>> >>> >>> Project mybookstore on GitHub. >>> >>> https://github.com/maurojava/mybookstore/ >>> >>> The web service >>> >>> >>> https://github.com/maurojava/mybookstore/blob/master/src/main/java/bookstore/service/BookFacadeREST.java >>> >>> I get the exception when i try to create a new entity book with post >>> request from curl_ or jQuery. >>> >>> Please can you run into tomee7.1.4 and control and please Say me what >>> jar of rest i have to upgrade for get working my project? >>> Tank you in advance. >>> >>> Mauro >>> >> >> >> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >> Mail >> priva di virus. www.avast.com >> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >> <#m_-4093898945289190103_m_-3027844883123190424_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >> >