Tomcat Throws Back 400 When I Post a JSON Array [closed] - arrays

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I am posting the following JSON to Tomcat server but Tomcat server returns 400 without even calling the servlet -
[
{
"q": {
"field": "uri",
"value": "c:Data#part3"
},
"uri_pre_select": true
}
]
Inside the servlet the following code is deserializing the JSON -
// JSONObject reqJSONObj;
MyRequest[] data = gson.fromJson(reqJSONObj.toString(), MyRequest[].class);
When I remove the enclosing square brackets [ ] in the request JSON, then my servlet is called normally. This means there is something in the JSON, that is making it unacceptable to Tomcat.
But I don't have any clue why can't I post an array. Can anyone see a problem in the JSON that I am posting here ?

My mistake -
The handler method was accepting a JSONObject. When I changed the type to JSONArray it was getting called by Tomcat.

Related

DeepPartial error on initAuth0 auth0 - nextjs + typescript [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
Trying to implement auth0 on nextjs typescript.
But on initAuth0, I get below error of deep partials,
Argument of type '{ clientId: string; clientSecret: string; scope: string; domain: string; redirectUri: string; postLogoutRedirectUri: string; session: {}; }' is not assignable to parameter of type 'DeepPartial<Config>'.
Object literal may only specify known properties, but 'clientId' does not exist in type 'DeepPartial<Config>'. Did you mean to write 'clientID'?ts(2345)
initAuth0 code,
import { initAuth0 } from "#auth0/nextjs-auth0";
export default initAuth0({
clientId: process.env.AUTH0_CLIENT_ID,
clientSecret: process.env.AUTH0_CLIENT_SECRET,
scope: process.env.NEXT_PUBLIC_AUTH0_SCOPE || "openid profile",
domain: process.env.AUTH0_DOMAIN,
redirectUri:
process.env.NEXT_PUBLIC_REDIRECT_URI ||
"http://localhost:3000/api/callback",
postLogoutRedirectUri:
process.env.NEXT_PUBLIC_POST_LOGOUT_REDIRECT_URI ||
"http://localhost:3000/",
session: {
// cookieSecret: process.env.COOKIE_SECRET,
// cookieLifetime: Number(process.env.SESSION_COOKIE_LIFETIME) || 7200,
},
})
The key is the last part of the error,
Did you mean to write 'clientID'?
In your config object, you have written clientId (note the lowercase d), the config object accepted by initAuth0, however, expects clientID.
One of the most frustrating things about TypeScript is the overbearing error messages. I hope they improve them in the future.

TemplateSyntaxError: expected token ')', got 'social' [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
App Engine is giving me this error:
TemplateSyntaxError: expected token ')', got 'social'
template (/srv/templates/base.html:5)
I'm not clear why. Here's the beginning of the base.html template:
{% set navlinks = [('Home', '/'),
('Foo Bar', '/foo-bar'),
('News', '/news'),
('Contact', '/contact)] %}
{% set social_icons = [('social-icons/facebook.html', 'https://www.facebook.com/blah'),
('social-icons/twitter.html', 'https://twitter.com/blah'),
('social-icons/linkedin.html','https://www.linkedin.com/in/blah/')] %}
<!-- remainder of the template... -->
You transposed closing quote ' and ) in
('Contact', '/contact')] %}
Try:
{% set navlinks = [('Home', '/'),
('Foo Bar', '/foo-bar'),
('News', '/news'),
('Contact', '/contact)'] %}
{% set social_icons = [('social-icons/facebook.html', 'https://www.facebook.com/blah'),
('social-icons/twitter.html', 'https://twitter.com/blah'),
('social-icons/linkedin.html','https://www.linkedin.com/in/blah/')] %}
<!-- remainder of the template... -->
You missed a close quote after '/contact).

sublimeLinter "Error trying to parse file: Expected value in Packages/User/Default (OSX).sublime-keymap:2:1"

Error: "Error trying to parse file: Expected value in Packages/User/Default (OSX).sublime-keymap:2:1"
Hello, I have googled this and only found old documentation posts and answers for this problem that was on ST2 but not 3 and was posted in 2013.
I also have tried visiting the troubling shooting in the official site for sublimeLinter and the error does not seem to be listed. I guess I am one of the few who are running into this.
I am fairly new to using a text editor like ST3, so some of the terminology I am not too familiar with.
Is it possible anyone may help me with this?
So far I have attempted:
Preference>Package Control> User Settings/ Which is empty and attempted typing in some of the old answer problems.
I also attempted in pasting in:
[
{ "keys": ["ctrl+t","u"], "command": "upper_case" },
{ "keys": ["ctrl+t","l"], "command": "lower_case" }
]
that was from an answer in a older post that I found. However, the problem still persist and I ran into a brick wall when attempting to find more answers. Any help would be appreciated.
Thank you for reading.
This is an old question but I came across the same error message having tried to use the sublime linter package(s) and then deciding to uninstall. After I did this I got a similar error message to the one you describe.
I opened Preferences->Key Bindings and found the following line in the Default (OSX).sublime-keymap-User file:
/User/Default ().sublime-keymap
I commented this line out so that I now have an empty file and the error on startup has disappeared.

Null pointer exception in Google Cloud API

I've looked everywhere for the answer to this one. I'm using google pull taskqueue and adding items to the taskqueue, but when I access the pull queue I get this:
java.lang.NullPointerException
at com.google.api.client.repackaged.com.google.common.base.Preconditions.checkNotNull(Preconditions.java:191)
at com.google.api.client.util.Preconditions.checkNotNull(Preconditions.java:127)
at com.google.api.client.json.jackson2.JacksonFactory.createJsonParser(JacksonFactory.java:92)
at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:85)
at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:81)
at com.google.api.client.auth.oauth2.TokenResponseException.from(TokenResponseException.java:88)
at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:287)
at com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.java:307)
at com.google.api.client.auth.oauth2.Credential.executeRefreshToken(Credential.java:570)
at com.google.api.client.auth.oauth2.Credential.refreshToken(Credential.java:489)
at com.google.api.client.auth.oauth2.Credential.intercept(Credential.java:217)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:859)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
at com.google.api.services.samples.taskqueue.cmdline.TaskQueueSample.getQueue(TaskQueueSample.java:195)
at com.google.api.services.samples.taskqueue.cmdline.TaskQueueSample.run(TaskQueueSample.java:125)
at com.google.api.services.samples.taskqueue.cmdline.TaskQueueSample.main(TaskQueueSample.java:173)
So far I've found references to this error, and apparently it was fixed a couple of years ago. I've tried the suggestions but they don't seem to work.

Is there a list of applicationError codes & descriptions for the Google AppEngine ApplicationException?

Hello everyone and thanks up front for your time,
I am working on a java-based GAE web application and now and then I get ApiProxy.ApplicationExceptions.
In the current case they appear randomly and come with the applicationError 108 when I open a write channel to a blob using the (yes I know, still experimental) FileStore API. Although the API is still in an experimental state, I'd like to handle the thrown exception correctly. Thus my question:
Where can I find a list of possible application errors including their descriptions?
As of right now it is not possible for me to figure out where the problem resides since the thrown exception does not contain something like a message, hint or reason phrase but only the error ID 108:
Caused by: com.google.apphosting.api.ApiProxy$ApplicationException: ApplicationError: 108:
at java.lang.Thread.getStackTrace(Thread.java:1495)
at com.google.apphosting.runtime.ApiProxyImpl.doSyncCall(ApiProxyImpl.java:240)
at com.google.apphosting.runtime.ApiProxyImpl.access$000(ApiProxyImpl.java:66)
at com.google.apphosting.runtime.ApiProxyImpl$1.run(ApiProxyImpl.java:183)
at com.google.apphosting.runtime.ApiProxyImpl$1.run(ApiProxyImpl.java:180)
at java.security.AccessController.doPrivileged(Native Method)
at com.google.apphosting.runtime.ApiProxyImpl.makeSyncCall(ApiProxyImpl.java:180)
at com.google.apphosting.runtime.ApiProxyImpl.makeSyncCall(ApiProxyImpl.java:66)
at com.googlecode.objectify.cache.TriggerFutureHook.makeSyncCall(TriggerFutureHook.java:154)
at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:107)
at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:56)
at com.google.appengine.api.files.FileServiceImpl.makeSyncCall(FileServiceImpl.java:584)
... 65 more
Also, the corresponding javadoc is quite conservative with giving information: https://developers.google.com/appengine/docs/java/javadoc/com/google/apphosting/api/ApiProxy.ApplicationException
Currently I bluntly cancel these requests with a 500, but since I am not sure what has happened I should probably do something else/more.
Thanksalot!
the best information I could get is from the Python source code :
http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/api/files/file_service_pb.py

Resources