Uploaded image for project: 'Isis'
  1. Isis
  2. ISIS-966

Restful viewer doesn't return a JSON representation when hits a 500 internally (instead getting an HTML page)

    Details

      Description

      originally raised on the dev mailing list by Erik de Hair...

      ~~~
      I've reproduce the issue, by introducing a deliberate bug in the todo app, changing one of the queries in ToDoItem:

      @javax.jdo.annotations.Query(
      name = "findByOwnedByAndCompleteIsFalse", language = "JDOQL",
      value = "SELECT "
      + "FROM dom.todo.ToDoItem "
      + "WHERE ownedBy == :ownedBy "
      + " && complete = false"),

      where "complete == false" has been changed to "complete = false".

      In the Wicket viewer - as hoped - I got the error page with a big nasty stacktrace that included:

      javax.jdo.JDOUserException
      Invalid operator "=". Did you mean to use "=="?
      org.datanucleus.api.jdo.NucleusJDOHelper#getJDOExceptionForNucleusException(NucleusJDOHelper.java:549)
      org.datanucleus.api.jdo.JDOQuery#executeWithMap(JDOQuery.java:351)
      org.apache.isis.objectstore.jdo.datanucleus.persistence.queries.PersistenceQueryFindUsingApplibQueryProc

      In the Restful viewer, when I invoked http://localhost:8080/restful/services/ToDoItems/actions/notYetComplete/invoke I got something an HTML error:

      HTTP ERROR 500

      Problem accessing /restful/services/ToDoItems/actions/notYetComplete/invoke. Reason:

      javax.jdo.JDOUserException: Invalid operator "=". Did you mean to use "=="?
      NestedThrowables:
      org.datanucleus.store.query.QueryCompilerSyntaxException: Invalid operator "=". Did you mean to use "=="?
      Caused by:

      org.apache.isis.core.commons.exceptions.IsisException: javax.jdo.JDOUserException: Invalid operator "=". Did you mean to use "=="?
      NestedThrowables:
      org.datanucleus.store.query.QueryCompilerSyntaxException: Invalid operator "=". Did you mean to use "=="?
      at org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.executeWithinTransaction(IsisTransactionManager.java:217)
      at org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction.invoke(ActionInvocationFacetWrapTransaction.java:54)
      at org.apache.isis.core.metamodel.specloader.specimpl.ObjectActionImpl.execute(ObjectActionImpl.java:367)
      at org.apache.isis.viewer.restfulobjects.server.resources.DomainResourceHelper.invokeActionUsingAdapters(DomainResourceHelper.java:306)
      at org.apache.isis.viewer.restfulobjects.server.resources.DomainResourceHelper.invokeActionQueryOnly(DomainResourceHelper.java:251)
      at org.apache.isis.viewer.restfulobjects.server.resources.DomainServiceResourceServerside.invokeActionQueryOnly(DomainServiceResourceServerside.java:165)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      ~~~~

      So, I think the issue is that the Restful viewer, although it's throwing a 500 response error as expected, is also returning HTML rather than JSON error page.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              danhaywood Dan Haywood
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: