Tag Archives: An error

Common error: uncaught typeerror: document.getElementsByClassName (…).addEventListener is not a function

Problems encountered in the development of native front end:

Uncaught TypeError: document.getElementsByClassName(...).addEventListener is not a function......

reason:

The

    selector did not select the element object correctly
    the document.getElementsByClassName (… )What is captured is the array
solution of the class name element

    document.getElementsByClassName (… )[0].addEventListener…
    Select the required element object through [0]

Svn notes: error reporting in use

Error reported during use of SVN
1. The Error while creating module: org. Apache.. Subversion javahl. ClientException: Authorization failed
the SVN: authentication failed
Happened: after start SVN service, for the first time to submit project
solution: modify the configuration files of the storage directory svnserve. Conf, passwd, authz:
the first one to open the anonymous access. Modify the svnserve.conf file and change the anon-access value to write
.
modify svnserve.conf file:
en auth-access = write, password-db = passwd, authz-db = authz and set anon-access to none(otherwise error 5 will be reported)
m>y the passwd file:
add user username = password in the form of a

modify authz file: to add

set the permissions on the combination of operation such as:
[/] #
aifa = rw #
@kaifa = rw #
cesh>r # Read-Only
* = #
4
[/] # <>> @kaifa = rw #
ceshi = r # Read-Only
* = #
2. The Filesystem has no item SVN: URL ‘SVN:// localhost/OA/DesignPattern’ non – existent in revision 2

solution:
en this error occurs, we can find what symbol is on the project?And *, we just need to right-click, submit the project again,
and put it into the repository

3. SVN: E200009: Submission failed (details below):
SVN: E200009: “F:\workspace\SVN\SpaceJohnnie\OA\ hello.txt” is not under version control

F:\workspace\SVN\SpaceJohnnie\OA> SVN commit hello.txt
SVN commit hello.txt
br> SVN commit hello.txt

4. SVN: E205007: Commit failed (details below):
SVN: E205007: Unable to get log information using external editor; Consider setting the environment variable $SVN_EDITOR, or
with the –message (-m) or –file (-f) options
n: E205007: No SVN_EDITOR, VISUAL or EDITOR environment variables are set, and
h>o “editor-cmd” option in the runtime configuration parameters

SVN commit hello.txt
br> s>ommit -m “First commit” hello.txt

>commit -m “First commit” hello.txt
5.Item is not readable
SVN: encountered an unreadable path; Access denied.
happened: an error occurred when
access configuration, the anonymous access is not a value to none, namely: anon – access = none
solution:
modify svnserve. Conf file Settings anon – access = none

Using Lombok to compile and report errors

Compile with Lombok to report an error
Lombok’s official website
The jar is introduced in the project package
then Lombok plug-in installation tools in the code
add annotations of Lombok begin to use


The compiled code will report an error
1. If the IDEA tool is on, check if the
Build — Compiler — Annotation Processors option is enabled

2. If it returns an error, or if it is Eclipse
, then it is time to check the version of the problem
If you are using Java 9 or above, switch Lombok to 1.18.x
or downgrade Java to 8 or below

Solved: elasticsearch error: exception [type = search]_ phase_ execution_ exception, reason=all shards failed]

Exception in thread "main" ElasticsearchStatusException[Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]]; nested: ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=Fielddata is disabled on text fields by default. Set fielddata=true on [content_type] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.]]; nested: ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=Fielddata is disabled on text fields by default. Set fielddata=true on [content_type] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.]];
	at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:177)
	at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:1727)
	at org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:1704)
	at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1467)
	at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1424)
	at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1394)
	at org.elasticsearch.client.RestHighLevelClient.search(RestHighLevelClient.java:930)
	at com.softsec.util.demoTime.main(demoTime.java:98)
	Suppressed: org.elasticsearch.client.ResponseException: method [POST], host [http://192.168.101.92:9200], URI [/news/_search?typed_keys=true&ignore_unavailable=false&expand_wildcards=open&allow_no_indices=true&ignore_throttled=true&search_type=query_then_fetch&batched_reduce_size=512&ccs_minimize_roundtrips=true], status line [HTTP/1.1 400 Bad Request]
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [content_type] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"news","node":"8GuMfo5aRz2CCgl49bY0aQ","reason":{"type":"illegal_argument_exception","reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [content_type] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."}}],"caused_by":{"type":"illegal_argument_exception","reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [content_type] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.","caused_by":{"type":"illegal_argument_exception","reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [content_type] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."}}},"status":400}
		at org.elasticsearch.client.RestClient.convertResponse(RestClient.java:253)
		at org.elasticsearch.client.RestClient.performRequest(RestClient.java:231)
		at org.elasticsearch.client.RestClient.performRequest(RestClient.java:205)
		at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1454)
		... 4 more

This is because the string (content_type) type of my grouping aggregate query is of type Text

Reason analysis:
When using term query, the type of the query keyword on ES must be keyword rather than text because it is an accurate match. For example, if your search condition is “name” : “Cai Xukun”, then the ES type of the name field must be keyword rather than text
In es, only the keyword type string can use AggregationBuilders. Terms (” aggs – class “) to group aggregation and grouping want to query, according to the specified keyword attribute of grouping field is ok (below);

How do we change that in our Java code?Below, just add “.keyword”

 
Add to the previous error:


 

Inexplicable exception 007: git error: authentication failed for

It may be that your password to connect to git has been changed, but not the local configuration. However, Git doesn’t have pop-up boxes that prompt you to change your username and password.
Then you can do the following:
1. Open git bash here
Git config –system –unset credential. Helper
3. Then do anything like push, pull, or clone
4, You are prompted to enter the user name and password, change it
Git config –global credential. Helper store
6. Execute 3 again and enter the username and password
7, OK.

Python error: typeerror: ‘Int’ object is not subscriptable

Check the line where the error is reported, which is usually an integer with a subscript:
Such as:

a = 4
c=a[2]

Error: line 2, in <; module>
c = a [2]
TypeError: ‘int’ object is not subscriptable
Or a more complicated one: two dimensions
 

a = [1,2,3,4]
c=a[2][2]

It’s a one-dimensional array, but you take an array and then you subscript it, same problem.

javax.persistence.EntityNotFoundException : unable to find error

Javax.mail. Persistence. EntityNotFoundException: Unable to find a class with id?
The reason:
Whether @OneToone or @ManyToone, this is due to the fact that the child table (associated table) has no records corresponding to the ID in the primary table (associated table).
Solutions:

    to check why there is no record for ID in the primary table if the data can be loaded normally without a record for ID in the primary table, you need to add an @notfound Annotation to the primary table field. Example: @onetoone (optional=true)
    @joincolumn (name=”UserId “,insertable=false, updatable=false)
    @notfound (action=NotFoundAction.IGNORE)
    private UserId UserId; In this way, when no data is found in the child table, the corresponding field in the main table is null and no error is reported. Or contact the business personnel, see the data simulation problem, directly kill (I am directly killed)

SELinux solution to Apache SSL failure

The blogger today plans to configure a multi-certificate Apache so that multiple domain names can be accessed via https://***. According to the online tutorial, just add multiple < VirtualHost *:443> You can do that. But restarting HTTPD always prompts:

Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.

Journalctl-xe examines with the command:

systemd[1]: Unit httpd.service entered failed state.
systemd[1]: httpd.service failed.
polkitd[475]: Registered Authentication Agent for unix-process:7076:2357584 (system bus name :1.219 [/usr/bin/pkttyagent -.....

It’s hard to see what’s wrong (at this point the blogger doesn’t know that HTTPD has an error_log, face-covering)
After a long time, I finally opened /var/log/ HTTPD /error_log

AH02312: Fatal error initialising mod_ssl, exiting.
SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
Permission denied: AH02201: Init: Can't open server certificate file 

When the blogger saw this error message, he immediately understood that it was SELinux!! A lot of potholes on the SELinux before. So the first thing that comes to mind is that the SSL certificate file, the private key file, is not in the right context. Turning SELinux off directly would certainly solve the problem. But this is just a once-and-for-all approach that will cause more problems.
The solution
Three files are required to configure SSL:
2_domain.com.crt
3_domain.com.key
1_root_bundle.crt
Let’s say they’re all under /usr/local/apache/conf/

cd /usr/local/apache/conf/ 

Displays the current context of each file

ll -Z

Change context

chcon -u system_u -r object_r -t cert_t 1_root_bundle.crt
chcon -u system_u -r object_r -t cert_t 2_domain.com.crt
chcon -u system_u -r object_r -t cert_t 3_domain.com.key

The context configuration is not unique. If this setting doesn’t work, try something else.

Error domain = nsurlerrordomain code = – 1001 “request timeout occurred in swift alamofire get request. ” UserInfo={NSUnderlyingErro

ErrorDomain =NSURLErrorDomain Code=-1001 “request timeout.” UserInfo={NSUnderlyingError=0x1c0a48310 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 “(null)” UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}
For this reason, I have checked for a long time. There are many posts setting timeout on the Internet. However, this GET request returns this error without timeout. Here is an introduction to encoding usage scenarios
JSONEncoding. Default is placed in HttpBody, such as post requests
2. URLEncoding. Default is concatenated address in GET, such as GET request
3. URLEncoding(destination:. MethodDependent) is a custom URLEncoding. If the value of methodDependent is in GET, HEAD, and DELETE, it will be concatenated. The other methods are in the httpBody.
4. URLEncoding(destination:.httpbody) is placed in httpBody
So I replaced the previous JSONEncoding. Default with URLEncoding. Default
Alamofire.request(url, method: .get, parameters: nil, encoding:JSONEncoding.default, headers: [“Content-Type”:”application/json”]).responseJSON { (response) in
}
Alamofire.request(url, method: .get, parameters: nil, encoding:URLEncoding.default, headers: [“Content-Type”:”application/json”]).responseJSON { (response) in
}
 
 

Python error: typeerror: ‘Int’ object is not subscribable

Check the error line, the error is generally in the integer subscript:
Such as:

a = 4
c=a[2]

Error: line 2, in < module>
c = a [2]
TypeError: ‘int’ object is not subscriptable
Take the more complicated one: two dimensions
 

a = [1,2,3,4]
c=a[2][2]

It’s a one-dimensional array, but it takes an array index, and then it adds a index, same problem.