freme-project / e-Link

Apache License 2.0
0 stars 0 forks source link

Bug in POST template #47

Closed jnehring closed 8 years ago

jnehring commented 8 years ago

POST template (http://api-dev.freme-project.eu/doc/api-doc/full.html#!/e-Link/createTemplate) produces this bug:

{
  "exception": "eu.freme.broker.exception.InternalServerErrorException",
  "path": "/e-link/templates/",
  "message": "java.lang.String cannot be cast to eu.freme.common.persistence.model.User",
  "error": "Internal Server Error",
  "status": 500,
  "timestamp": 1444298450765
* Closing connection 0
}
ERROR   2015-10-08 12:00:33,187 [http-nio-8080-exec-9] eu.freme.broker.eservices.ELink  - 
java.lang.ClassCastException: java.lang.String cannot be cast to eu.freme.common.persistence.model.User
    at eu.freme.common.persistence.model.OwnedResource.<init>(OwnedResource.java:90)
    at eu.freme.common.persistence.model.Template.<init>(Template.java:56)
    at eu.freme.broker.eservices.ELink.createTemplate(ELink.java:230)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)
ArneBinder commented 8 years ago

@m1ci Note: it is not possible to upload a template as anonymousUser, you have to be logged in.

To achive this, create an user via tho documentation page for instance, then authenticate. You will get a token which you have to attach as X-Auth-Token in the header or as value of the query parameter "token" when sending the POST request to create a new template. This does not work via the documentation page until this is implented. Use something like curl, also postman seems to be a handy tool.

later on there will be an article in the knowledge base about the needs of authentification for certain Freme services.

Please close, after reading.

m1ci commented 8 years ago

works, thanks!