I tried to reproduce this, by introducing an error 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.

I've raised https://issues.apache.org/jira/browse/ISIS-966 for this.






On 11 November 2014 at 09:36, Erik de Hair (JIRA) <[email protected]> wrote:

> Erik de Hair created ISIS-945:
> ---------------------------------
>
>              Summary: Exception by restful different than shown by Wicket
> viewer
>                  Key: ISIS-945
>                  URL: https://issues.apache.org/jira/browse/ISIS-945
>              Project: Isis
>           Issue Type: Bug
>           Components: Core: Viewer: RestfulObjects
>     Affects Versions: core-1.7.0
>             Reporter: Erik de Hair
>             Assignee: Dan Haywood
>             Priority: Minor
>
>
> Hi,
>
> I have a service method that I only want to expose via restful. I
> suppressed the method from showing up in the Wicket viewer so I didn't try
> to call it with the Wicket viewer.
>
> Now restful throws an error (which is not very useful) when calling the
> method:
>
> org.apache.tomcat.util.http.parser.TokenMgrError: Lexical error at line 1,
> column 29.  Encountered: ":" (58), after : ""
>
> org.apache.tomcat.util.http.parser.HttpParserTokenManager.getNextToken(HttpParserTokenManager.java:434)
>
> org.apache.tomcat.util.http.parser.HttpParser.jj_ntk(HttpParser.java:300)
>
> org.apache.tomcat.util.http.parser.HttpParser.MediaType(HttpParser.java:21)
>
>
> For some reason I now also exposed the action via Wicket. That way I get
> another exception with more useful information about my problem:
>
> javax.jdo.JDOUserExceptionInvalid operator "=". Did you mean to use "=="?
>
> org.datanucleus.api.jdo.NucleusJDOHelper#getJDOExceptionForNucleusException(NucleusJDOHelper.java:549)
>     org.datanucleus.api.jdo.JDOQuery#execute(JDOQuery.java:299)
>
> nl.pocos.dom.workflow.WorkFlowStatusses#checkNumberOfPGSMLicences(WorkFlowStatusses.java:55)
>
> sun.reflect.NativeMethodAccessorImpl#invoke0(NativeMethodAccessorImpl.java:-2)
>
> sun.reflect.NativeMethodAccessorImpl#invoke(NativeMethodAccessorImpl.java:57)
>
> sun.reflect.DelegatingMethodAccessorImpl#invoke(DelegatingMethodAccessorImpl.java:43)
>     java.lang.reflect.Method#invoke(Method.java:606)
>
> After fixing this error the restful call works fine. I had this behaviour
> before but couldn't reproduce it. It looks like the TokenMgrError is thrown
> when some exception occurs in an action called via restful and the real
> reason/exception can't be found in the logs.
>
>
>
> --
> This message was sent by Atlassian JIRA
> (v6.3.4#6332)
>

Reply via email to