java - Jersey REST-API returns a HTTP Error 500 (but only client-side) -


I am currently working on a REST-API I am using jerseys for this.
I had done some interfaces programs first, and they all worked fine now, I am doing it in the same way (in my opinion), but it will not work in any way.

The problem is that UserGet () does not log any error (the error does not lie within TRY-CATCH), and it is successfully executed like the method. But the client receives only the "500 internal server error" -and reference.

Do you have no idea how this will know where the error occurs? Or do you already know what I have done?

This is my class that should be returned by the API:

  package myproject.model; Import javax.xml.bind.annotation.XmlAccessType; Import javax.xml.bind.annotation.XmlAccessorType; Import javax.xml.bind.annotation.XmlElement; Import javax.xml.bind.annotation.XmlRootElement; Import javax.xml.bind.annotation.XmlTransient; @XmlRootElement @XmlAccessorType (XmlAccessType.FIELD) Public class UserModel {@XmlElement (name = "id") Private long id = -1; @ XmlElement (name = "strUsername") Private string user name = null; @ XML Transgenent Private String Encrypted Password = Faucet; @ XMLElement (name = "advisory", Nilele = true) personal advisory consultant = null; Public user modal (long id, string username, string encrypt, co-consultant) {this.id = id; This.username = Username; This.encryptedPassword = encPw; This Consultant = co; } User Stable User MODEL (User U) from User {New User MODEL (U.A.G.I.D.), U.GetName (), U.F. encrypted password (), UAGET Consultant ()); } Public user toUser () {return User.fromUserModel (this); } Public long IID (return) {return ID; } Public string getUsername () {back username; } Get public string encrypted password () {encrypted password; } Public Advisor getConsultant () {Return Consultant; } Public String Tustring () {return "id =" + id + "; username =" + username + "; encPw =" + encrypted password; }}  

My REST-API:

  Package myproject.rest; Import java.sql.Connection; Import java.util.ArrayList; Import java.util.Iterator; Import java.util.list; Import javax.ws.rs.GET; Import javax.ws.rs.Path; Import javax.ws.rs.produces; Import javax.ws.rs.core.GenericEntity; Import javax.ws.rs.core.MediaType; Import javax.ws.rs.core.Response; Import org.apache.log4j.Logger; Import org.json.JSONObject; Import myproject.User; Import myproject.UserModel; Import myproject.DBUtil; Import myproject.SecurityUtil; @ Path ( "/ app / user") public class Handler User Restandpoint (private static Logger log = Lkdharakgetlagajr (handler Usr. Square); @GET @ product (Meediatipp.apeepielsiasn_jesoan) public reaction Upyogkrtaget () {connection but = null; Try {con = DBUtil.getDBConnection (); //SecurityUtil.checkRight(request); Log.info ( "Collect all users"); list & lt; UserModel & gt; Usermodels = new Arrelist & lt; Ughrmodel & Gt; (); Iterator & lt; Users & gt; This = Ughrktet (all). While (This Haas next ()) {Usermodelskadd (Itknext). ToUserModel ()); } GenericInterity & lt; List & lt; User Module & gt; & Gt; Unit = new generic antities & lt; List & lt; User Module & gt; & Gt; (USModel) {}; Return Response.ok () Unit (unit) .build (); } Hold (exception e) {log. Terror ("An error occurred:" + e.toString ()); Return response.States (401) .INT (E. T. Sting ()). Build (); } Finally {DBUtil.close (tap, null, election); }}}  

Edit: User.toUserModel () does change UserModel- object to a User-Object (which works fine)


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -