IBM Worklight: AdapterAuthRealmChallengeHandler.submitSuccess() generates invalid http header - authentication

in previously correctly working dev. environment with WL 6.1.0.01.20140311-2356 after upgrade to Chrome 37.0.2062.120 there is now the following error when calling submitSuccess during authentication.
CHROME BROWSER LOG:
Uncaught SyntaxError: Failed to execute 'setRequestHeader' on
'XMLHttpRequest':
'{"wl_deviceNoProvisioningRealm":{"ID":{"token":"pg8cd4gnjh1kb0sjko6h1chqr4","app":{"id":"Moje
ČZU","version":"1.0"},"device":{"id":"previewDummyId","os":"previewDummyOS","model":"previewDummyModel","environment":"preview"},"custom":{}}}}'
is not a valid HTTP header field value.
WL SERVER LOG:
SRVE0777E: Exception thrown by application class
'com.worklight.core.auth.impl.AuthenticationContext.pushCurrentResource:398'
com.worklight.server.auth.api.WorkLightAuthenticationException at
com.worklight.core.auth.impl.AuthenticationContext.pushCurrentResource(AuthenticationContext.java:398)
at
com.worklight.core.auth.impl.AuthenticationServiceBean.accessResource(AuthenticationServiceBean.java:75)
at
com.worklight.integration.services.impl.DataAccessServiceImpl.invokeProcedureInternal(DataAccessServiceImpl.java:389)
at
com.worklight.integration.services.impl.DataAccessServiceImpl.invokeProcedure(DataAccessServiceImpl.java:112)
at
com.worklight.gadgets.serving.handler.BackendQueryHandler.getContent(BackendQueryHandler.java:182)
at
com.worklight.gadgets.serving.handler.BackendQueryHandler.doPost(BackendQueryHandler.java:73)
at
com.worklight.gadgets.serving.GadgetAPIServlet.doGetOrPost(GadgetAPIServlet.java:141)
at
com.worklight.gadgets.serving.GadgetAPIServlet.doPost(GadgetAPIServlet.java:103)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:595) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:668) at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1240)
at [internal classes] at
com.worklight.core.auth.impl.AuthenticationFilter$1.execute(AuthenticationFilter.java:191)
at
com.worklight.core.auth.impl.AuthenticationServiceBean.accessResource(AuthenticationServiceBean.java:76)
at
com.worklight.core.auth.impl.AuthenticationFilter.doFilter(AuthenticationFilter.java:195)
at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:194)
at [internal classes]
not sure if "Moje ĆZU" latin2 character here not causing the issue?
Previous steps in authentication process looks working fine.
Firefox and Opera are also stuck but with different behavior.
However, when the app is deployed to Android device App still works fine.

This looks like an encoding issue.
When generating an application for the first time, the application id value in application-descriptor.xml is generated from the chosen app name; you can then alter it to anything else you'd like.
Note, though, that when adding a mobile environment the same value is used there as well, so if you are altering the value after already creating a mobile environment (which will have the "native" folder), you need to remove that native folder to have all artifacts re-generated correctly. Or, do a find all/replace and verify everything is working.
Worklight will not auto-replace this value after changing it in application-descriptor.xml.

Related

Worklight 6.2 - Issue with cookies that have command and ampersand

It seems the server included in the studio environment doesn't like certain forms of cookies. If you have a cookie with both a command and ampersand in it, the part of the server that serves static assets starts throwing 500s (although any worklight adapter calls still work).
To repro:
Using WL studio version: 0801-1709
Open a worklight mobile web app in chrome (e.g. http://localhost:10080/<project>/apps/services/preview/<app>/mobilewebapp/1.0/default/MobileSite.html)
Open the Chrome developer console and set a cookie: document.cookie="foobar=or,e & o"
Reload the page
Result: You get the following error on all the static asset request (HTML, JS, CSS, etc.)
Application Error
SRVE0777E: Exception thrown by application class 'javax.servlet.http.Cookie.:139'
java.lang.IllegalArgumentException: Cookie name "e & o" is a reserved token
at javax.servlet.http.Cookie.(Cookie.java:139)
at com.ibm.ws.webcontainer.osgi.request.IRequestImpl.getCookies(IRequestImpl.java:151)
at [internal classes]
Additional info:
This doesn't occur on WL 6.1
This doesn't occur on the GA level of the SERVER (I don't the ability to test the 0801 level of SERVER nor the GA level of studio)
Error appears to be triggered by the combination of having both command and ampersand.
Please let me know if there's any more info I can provide to help track down this issue.
This might share some light link. I think the main thing to take from this is not to have whitespace between special characters like the ampersand.

IBM Worklight 6.1.0.1 - "file not found service/random" for Mobile Web environment

I have implement Encrypted Cache in my application. When testing is in the Mobile Web environment using the mobile browser in my device, I get the following exception:
[ERROR ] FWLSE0048E: Unhandled exception caught: SRVE0190E: File not
found: /apps/services/BMA_app/apps/services/random
java.io.FileNotFoundException: SRVE0190E: File not found:
/apps/services/BMA_app/apps/services/random at
com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:496)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:127)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:88)
at
com.worklight.core.auth.impl.AuthenticationFilter$1.execute(AuthenticationFilter.java:191)
at
com.worklight.core.auth.impl.AuthenticationServiceBean.accessResource(AuthenticationServiceBean.java:76)
at
com.worklight.core.auth.impl.AuthenticationFilter.doFilter(AuthenticationFilter.java:195)
at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:194)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:85)
at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:949)
at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1029)
at
com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4499)
at
com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(DynamicVirtualHost.java:282)
at
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:954)
at
com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:252)
at
com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:584)
at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:439)
at com.ibm.ws.threading.internal.Worker.run(Worker.java:421) at
java.lang.Thread.run(Thread.java:701) [project BMA_app] SRVE0190E:
File not found: /apps/services/BMA_app/apps/services/random
When testing in other environments, the error does not occur.
EDIT: I just saw that, this service allows to get a key for encrypted cache. It allows to open it. Given that, the service is 404, I got a failure for opening cache.
Moreover, the Worklight Console gives me this URL for mobile web app:
http:/my-server:port/BMA_app/apps/services/www/BMA_app/mobilewebapp/
the app tries to get a key for encrypted cache and send to http:/my-server:port/BMA_app/apps/services/BMA_app/apps/services/random
^ 404 error
If we cut this previous url to http://my-server:port/BMA_app/apps/services/random, it works.
It seems that in the URL "BMA_app/apps/services" is repeated twice instead of once.
Why and how to resolve it ?
Looks like you may have encountered a defect.
Testing in 6.1.0.1 with the Encrypted Cache sample project and adding to it the Mobile Web environment, if you use the link provided by the "Get App URL" button - then when you try to "open cache" from the app, it will fail with status code 10. This status code means that the app was unable to connect to the Worklight Server's Random generator service.
Indeed, when inspecting the console log, the app tries to connect to the following URL, where "EncryptedCache/apps/services" is repeated twice...:
http://192.168.1.101:10080/EncryptedCache/apps/services/EncryptedCache/apps/services/random?isAjaxRequest=true&x=0.18816258828155696
There is no workaround for this defect as it is the framework that generates the URL.
I have opened a defect.
If you are an IBM customer or business partner and require a fix, you can open a PMR and mention this Stackoverflow question.
Moving forward, the fix will be available in an iFix and any future fixpack released.

JVMVRFY013 class loading constraint violated when using xsl on remote test server

We are having an issue with an adapter procedure that uses xsl… To isolate I created a new adapter and ran with the example procedures (getStories, getStoriesFiltered) via procedure invocation via a direct HTTP request and via a native mobile application (iOS).
“Just in case” both procedures were tested both without the securityTest attribute and with.
In the case of getStories (which has no xsl filtering) the result was returned on both the http request and the native app. This is both in the local dev WL server and when deployed to the remote WL test server.
In the case of getStoriesFiltered (which has an xsl filter) on the local dev WL server it runs fine. With the adapter deployed to the remote WL test server we get an error… details are:
Error from Invoking from a browser:
/-secure- {"errors":["Verify Error: java.lang.VerifyError: JVMVRFY013
class loading constraint violated;
class=org/apache/xalan/xsltc/dom/SAXImpl,
method=getAxisIterator(I)Lorg/apache/xml/dtm/DTMAxisIterator;,
pc=0"],"isSuccessful":false,"warnings":[],"info":[]}/
Error from invoking from a native mobile client (iOS):
2014-05-16 16:36:46.681 iOSNativeApp[1109:60b] Procedure Invocation
Failure: Invocation failure. /-secure-
{"responseID":"1","errors":["Verify Error: java.lang.VerifyError:
JVMVRFY013 class loading constraint violated;
class=org/apache/xalan/xsltc/dom/SAXImpl,
method=getAxisIterator(I)Lorg/apache/xml/dtm/DTMAxisIterator;,
pc=0"],"isSuccessful":false,"WL-Authentication-Success":{"wl_remoteDisableRealm":{"userId":"null","attributes":{},"isUserAuthenticated":1,"displayName":"null"},"wl_antiXSRFRealm":{"userId":"u9eb8v4tpofoartngepouli22q","attributes":{},"isUserAuthenticated":1,"displayName":"u9eb8v4tpofoartngepouli22q"},"wl_deviceNoProvisioningRealm":{"userId":"10C0FDF9-8537-47E7-99B3-99E41ABC7956","attributes":{"mobileClientData":"com.worklight.core.auth.ext.MobileClientData#2b13dac8"},"isUserAuthenticated":1,"displayName":"10C0FDF9-8537-47E7-99B3-99E41ABC7956"},"wl_anonymousUserRealm":{"userId":"484ed960-5aaf-48b0-a05d-166e38613d47","attributes":{},"isUserAuthenticated":1,"displayName":"484ed960-5aaf-48b0-a05d-166e38613d47"}},"warnings":[],"info":[]}/
Running Worklight on Liberty.
Please always mention your Worklight version when asking a question...
In any case, this specific error is due to a regression in recently released versions of Worklight:
5.0.6.2-IF201403101802
6.0.0.2
6.1.0.1
An iFix for 6.1.0.1 should be released shortly, with iFixes for 5.0.6.2 and 6.0.0.2 to arrive soon.
To access an iFix, login to IBM Fix Central and download the latest iFix available for your version of Worklight (released on or after May 15th)

WorkLighr 6.0 Deployement on windows 8 issue

I am still working to ibm-worklight 6.0 mobile application , it's working fine my local eclipse development server. but i am going to install the the liberty based using WAS server while i deploye the worklight WAR file is not working. am i got the error below that,
Exception thrown by application class
'com.worklight.core.auth.impl.AuthenticationFilter.doFilter:110'
javax.servlet.ServletException: Worklight Project not initialized at
com.worklight.core.auth.impl.AuthenticationFilter.doFilter(AuthenticationFilter.java:110)
at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:194)
at [internal classes]
What is exactly problem on my application or server installation
This normally comes if the AuthenticationConfig file is having errors, re-check your authentication config and worklight.properties file. Make sure that while deploying for remote server, you have changed the Servername / URL etc

glassfish server admin console stalls saying: The admin console application is loaded

I am having some trouble getting into my glassfish server admin console (although I think it may actually be a symptom of a larger problem)
What I am seeing is that when I go to: http://localhost:4848/ I get a page that says: Welcome to glassfish server open source edition 3.1 (build 43) and then a status section below that. The status makes it to "The admin console application is loaded" but seems to stall there. If I refresh the page, it is just a blank page. I have to reboot the glassfish server from eclipse in order to get back to that "welcome to glassfish" page.
I looked in my server logs and found a ton of "SEVERE" problems, all of which seem to relate to this one:
[#|2011-10-06T18:03:10.869-0500|SEVERE|glassfish3.1|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=100;_ThreadName=Thread-1;|Exception while invoking class com.sun.enterprise.web.WebApplication start method
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.util.ServiceConfigurationError: javax.servlet.ServletContainerInitializer: Error reading configuration file
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:130)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:286)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:364)
at com.sun.enterprise.v3.admin.adapter.InstallerThread.load(InstallerThread.java:210)
at com.sun.enterprise.v3.admin.adapter.InstallerThread.run(InstallerThread.java:108)
|#]
Has anyone have any thoughts on what might be going on here? I'm very new to glassfish and rather confused! Thanks in advance.
Avtar
I think I had similar problem when running on Open JDK, check which JDK are you using, if its' openjdk then dowload and set as your default sun-jdk