Author Archives: Robins

[Solved] Zookeeper3.6.0 Error: Error contacting service. It is probably not running

Zookeeper 3.6.0 error contacting service. It is probable not running

Record the errors encountered when installing zookeeper. I searched for a long time and didn’t find a specific solution

Maybe it’s because I’m too lazy to read the log. I also remind myself that if there is a problem, I shouldn’t think about going to Baidu immediately. I should look at the log first

The virtual machine itself starts tomcat, and zookeeper will have conflicts when starting adminserver

there are many solutions:
I modified the zoo.cfg file myself

Just restart zookeeper again

[Solved] Hibernate Error: java.lang.StackOverflowError at java.lang.Integer.toString(Integer.java:402)

1. Problem Description:

When using hibernate to query the database, the data has been successfully found from the database, but an error is reported when looping through the output: java.lang.stackoverflowerror

2. Solution process:

2.1 this is my query method:

@Test
public void test01() {
     Session session = SessionFactoryUtil.getSessionFactory().openSession();
     String hql = "from Student";

     Query query = session.createQuery(hql);
     List list = query.list();
     list.forEach(System.out::println);
 }

2.2 this is an error message:

java.lang.StackOverflowError
	at java.lang.Integer.toString(Integer.java:402)
	at java.lang.Integer.toString(Integer.java:935)
	at java.lang.String.valueOf(String.java:2994)
	at java.lang.StringBuilder.append(StringBuilder.java:131)
	at Course.toString(Course.java:16)
	at java.lang.String.valueOf(String.java:2994)
	at java.lang.StringBuilder.append(StringBuilder.java:131)
	at java.util.AbstractCollection.toString(AbstractCollection.java:462)
	at org.hibernate.collection.internal.PersistentBag.toString(PersistentBag.java:622)
	at java.lang.String.valueOf(String.java:2994)
	at java.lang.StringBuilder.append(StringBuilder.java:131)
	at Student.toString(Student.java:25)
	at java.lang.String.valueOf(String.java:2994)
	at java.lang.StringBuilder.append(StringBuilder.java:131)
	at java.util.AbstractCollection.toString(AbstractCollection.java:462)
	at org.hibernate.collection.internal.PersistentBag.toString(PersistentBag.java:622)
	at java.lang.String.valueOf(String.java:2994)
	at java.lang.StringBuilder.append(StringBuilder.java:131)
	at Course.toString(Course.java:16)
	at java.lang.String.valueOf(String.java:2994)
	at java.lang.StringBuilder.append(StringBuilder.java:131)
	at java.util.AbstractCollection.toString(AbstractCollection.java:462)
	at org.hibernate.collection.internal.PersistentBag.toString(PersistentBag.java:622)
	at java.lang.String.valueOf(String.java:2994)
	at java.lang.StringBuilder.append(StringBuilder.java:131)
	at Student.toString(Student.java:25)
	......loop

2.3 check the error message and find that the top exception points to my Lombok annotation: @data

2.4 it is suspected that hibernate does not support Lombok

So I changed all the annotations to setter, getter and toString methods
and then reported the same error. This time, I pointed to the line of outputting courselist in the toString method of my student class

2.5 take a look at my two entity classes:

Student class:

@Data
@NoArgsConstructor
@AllArgsConstructor
@ManagedBean(name = "student")
@Entity(name = "student")
public class Student {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    private String name;

    @ManyToMany
    private List<Course> courseList;

}

Course class:

@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity(name = "course")
@ManagedBean(name = "course")
public class Course {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    private String name;
    private Integer no;

    @ManyToMany(mappedBy = "courseList")
    private List<Student> studentList;
    
}

Note: student and course are many to many, so each class has a collection of each other

2.6 finding problems:

It is not difficult to find that there is a course collection courselist in the student class, and there is also a student collection studentlist in the course class. Therefore, when outputting, it enters a wireless loop process, which is briefly described as follows:

student -> course -> student->course...

3. Solution:

Delete the line that outputs studentlist in the tostring() method in the Course class, and only keep the line that outputs courselist in the student class. Or just keep the output of studentlist in the Course class

[Solved] Golden Gate ggsci start manager: ERROR: Parameter file mgr.prm does not exist.

1. An error is thrown when starting Ogg. Error: parameter file/Ogg/dirprm/mgr.prm does not exist

[oracle@node01:/ogg]$ ggsci

Oracle GoldenGate Command Interpreter for Oracle
Version 19.1.0.0.4 OGGCORE_19.1.0.0.0_PLATFORMS_191017.1054_FBO
Linux, x64, 64bit (optimized), Oracle 19c on Oct 17 2019 21:16:29
Operating system character set identified as UTF-8.

Copyright (C) 1995, 2019, Oracle and/or its affiliates. All rights reserved.



GGSCI (node01) 1> start mgr
ERROR: Parameter file /ogg/dirprm/mgr.prm does not exist.

GGSCI (node01) 3> info all                                

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     STOPPED

2. Execute commands using Oracle users

[oracle@node01:/ogg]$ cd /ogg
[oracle@node01:/ogg]$ mkdir dirprm
[oracle@node01:/ogg]$ mkdir dirrpt
[oracle@node01:/ogg]$ mkdir dirpcs

3. Execute the command to add a port

GGSCI (node01) 5> edit param mgr
add
PORT 7809

GGSCI (node01) 6> start manager
Manager started.

GGSCI (node01) 7> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING

[Solved] Redis Error: Creating Server TCP listening socket *:6379: bind: No error

Error:
the redis service starts under the window, and an error is reported:
Creating server TCP listening socket *: 6379: bind: no error

Reason:
port 6379 has been bound. It should be because the service was not closed last time

Solution:
① enter the command in sequence:

Redis cli.exe
(start the redis client, connect to port 6379 of the local machine (127.0.0.1) and start the redis service) shutdownexit

② Start redis service: redis-server.exe redis. Windows.conf

[after configuring the service, start the service command redis server — service start close the service redis server — service stop]

RSA Decryption Error: java.security.InvalidKeyException: IOException : algid parse error, not a sequence

To get a private key, you need to decrypt the encrypted data. I can’t figure it out. When I get the privatekey, I report an error algid parse error, not a sequence

KeyFactory.getInstance("RSA").generatePrivate(
                    new PKCS8EncodedKeySpec(Encodes.decodeBase64("priKey")))

The reason is that the private key string is not in PKCs #8’s format and cannot be transferred without using a third-party jar

One solution is to use OpenSSL to convert the private key string into pkcs#8 format

The second is to use the third-party library. I use the third-party library bouncy castle, which is more convenient and fast. I don’t bother to install OpenSSL

pom:

<dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcprov-jdk15on</artifactId>
                <version>1.59</version>
            </dependency>
            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcmail-jdk15on</artifactId>
                <version>1.59</version>
            </dependency>
            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcpkix-jdk15on</artifactId>
                <version>1.59</version>
            </dependency>

Restore private/public key to PEM file

public static PrivateKey get10027504355PrivateKey() throws Exception {
        BufferedReader br=new BufferedReader(new InputStreamReader(ClassLoader.getSystemResourceAsStream("config/10027504355ssl.pem")));
        PEMParser pemParser = new PEMParser(br);
        PEMKeyPair pemKeyPair = (PEMKeyPair)pemParser.readObject();
        pemParser.close();
        JcaPEMKeyConverter converter = new JcaPEMKeyConverter();
        KeyPair keyPair = converter.getKeyPair(pemKeyPair);
        PublicKey publicKey=keyPair.getPublic();
        return keyPair.getPrivate();
    }

Add bouncycastleprovider when the application starts and initialize it once

package com.mktpay.admin.init;

import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.security.Security;

/**
 * @ClassName Runner
 * @Author yupanpan
 * @Date 2021/10/11 15:03
 */
@Component
public class EDncryptRunner implements CommandLineRunner {
    @Override
    public void run(String... args) throws Exception {
        //Customize other ways to initialize encryption and decryption algorithms
        Security.addProvider(new BouncyCastleProvider());
    }
}

[Solved] FATAL CONFIG FILE ERROR: Bad directive or wrong number of arguments

Error message

Error reporting reason

The reason is that it is not allowed to add comments after the same valid code line in some configuration files (such as. Conf files, which are widely seen here), which will compile and execute the following comments as the parameters passed in from the current command line; If there are no parameters in the command configuration or the format of the parameters is wrong, an error will be reported naturally
for example:

Solution

Divide the original configuration into two lines of commands and comments

WPF path = (validation. Errors) [0]. Errorcontent reports a binding error

System.Windows.Data Error: 17 : Cannot get ‘Item[]’ value (type ‘ValidationError’) from ‘(Validation.Errors)’ (type ‘ReadOnlyObservableCollection`1′). BindingExpression:Path=AdornedElement.(0)[0].ErrorContent; DataItem=’AdornedElementPlaceholder’ (Name=’customAdorner’); target element is ‘TextBlock'(Name=”); target property is ‘Text’ (type ‘String’) ArgumentOutOfRangeException:’System.ArgumentOutOfRangeException: The specified parameter is out of the range of valid values.

Correct binding method:

Path=(Validation.Errors)/ErrorContent

Error: Projects must list all files or use an ‘include‘ pattern.

When importing a file, the file clearly exists but an error is reported:

File 'xxx/packages/@vue/src/use-list.ts' is not listed within the file list of project 'xxx/packages@/vue/tsconfig.json'. Projects must list all files or use an 'include' pattern.

resolvent:

  stay   Is not listed within the file to add or modify a regular path to the include in the file indicated.

At present, the file indicating the path regularity problem is tsconfig.json, so go to the tsconfig.json file to view the include item.

tsconfig.json:

{
  "include": ["src"],
}

Modified tsconfig.json:

{
  "include": ["src/**/*.ts"],
}

Error = 2, no such file or director is prompted in the lower left corner of the MAC pycharm running file

Background:
System: MAC system
problem: Python runs the python project provided by others, but the file in the project exists, but it prompts that there is no such file
specific error:
error: cannot run program “/ users/Bob/pychamprojects/untitled/venv/bin/Python” (in directory “/ users/Bob/desktop/1”): error = 2, no such file or director

Solution:
delete the hidden. Idea file under the project, restart pycharm and run it again

Error starting ApplicationContext. To display the conditions report re-run your application with

This error message may appear when opening Java programs in idea. Generally, it is reminded   Server startup failed. Port XXXX is already in use.

  Go and see your POM file at this time

Comment out the dependency of hot deployment!!!!

 

  OK! Remember to refresh Maven after commenting

Start successful   

[salesforce] prompt error deploying or retrieving source when vscode pulls the code

Prompt error deploying or retrieving source when vscode pulls the code

When sfdx: retrieve this source from org is executed, the following information is prompted:

Error deploying or retrieving source: The file or directory that you tried to deploy or retrieve isn’t in a package directory that’s specified in your sfdx-project.json file. Add this location to your “packageDirectories” value

resolvent

Open the sfdx project. JSON configuration file (in the root directory or Ctrl + P search)

Add the following elements to the "packagedirectories" attribute array of the configuration file:

    {
      "path": "XXX",
      "default": false
    }

Note that path is the directory (root directory) where the file you want to pull is located. For example, the root directory of your file is called “functional”, and XXX here will fill in functional .

Save after adding, and then pull the file again.