问题
I am using MobileFirst CLI 7.1, Java 1.8.0_65 (on Mac OS X 10.9.5 if it matters). I have been working without issue in my current environment for about a month now but have suddenly hit an issue with all the adapters I developed, which have been working successfully up until this point.
The initial error surfaced when testing from a browser. I thought perhaps it was related to the way the WL JavaScript libraries authenticate with the adapters which run on the server (clearing the browser cache usually resolves this but not in this case).
[.../common/query] failure. state: 500, response: undefinedWL.Logger.__log @ worklight.js:5377
worklight.js:5377 Client registration failed with error: {"responseHeaders":{"$WSEP":"","Date":"Tue, 08 Dec 2015 14:07:51 GMT","Connection":"Close","Content-Type":"text/html;charset=UTF-8","X-Powered-By":"Servlet/3.0","Transfer-Encoding":"chunked","Content-Language":"en-...
When this didn't work I tried testing the adapters from the CLI with a resulting error
undefined:1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.
^
SyntaxError: Unexpected token <
at Object.parse (native)
...
Not very helpful and no real info in the console log either (at least none which makes sense)
I was in the process of writing a Java adapter last week, so I thought I would try that to see if I get a different response (I have also tried creating a new project and empty adapter with the same results btw). Basically testing from the command line seemed to work (no response, but no error either). I didn't think it was working though (sceptical as I am), so I aimed to test the same adapter using a Chrome plugin (the Advanced REST Client plugin). I actually didn't get to the point of testing the adapter because the POST to get the auth token failed (you post the following url /authorization/v1/testtoken and should get the auth token back). What I actually received was a chunk of HTML.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
...
<div id="error"> Exception thrown by application class 'org.apache.wink.server.internal.RequestProcessor.logException:273'
</div>
<div id="code">
java.lang.NullPointerException: <br>
<div id="stack">at org.apache.wink.server.internal.RequestProcessor.logException(RequestProcessor.java:273)<br>at org.apache.wink.server.internal.RequestProcessor.handleRequestWithoutFaultBarrier(RequestProcessor.java:226)<br>at org.apache.wink.server.internal.RequestProcessor.handleRequest(RequestProcessor.java:154)<br>at org.apache.wink.server.internal.servlet.RestServlet.service(RestServlet.java:133)<br>at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)<br>at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1285)<br>at [internal classes]<br>at **com.worklight.authorization.server.AuthorizationServerFilter.doFilter**(AuthorizationServerFilter.java:88)<br>at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:206)<br>at [internal classes]<br>at com.worklight.analytics.AnalyticsFilter.doFilter(AnalyticsFilter.java:124)<br>at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:206)<br>at [internal classes]<br>
</div>
</div>
It looks to me like the authorisation filter is failing for some unknown reason. I did try uninstalling and re-installing MF CLI yesterday but this error just re-surfaced. It is the only thing I can think to do again, but maybe I missed some local files which I need to delete manually after the uninstall is complete ...? Last time I deleted everything under ~/.ibm pretty much
I just found this post in developerworks which mentions a similar issue to the one I am seeing.
https://www.ibm.com/developerworks/community/forums/html/topic?id=ae0a1814-7ce3-49f5-b582-c9ecf16fa51a
The reason this also rings true is that I was playing around with a JavaAdapter which I was planning on using to interface with a back-office RESTful service. I had problems and toyed with the idea of using Jersey at one point. I think I copied at least one Jersey jar file into the project's server/lib folder at one point and may have pushed this to the server. Having done this though I would have expected, having once again uninstalled, deleted everything under ~/.ibm and re-installed, that the jars would no longer be present. I still get the same issue.
Is it possible that uninstall does not delete the liberty profile or WAS configuration and that these jars somehow persist?
回答1:
Turns out there is an issue with the current/latest release of MobileFirst CLI (20151130-1653). I backed up to a previous release (20150913-2352) and my adapters started working again - obviously I cleaned up servers and tmp files during the re-installation process.
I believe there have been quite a few people raising the same issue and it has been raised as a PMR internally within IBM.
来源:https://stackoverflow.com/questions/34158550/issue-accessing-mobilefirst-adapters