问:
Spring Boot TestRestTemplate return null body
Havin a quite very simple test class followed by a video tut:

```<code>@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
public class TestClassTest {

@LocalServerPort
private int port;

@Autowired
private TestRestTemplate testRestTemmplate;

@Test
public void test_one() {

    String url = "http://localhost:" + port + "/v1/read";
    UriComponents builder = UriComponentsBuilder.fromHttpUrl(url).build();
    HttpHeaders headers = new HttpHeaders();
    headers.set("accept", "application/json");

    HttpEntity<String> requestEntity = new HttpEntity<>(null, headers);
    ResponseEntity<String> response = testRestTemmplate.exchange(builder.toString(), HttpMethod.GET, requestEntity, String.class);
    System.out.println(response.getBody());

    assertEquals(HttpStatus.OK, response.getStatusCode());

}
</code>```

}

The underlying controller class for test looks like:

```<code>@RestController
public class TestController {

@RequestMapping(value = "/v1/read", method = RequestMethod.GET, produces = "application/json")
public ResponseEntity<String> data() {

    return ResponseEntity.status(HttpStatus.OK).header("status", "completed").body("fertig!");

}
</code>```

}

Some issues i wondering with:

Running the test will evaluate to green thats fine but if i change the url in the test it will be also OK

The body from response is null and

the header i set within the ResponseEntity is no part of the response from testResttemplate.

Where are my misunderstandings?

Edit: here are my imports:

```<code>import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
</code>```

As seen this are only the "standard" import coming from spring dependencies. Nothing exotics.

Body:
Havin a quite very simple test class followed by a video tut:

@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
public class TestClassTest {

@LocalServerPort
private int port;

@Autowired
private TestRestTemplate testRestTemmplate;

@Test
public void test_one() {

    String url = "http://localhost:" + port + "/v1/read";
    UriComponents builder = UriComponentsBuilder.fromHttpUrl(url).build();
    HttpHeaders headers = new HttpHeaders();
    headers.set("accept", "application/json");

    HttpEntity<String> requestEntity = new HttpEntity<>(null, headers);
    ResponseEntity<String> response = testRestTemmplate.exchange(builder.toString(), HttpMethod.GET, requestEntity, String.class);
    System.out.println(response.getBody());

    assertEquals(HttpStatus.OK, response.getStatusCode());

}

}

The underlying controller class for test looks like:

@RestController
public class TestController {

@RequestMapping(value = "/v1/read", method = RequestMethod.GET, produces = "application/json")
public ResponseEntity<String> data() {

    return ResponseEntity.status(HttpStatus.OK).header("status", "completed").body("fertig!");

}

}

Some issues i wondering with:

Running the test will evaluate to green thats fine but if i change the url in the test it will be also OK

The body from response is null and

the header i set within the ResponseEntity is no part of the response from testResttemplate.

Where are my misunderstandings?

Edit: here are my imports:

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;

As seen this are only the "standard" import coming from spring dependencies. Nothing exotics.


来源: stackexchange

问:
Page refreshes twice after updating datas
Update Information first

The cause for question is found. For solution/reason see end of this posting ...

Here is some PHP code to update a data row in a SQLite database using PDO:

$db = new PDO("sqlite:$db_name");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$update_data = array(
    'animal' => 'cow',
    'name'   => 'Mary',
    'age'    => '4',
);

$stmt = $db->prepare( "UPDATE $db_table SET animal = :animal, name = :name, age = :age WHERE id = 48 "  );
$stmt->execute($update_data);

echo $stmt->rowCount();
```
<p>The (to me) strange behaviour is, that the page in the browser loads the page twice when this code is executed.</p>
<p><strong>NOTE:</strong> this happens only if the data in the database changed. If the update data are identical with DB data (so there is no change in the DB) the page only loads one time.</p>
<p>The effect is the same:</p>
<ul>
<li>when only this the code is on a plain PHP page (= initialize a new page load -> the page loads correct -> the DB action happens -> page automatic refreshes to load second time - why?)</li>
<li>or if I initialize the code by a form request (= submit form -> action leads to the same page -> page loads correct -> after processing POST data the code with this DB action is executed -> page automatic wants reload second time - why?)</li>
</ul>
<p>This effect does not exist when I run the same code in a MySql database (tested on a Maria DB):</p>
<pre class="lang-php prettyprint-override"><code>$db = new PDO("mysql:mysql:host=localhost;dbname=tst_animals", 'admin', 'admin' );
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$update_data = array(
    'animal' => 'cow',
    'name'   => 'Mary',
    'age'    => '4',
);

$stmt = $db->prepare( "UPDATE $db_table SET animal = :animal, name = :name, age = :age WHERE id = 5 "  );
$stmt->execute($update_data);

echo $stmt->rowCount();
</code>```

This code is executed after the page has loaded without a automatic page refresh.

Can anyone explain the strange behaviour to me?

What in this code is the reason for the automatic page reload?

How can I avoid the automatic page reload (the idea is: the database action executes and nothing on the page itself changes)?

Thanks for all answers.

PS:

Please notice that this has nothing to do with try{...}catch(){...}. Using the code with try/catch shows same effect. I just reduced the code for testing and simplifying the issue here and tested it with/without try/catch as well.

The tested behaviour is the same if the code with the DB action is executed before (or even after) something has written to the page.

UPDATE AND SOLUTION

As in the comments was a remark that the code does not work here the working example for 'PDO sqlite', - I only added the variable settings, sorry for the little abstraction:

<?php

$db_name = "D:/xampp/htdocs/devClassForm/system/sqlite/db_animals.sqlite";
$db_table = "animals";

$db = new PDO("sqlite:$db_name");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$update_data = array(
    'animal' => 'cow',
    'name'   => 'Mary',
    'age'    => '4',
);

$stmt = $db->prepare( "UPDATE $db_table SET animal = :animal, name = :name, age = :age WHERE id = 48 "  );
$stmt->execute($update_data);

$stmt->rowCount();

```

DB table settings are:

[id, integer, autoincrement, primary key]

[animal, text]

[name, age]

[age,integer]

When testing please fill database and adapt id number in statement to your settings.

The plain code indeed works proper as it is. I copied it direct one to one from testing file , - but concerning the insisting comments I checked the code once more and found the solution for the very strange and irritating behaviour.

When I tested I used VS Code with Live Server Extension. This setup in Firefox (not tested with Chrome...) indeed causes the auto refresh of the page (checked in the Server logs).

Deactivating this extension the code works as well, updates db data and the page only loads once.

Thanks for the help :-)

(I suggest to let this posting stay here and not to delete it even it is not really a coding issue. Maybe this information about the testing setup helps someone else some time to save time.)

ContentLicense: CC BY-SA 4.0

Body:
Update Information first

The cause for question is found. For solution/reason see end of this posting ...

Here is some PHP code to update a data row in a SQLite database using PDO:

$db = new PDO("sqlite:$db_name");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$update_data = array(
    'animal' => 'cow',
    'name'   => 'Mary',
    'age'    => '4',
);

$stmt = $db->prepare( "UPDATE $db_table SET animal = :animal, name = :name, age = :age WHERE id = 48 "  );
$stmt->execute($update_data);

echo $stmt->rowCount();

The (to me) strange behaviour is, that the page in the browser loads the page twice when this code is executed.

NOTE: this happens only if the data in the database changed. If the update data are identical with DB data (so there is no change in the DB) the page only loads one time.

The effect is the same:

when only this the code is on a plain PHP page (= initialize a new page load -> the page loads correct -> the DB action happens -> page automatic refreshes to load second time - why?)

or if I initialize the code by a form request (= submit form -> action leads to the same page -> page loads correct -> after processing POST data the code with this DB action is executed -> page automatic wants reload second time - why?)

This effect does not exist when I run the same code in a MySql database (tested on a Maria DB):

$db = new PDO("mysql:mysql:host=localhost;dbname=tst_animals", 'admin', 'admin' );
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$update_data = array(
    'animal' => 'cow',
    'name'   => 'Mary',
    'age'    => '4',
);

$stmt = $db->prepare( "UPDATE $db_table SET animal = :animal, name = :name, age = :age WHERE id = 5 "  );
$stmt->execute($update_data);

echo $stmt->rowCount();

This code is executed after the page has loaded without a automatic page refresh.

Can anyone explain the strange behaviour to me?

What in this code is the reason for the automatic page reload?

How can I avoid the automatic page reload (the idea is: the database action executes and nothing on the page itself changes)?

Thanks for all answers.

PS:

Please notice that this has nothing to do with try{...}catch(){...}. Using the code with try/catch shows same effect. I just reduced the code for testing and simplifying the issue here and tested it with/without try/catch as well.

The tested behaviour is the same if the code with the DB action is executed before (or even after) something has written to the page.

UPDATE AND SOLUTION

As in the comments was a remark that the code does not work here the working example for 'PDO sqlite', - I only added the variable settings, sorry for the little abstraction:

<?php

$db_name = "D:/xampp/htdocs/devClassForm/system/sqlite/db_animals.sqlite";
$db_table = "animals";

$db = new PDO("sqlite:$db_name");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$update_data = array(
    'animal' => 'cow',
    'name'   => 'Mary',
    'age'    => '4',
);

$stmt = $db->prepare( "UPDATE $db_table SET animal = :animal, name = :name, age = :age WHERE id = 48 "  );
$stmt->execute($update_data);

$stmt->rowCount();

DB table settings are:

[id, integer, autoincrement, primary key]

[animal, text]

[name, age]

[age,integer]

When testing please fill database and adapt id number in statement to your settings.

The plain code indeed works proper as it is. I copied it direct one to one from testing file , - but concerning the insisting comments I checked the code once more and found the solution for the very strange and irritating behaviour.

When I tested I used VS Code with Live Server Extension. This setup in Firefox (not tested with Chrome...) indeed causes the auto refresh of the page (checked in the Server logs).

Deactivating this extension the code works as well, updates db data and the page only loads once.

Thanks for the help :-)

(I suggest to let this posting stay here and not to delete it even it is not really a coding issue. Maybe this information about the testing setup helps someone else some time to save time.)


问:
Flutter, FutureBuilder and StatefulBuilder: dynamic error text of textbox widget is only changed at hot reload, despite being surrounded by setState
I am currently developing an App. At my registration page, I want to check the password and password confirm text box for equality and check for duplicate email or phone registration. I have a function, which calls my api in order to check, whether the email/phone number is already registered. I call the function when I press the button, so I wrapped it in a FutureBuilder and assigned it to the future property of the builder. I know, it is better to load the future element in the initState method and assign it to a variable, which then you assign to the builder property, but I can't do that, as I only get the email/phone number after the widget is built the first time.
So, now to my problem:

I assign the desired error text to the textbox in the build method. I have wrapped the assignments in a setState.
So, normally the error text should be shown, if i press the register button.

However, this only happnes after I hot-reload the flutter app. I find this very confusing and I tried several things:
I tried to wrap it only with a setState, I tried it with a StatefulBuilder, I tried to outsource the assignment into a function, which then I call in the build method. Nothing worked, so I am asking here and hope to get an answer to my specific question :)

Here is the Code of the button in the build method:

```<code>                  StatefulBuilder(
                    builder: (context, setState) => FutureBuilder(
                      future: checkForDuplicates(
                          _emailBox.controller.text, _phoneBox.controller.text),
                      builder: (BuildContext context,
                          AsyncSnapshot<String> snapshot) {
                        return ElevatedButton(
                          style: ElevatedButton.styleFrom(
                            backgroundColor:
                                Theme.of(context).colorScheme.primary,
                            shape: RoundedRectangleBorder(
                              borderRadius: BorderRadius.circular(50),
                            ),
                          ),
                          child: Text(
                            "Registrieren",
                            style: TextStyle(
                                fontSize: 20,
                                color: Theme.of(context).dividerColor),
                          ),
                          onPressed: () {
                            setState(
                              () {
                                _dateController.text = _backupDate;
                                _dateController.text.isEmpty
                                    ? _validate = true
                                    : _validate = false;
                              },
                            );
                            if (_pBox.controller.text !=
                                _confirmPasswordBox.controller.text) {
                              setState(() {
                                _pBox.errorText =
                                    "Passwörter stimmen nicht überein!";

                                _confirmPasswordBox.errorText =
                                    "Passwörter stimmen nicht überein!";
                              });
                            } else {
                              if (_formKey.currentState!.validate()) {
                                if (snapshot.hasData) {
                                  if (snapshot.data == "email-already-exists") {
                                    setState(() {
                                      _emailBox.errorText =
                                          "Email existiert beretis!";
                                    });
                                  } else if (snapshot.data ==
                                      "phone-already-exists") {
                                    setState(() {
                                      _emailBox.errorText =
                                          "Telefonnummer existiert beretis!";
                                    });
                                  } else {
                                    //no duplicates
                                    if (_isChecked) {
                                      Navigator.pushAndRemoveUntil(
                                        context,
                                        MaterialPageRoute(
                                          builder: (context) =>
                                              AddPersonalDataScreen(
                                                  firstName: _fNameBox
                                                      .controller.text
                                                      .trim(),
                                                  lastName: _lNameBox
                                                      .controller.text
                                                      .trim(),
                                                  dateOfBirth:
                                                      DateTime
                                                          .parse(
                                                              _dateInput.text),
                                                  email: _emailBox
                                                      .controller.text
                                                      .trim(),
                                                  password:
                                                      _pBox.controller.text,
                                                  phoneNumber: _phoneBox
                                                      .controller.text
                                                      .trim()),
                                        ),
                                        (route) => false,
                                      );
                                    }
                                  }
                                } else {
                                  showDialog(
                                    context: context,
                                    builder: (ctx) => AlertDialog(
                                      title: Text(
                                        "AGB's nicht akzeptiert!",
                                        style: TextStyle(
                                            fontSize: 20,
                                            color:
                                                Theme.of(context).dividerColor),
                                      ),
                                      content: Text(
                                        "Um sich zu Registrieren müssen Sie den AGB's zustimmen!",
                                        style: TextStyle(
                                            fontSize: 20,
                                            color:
                                                Theme.of(context).dividerColor),
                                      ),
                                      actions: <Widget>[
                                        TextButton(
                                          onPressed: () {
                                            Navigator.of(context).pop();
                                          },
                                          child: Container(
                                            decoration: BoxDecoration(
                                              borderRadius:
                                                  const BorderRadius.all(
                                                Radius.circular(50),
                                              ),
                                              color: Theme.of(context)
                                                  .colorScheme
                                                  .primary,
                                            ),
                                            padding: const EdgeInsets.all(25),
                                            child: Text(
                                              "Zurück",
                                              style: TextStyle(
                                                  fontSize: 20,
                                                  color: Theme.of(context)
                                                      .dividerColor),
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                  );
                                }
                              }
                            }
                          },
                        );
                      },
                    ),
                  ),
</code>```

Here is the function, which calls the api (but i dont think it is important to the problem):

```<code>Future<String> checkForDuplicates(String email, String phoneNumber) async {
    var phpScript = "XXX";

    var response = await http.post(Uri.parse(phpScript), body: {
      'email': email,
      'phoneNumber': phoneNumber,
    });

    return response.body;
  }
</code>```

Body:
I am currently developing an App. At my registration page, I want to check the password and password confirm text box for equality and check for duplicate email or phone registration. I have a function, which calls my api in order to check, whether the email/phone number is already registered. I call the function when I press the button, so I wrapped it in a FutureBuilder and assigned it to the future property of the builder. I know, it is better to load the future element in the initState method and assign it to a variable, which then you assign to the builder property, but I can't do that, as I only get the email/phone number after the widget is built the first time.
So, now to my problem:

I assign the desired error text to the textbox in the build method. I have wrapped the assignments in a setState.
So, normally the error text should be shown, if i press the register button.

However, this only happnes after I hot-reload the flutter app. I find this very confusing and I tried several things:
I tried to wrap it only with a setState, I tried it with a StatefulBuilder, I tried to outsource the assignment into a function, which then I call in the build method. Nothing worked, so I am asking here and hope to get an answer to my specific question :)

Here is the Code of the button in the build method:

                  StatefulBuilder(
                    builder: (context, setState) => FutureBuilder(
                      future: checkForDuplicates(
                          _emailBox.controller.text, _phoneBox.controller.text),
                      builder: (BuildContext context,
                          AsyncSnapshot<String> snapshot) {
                        return ElevatedButton(
                          style: ElevatedButton.styleFrom(
                            backgroundColor:
                                Theme.of(context).colorScheme.primary,
                            shape: RoundedRectangleBorder(
                              borderRadius: BorderRadius.circular(50),
                            ),
                          ),
                          child: Text(
                            "Registrieren",
                            style: TextStyle(
                                fontSize: 20,
                                color: Theme.of(context).dividerColor),
                          ),
                          onPressed: () {
                            setState(
                              () {
                                _dateController.text = _backupDate;
                                _dateController.text.isEmpty
                                    ? _validate = true
                                    : _validate = false;
                              },
                            );
                            if (_pBox.controller.text !=
                                _confirmPasswordBox.controller.text) {
                              setState(() {
                                _pBox.errorText =
                                    "Passwörter stimmen nicht überein!";

                                _confirmPasswordBox.errorText =
                                    "Passwörter stimmen nicht überein!";
                              });
                            } else {
                              if (_formKey.currentState!.validate()) {
                                if (snapshot.hasData) {
                                  if (snapshot.data == "email-already-exists") {
                                    setState(() {
                                      _emailBox.errorText =
                                          "Email existiert beretis!";
                                    });
                                  } else if (snapshot.data ==
                                      "phone-already-exists") {
                                    setState(() {
                                      _emailBox.errorText =
                                          "Telefonnummer existiert beretis!";
                                    });
                                  } else {
                                    //no duplicates
                                    if (_isChecked) {
                                      Navigator.pushAndRemoveUntil(
                                        context,
                                        MaterialPageRoute(
                                          builder: (context) =>
                                              AddPersonalDataScreen(
                                                  firstName: _fNameBox
                                                      .controller.text
                                                      .trim(),
                                                  lastName: _lNameBox
                                                      .controller.text
                                                      .trim(),
                                                  dateOfBirth:
                                                      DateTime
                                                          .parse(
                                                              _dateInput.text),
                                                  email: _emailBox
                                                      .controller.text
                                                      .trim(),
                                                  password:
                                                      _pBox.controller.text,
                                                  phoneNumber: _phoneBox
                                                      .controller.text
                                                      .trim()),
                                        ),
                                        (route) => false,
                                      );
                                    }
                                  }
                                } else {
                                  showDialog(
                                    context: context,
                                    builder: (ctx) => AlertDialog(
                                      title: Text(
                                        "AGB's nicht akzeptiert!",
                                        style: TextStyle(
                                            fontSize: 20,
                                            color:
                                                Theme.of(context).dividerColor),
                                      ),
                                      content: Text(
                                        "Um sich zu Registrieren müssen Sie den AGB's zustimmen!",
                                        style: TextStyle(
                                            fontSize: 20,
                                            color:
                                                Theme.of(context).dividerColor),
                                      ),
                                      actions: <Widget>[
                                        TextButton(
                                          onPressed: () {
                                            Navigator.of(context).pop();
                                          },
                                          child: Container(
                                            decoration: BoxDecoration(
                                              borderRadius:
                                                  const BorderRadius.all(
                                                Radius.circular(50),
                                              ),
                                              color: Theme.of(context)
                                                  .colorScheme
                                                  .primary,
                                            ),
                                            padding: const EdgeInsets.all(25),
                                            child: Text(
                                              "Zurück",
                                              style: TextStyle(
                                                  fontSize: 20,
                                                  color: Theme.of(context)
                                                      .dividerColor),
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                  );
                                }
                              }
                            }
                          },
                        );
                      },
                    ),
                  ),

Here is the function, which calls the api (but i dont think it is important to the problem):

Future<String> checkForDuplicates(String email, String phoneNumber) async {
    var phpScript = "XXX";

    var response = await http.post(Uri.parse(phpScript), body: {
      'email': email,
      'phoneNumber': phoneNumber,
    });

    return response.body;
  }


问:
Capture and re-stream live video with java
I need to implement a solution in Java that connects to a CCTV server via TCP Socket, takes a live stream video from it and then takes that stream and outputs it to a spring boot endpoint (RTSP or other protocol) so that it can be shown in a web player.

The problem I have is that I do not quite know how to achieve that, maybe some can help. So far, I've got the following piece of code:

```<code>try (Socket socket = new Socket(hostname, port)) {

            DataOutputStream outToServer = new DataOutputStream(socket.getOutputStream());
            BufferedReader inFromServer = new BufferedReader(new InputStreamReader(socket.getInputStream()));
            // Login command
            outToServer.writeBytes(login);

            // Start LIVE video
            outToServer.writeBytes(live);

            ByteArrayOutputStream outStreamObj;
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            byte[] byteChunk = new byte[1024];

            InputStream input = socket.getInputStream();
            int c = input.read(byteChunk);
            while (c != -1) {
                buffer.write(byteChunk, 0, c);
                c = input.read(byteChunk); // If placed in its own loop, it will read forever (or until the stream stops) so it will never exit

                BufferedImage image = ImageIO.read(new ByteArrayInputStream(buffer.toByteArray()));

                // create the object of ByteArrayOutputStream class
                outStreamObj = new ByteArrayOutputStream();

                // write the image into the object of ByteArrayOutputStream class
                ImageIO.write(image, "jpg", outStreamObj);

                // create the byte array from image
                byte[] byteArray = outStreamObj.toByteArray();

                // create the object of ByteArrayInputStream class
                // and initialized it with the byte array.
                ByteArrayInputStream inStreambj = new ByteArrayInputStream(byteArray);

                // read image from byte array
                BufferedImage newImage = ImageIO.read(inStreambj);

                // write output image
                ImageIO.write(newImage, "jpg", new File("outputImage.jpg"));
                System.out.println("Image generated from the byte array.");

            }
        } catch (UnknownHostException ex) {
            ...

        } catch (IOException ex) {
            ...
        }
</code>```

So far, it works until BufferedImage image = ImageIO.read(new ByteArrayInputStream(buffer.toByteArray()));, where image is null. I am not even sure if this is correct. I wouldn't really want to save the image on disk any way, but for now it's okay i guess.

Basically, how it should work as follows:

User visits a web page (Angular)

The web player loads with a live stream url to the spring boot backend

The spring boot backend connect further to the CCTV server via TCP (not possible via RTSP or other protocol) and sends the live command via the socket

Within the same socket session the server starts pushing the live stream bytes

The spring boot app takes these bytes and sends them further to the browser.

Any suggestions?

Body:
I need to implement a solution in Java that connects to a CCTV server via TCP Socket, takes a live stream video from it and then takes that stream and outputs it to a spring boot endpoint (RTSP or other protocol) so that it can be shown in a web player.

The problem I have is that I do not quite know how to achieve that, maybe some can help. So far, I've got the following piece of code:

try (Socket socket = new Socket(hostname, port)) {

            DataOutputStream outToServer = new DataOutputStream(socket.getOutputStream());
            BufferedReader inFromServer = new BufferedReader(new InputStreamReader(socket.getInputStream()));
            // Login command
            outToServer.writeBytes(login);

            // Start LIVE video
            outToServer.writeBytes(live);

            ByteArrayOutputStream outStreamObj;
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            byte[] byteChunk = new byte[1024];

            InputStream input = socket.getInputStream();
            int c = input.read(byteChunk);
            while (c != -1) {
                buffer.write(byteChunk, 0, c);
                c = input.read(byteChunk); // If placed in its own loop, it will read forever (or until the stream stops) so it will never exit

                BufferedImage image = ImageIO.read(new ByteArrayInputStream(buffer.toByteArray()));

                // create the object of ByteArrayOutputStream class
                outStreamObj = new ByteArrayOutputStream();

                // write the image into the object of ByteArrayOutputStream class
                ImageIO.write(image, "jpg", outStreamObj);

                // create the byte array from image
                byte[] byteArray = outStreamObj.toByteArray();

                // create the object of ByteArrayInputStream class
                // and initialized it with the byte array.
                ByteArrayInputStream inStreambj = new ByteArrayInputStream(byteArray);

                // read image from byte array
                BufferedImage newImage = ImageIO.read(inStreambj);

                // write output image
                ImageIO.write(newImage, "jpg", new File("outputImage.jpg"));
                System.out.println("Image generated from the byte array.");

            }
        } catch (UnknownHostException ex) {
            ...

        } catch (IOException ex) {
            ...
        }

So far, it works until BufferedImage image = ImageIO.read(new ByteArrayInputStream(buffer.toByteArray()));, where image is null. I am not even sure if this is correct. I wouldn't really want to save the image on disk any way, but for now it's okay i guess.

Basically, how it should work as follows:

User visits a web page (Angular)

The web player loads with a live stream url to the spring boot backend

The spring boot backend connect further to the CCTV server via TCP (not possible via RTSP or other protocol) and sends the live command via the socket

Within the same socket session the server starts pushing the live stream bytes

The spring boot app takes these bytes and sends them further to the browser.

Any suggestions?


问:
Following Angular Heroes tutorial, I added search to the detail page, it doesn't work
The relevant code is here:  https://angular.io/tutorial/tour-of-heroes/toh-pt6

I made one change in the HeroDetailComponent.  I thought, "why should you have to go back to the dashboard in order to search for a new Hero?"  So, I added the search tag to the detail component html, like this:

```<code><div *ngIf="hero">
  <h2>{{hero.name | uppercase}} Details</h2>
  <div><span>id: </span>{{hero.id}}</div>
  <div>
    <label for="hero-name">Hero name: </label>
    <input id="hero-name" [(ngModel)]="hero.name" placeholder="Hero name"/>
  </div>
  <button type="button" (click)="goBack()">go back</button>
  <button type="button" (click)="save()">save</button>
</div>

<app-hero-search></app-hero-search>
</code>```

This renders just fine in the browser, when you search for a hero, it gives a nice auto-completing list just as the dashboard component view does, but the links in the returning list aren't clickable.  Coming from a Rails background, I thought maybe the backend needed to be changed, so went to the dashboard component's ts page to see if there was anything interesting here to support a search function, I don't see anything:

```<code>import { Component, OnInit } from '@angular/core';
import { Hero } from '../hero';
import { HeroService } from '../hero.service';

@Component({
  selector: 'app-dashboard',
  templateUrl: './dashboard.component.html',
  styleUrls: [ './dashboard.component.css' ]
})
export class DashboardComponent implements OnInit {
  heroes: Hero[] = [];

  constructor(private heroService: HeroService) { }

  ngOnInit(): void {
    this.getHeroes();
  }

  getHeroes(): void {
    this.heroService.getHeroes()
      .subscribe(heroes => this.heroes = heroes.slice(1, 5));
  }
}
</code>```

The getHeroes function here seems to just provide data for the buttons at the top of the dashboard page.  It doesn't seem to feature any backend for the search function at all.  From what I understand of angular so far (I'm just learning, obviously), components are intended to be relatively self-contained.  So, why shouldn't I be able to move the app-hero-search tag anywhere I want to in the overall application?

Body:
The relevant code is here:  https://angular.io/tutorial/tour-of-heroes/toh-pt6

I made one change in the HeroDetailComponent.  I thought, "why should you have to go back to the dashboard in order to search for a new Hero?"  So, I added the search tag to the detail component html, like this:

{{hero.name | uppercase}} Details

id: {{hero.id}}

    Hero name:
    <input id="hero-name" [(ngModel)]="hero.name" placeholder="Hero name"/>

  <button type="button" (click)="goBack()">go back</button>
  <button type="button" (click)="save()">save</button>

<app-hero-search></app-hero-search>

This renders just fine in the browser, when you search for a hero, it gives a nice auto-completing list just as the dashboard component view does, but the links in the returning list aren't clickable.  Coming from a Rails background, I thought maybe the backend needed to be changed, so went to the dashboard component's ts page to see if there was anything interesting here to support a search function, I don't see anything:

import { Component, OnInit } from '@angular/core';
import { Hero } from '../hero';
import { HeroService } from '../hero.service';

@Component({
  selector: 'app-dashboard',
  templateUrl: './dashboard.component.html',
  styleUrls: [ './dashboard.component.css' ]
})
export class DashboardComponent implements OnInit {
  heroes: Hero[] = [];

  constructor(private heroService: HeroService) { }

  ngOnInit(): void {
    this.getHeroes();
  }

  getHeroes(): void {
    this.heroService.getHeroes()
      .subscribe(heroes => this.heroes = heroes.slice(1, 5));
  }
}

The getHeroes function here seems to just provide data for the buttons at the top of the dashboard page.  It doesn't seem to feature any backend for the search function at all.  From what I understand of angular so far (I'm just learning, obviously), components are intended to be relatively self-contained.  So, why shouldn't I be able to move the app-hero-search tag anywhere I want to in the overall application?


问:
Error creating bean with name 'entityManagerFactory' with H2 and Spring boot project
I am facing an issue with my Spring Boot project and H2 DB and I am not sure how to locate the root of the issue.

I have ran the project localy in STS and it is working as expected, when I move it to a server (redhat with Tomcat 7) I am getting the below error. The only diffrance between both deployments is the JDBC dependancy is only in the pom.xml which is deployed to the server and not locally.

pom.xml file

```<code><?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.6</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
         <groupId>com.example</groupId>
         <artifactId>spring_start</artifactId>
         <version>0.0.1-SNAPSHOT</version>
          <packaging>war</packaging>
         <name>spring_start</name>
        <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>1.8</java.version>
        <itext.version>7.2.4</itext.version> <!-- Extrenal repo-->
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <!--        <dependency>-->
        <!--            <groupId>org.springframework.boot</groupId>-->
        <!--            <artifactId>spring-boot-starter-test</artifactId>-->
        <!--            <scope>test</scope>-->
        <!--        </dependency>-->
        <!-- Extrenal repo Start Here-->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.11.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>com.itextpdf</groupId>
            <artifactId>itext7-core</artifactId>
            <version>${itext.version}</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>com.konghq</groupId>
            <artifactId>unirest-java</artifactId>
            <version>3.7.04</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-cache</artifactId>
            <version>3.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-csv</artifactId>
            <version>1.9.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>
        <!-- Extrenal repo End Here-->
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
        <finalName>example</finalName>
    </build>
</project>
</code>```

application properties h2 part

```<code>#H2 DB
spring.datasource.url=jdbc:h2:mem:dipattdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.h2.console.enabled=true
spring.h2.console.settings.web-allow-others=false
#spring.h2.console.settings.trace=true
spring.jpa.hibernate.ddl-auto= update
</code>```

error log

```<code>11-Jan-2023 19:10:19.388 INFO [main] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
11-Jan-2023 19:10:24.270 SEVERE [main] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive [/var/opt/rh/jws5/lib/tomcat/webapps/example.war]
    java.lang.IllegalStateException: Error starting child
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:729)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:698)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:696)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1024)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1911)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:825)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:475)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1618)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:319)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
        at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
        at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:946)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:263)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:432)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:927)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:772)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476)
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/example]]
        at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
        ... 37 more
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: Factory method 'entityManagerFactory' threw exception; nested exception is java.lang.AbstractMethodError: org.apache.commons.dbcp.BasicDataSource.isWrapperFor(Ljava/lang/Class;)Z
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
        at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:175)
        at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:155)
        at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:97)
        at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:174)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5219)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        ... 38 more
    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: Factory method 'entityManagerFactory' threw exception; nested exception is java.lang.AbstractMethodError: org.apache.commons.dbcp.BasicDataSource.isWrapperFor(Ljava/lang/Class;)Z
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
        ... 60 more
    Caused by: java.lang.AbstractMethodError: org.apache.commons.dbcp.BasicDataSource.isWrapperFor(Ljava/lang/Class;)Z
        at org.springframework.boot.jdbc.DataSourceUnwrapper.safeUnwrap(DataSourceUnwrapper.java:95)
        at org.springframework.boot.jdbc.DataSourceUnwrapper.unwrap(DataSourceUnwrapper.java:60)
        at org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration$HikariPoolDataSourceMetadataProviderConfiguration.lambda$hikariPoolDataSourceMetadataProvider$0(DataSourcePoolMetadataProvidersConfiguration.java:73)
        at org.springframework.boot.jdbc.metadata.CompositeDataSourcePoolMetadataProvider.getDataSourcePoolMetadata(CompositeDataSourcePoolMetadataProvider.java:50)
        at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration.isDataSourceAutoCommitDisabled(HibernateJpaConfiguration.java:167)
        at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration.configureProviderDisablesAutocommit(HibernateJpaConfiguration.java:161)
        at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration.customizeVendorProperties(HibernateJpaConfiguration.java:143)
        at org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.entityManagerFactory(JpaBaseConfiguration.java:133)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
        ... 61 more

</code>```

mvn tree

```<code>[INFO] --- maven-dependency-plugin:3.3.0:tree (default-cli) @ diploma.attestation ---
[INFO] edu.aus.oor:diploma.attestation:war:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.7.6:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:2.7.6:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:2.7.6:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:2.7.6:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.7.6:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.2.11:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.2.11:compile
[INFO] |  |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.17.2:compile
[INFO] |  |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.17.2:compile
[INFO] |  |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.36:compile
[INFO] |  |  +- org.springframework:spring-core:jar:5.3.24:compile
[INFO] |  |  |  \- org.springframework:spring-jcl:jar:5.3.24:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.30:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:2.7.6:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.13.4.2:compile
[INFO] |  |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.13.4:compile
[INFO] |  |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.13.4:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.13.4:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.13.4:compile
[INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.13.4:compile
[INFO] |  +- org.springframework:spring-web:jar:5.3.24:compile
[INFO] |  |  \- org.springframework:spring-beans:jar:5.3.24:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:5.3.24:compile
[INFO] |     +- org.springframework:spring-aop:jar:5.3.24:compile
[INFO] |     +- org.springframework:spring-context:jar:5.3.24:compile
[INFO] |     \- org.springframework:spring-expression:jar:5.3.24:compile
[INFO] +- org.projectlombok:lombok:jar:1.18.24:compile
[INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.7.6:provided
[INFO] |  +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.69:provided
[INFO] |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.69:compile
[INFO] |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.69:provided
[INFO] +- org.apache.commons:commons-lang3:jar:3.12.0:compile
[INFO] +- commons-io:commons-io:jar:2.11.0:compile
[INFO] +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.7.6:compile
[INFO] |  +- com.zaxxer:HikariCP:jar:4.0.3:compile
[INFO] |  |  \- org.slf4j:slf4j-api:jar:1.7.36:compile
[INFO] |  \- org.springframework:spring-jdbc:jar:5.3.24:compile
[INFO] |     \- org.springframework:spring-tx:jar:5.3.24:compile
[INFO] +- com.itextpdf:itext7-core:pom:7.2.4:compile
[INFO] |  +- com.itextpdf:barcodes:jar:7.2.4:compile
[INFO] |  +- com.itextpdf:font-asian:jar:7.2.4:compile
[INFO] |  +- com.itextpdf:forms:jar:7.2.4:compile
[INFO] |  +- com.itextpdf:hyph:jar:7.2.4:compile
[INFO] |  +- com.itextpdf:io:jar:7.2.4:compile
[INFO] |  |  \- com.itextpdf:commons:jar:7.2.4:compile
[INFO] |  +- com.itextpdf:kernel:jar:7.2.4:compile
[INFO] |  |  +- org.bouncycastle:bcpkix-jdk15on:jar:1.70:compile
[INFO] |  |  |  \- org.bouncycastle:bcutil-jdk15on:jar:1.70:compile
[INFO] |  |  \- org.bouncycastle:bcprov-jdk15on:jar:1.70:compile
[INFO] |  +- com.itextpdf:layout:jar:7.2.4:compile
[INFO] |  +- com.itextpdf:pdfa:jar:7.2.4:compile
[INFO] |  +- com.itextpdf:sign:jar:7.2.4:compile
[INFO] |  +- com.itextpdf:styled-xml-parser:jar:7.2.4:compile
[INFO] |  \- com.itextpdf:svg:jar:7.2.4:compile
[INFO] +- com.konghq:unirest-java:jar:3.7.04:compile
[INFO] |  +- org.apache.httpcomponents:httpclient:jar:4.5.13:compile
[INFO] |  |  +- org.apache.httpcomponents:httpcore:jar:4.4.15:compile
[INFO] |  |  \- commons-codec:commons-codec:jar:1.15:compile
[INFO] |  +- org.apache.httpcomponents:httpmime:jar:4.5.13:compile
[INFO] |  +- org.apache.httpcomponents:httpcore-nio:jar:4.4.15:compile
[INFO] |  +- org.apache.httpcomponents:httpasyncclient:jar:4.1.5:compile
[INFO] |  \- com.google.code.gson:gson:jar:2.9.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-cache:jar:2.7.6:compile
[INFO] |  \- org.springframework:spring-context-support:jar:5.3.24:compile
[INFO] +- org.springframework.boot:spring-boot-starter-thymeleaf:jar:2.7.6:compile
[INFO] |  +- org.thymeleaf:thymeleaf-spring5:jar:3.0.15.RELEASE:compile
[INFO] |  |  \- org.thymeleaf:thymeleaf:jar:3.0.15.RELEASE:compile
[INFO] |  |     +- org.attoparser:attoparser:jar:2.0.5.RELEASE:compile
[INFO] |  |     \- org.unbescape:unbescape:jar:1.1.6.RELEASE:compile
[INFO] |  \- org.thymeleaf.extras:thymeleaf-extras-java8time:jar:3.0.4.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-mail:jar:2.7.6:compile
[INFO] |  \- com.sun.mail:jakarta.mail:jar:1.6.7:compile
[INFO] |     \- com.sun.activation:jakarta.activation:jar:1.2.2:compile
[INFO] +- org.apache.commons:commons-csv:jar:1.9.0:compile
[INFO] +- org.springframework.boot:spring-boot-starter-validation:jar:2.7.6:compile
[INFO] |  \- org.hibernate.validator:hibernate-validator:jar:6.2.5.Final:compile
[INFO] |     +- jakarta.validation:jakarta.validation-api:jar:2.0.2:compile
[INFO] |     +- org.jboss.logging:jboss-logging:jar:3.4.3.Final:compile
[INFO] |     \- com.fasterxml:classmate:jar:1.5.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.7.6:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-aop:jar:2.7.6:compile
[INFO] |  |  \- org.aspectj:aspectjweaver:jar:1.9.7:compile
[INFO] |  +- jakarta.transaction:jakarta.transaction-api:jar:1.3.3:compile
[INFO] |  +- jakarta.persistence:jakarta.persistence-api:jar:2.2.3:compile
[INFO] |  +- org.hibernate:hibernate-core:jar:5.6.14.Final:compile
[INFO] |  |  +- net.bytebuddy:byte-buddy:jar:1.12.19:compile
[INFO] |  |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  |  +- org.jboss:jandex:jar:2.4.2.Final:compile
[INFO] |  |  +- org.hibernate.common:hibernate-commons-annotations:jar:5.1.2.Final:compile
[INFO] |  |  \- org.glassfish.jaxb:jaxb-runtime:jar:2.3.7:compile
[INFO] |  |     +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:compile
[INFO] |  |     +- org.glassfish.jaxb:txw2:jar:2.3.7:compile
[INFO] |  |     \- com.sun.istack:istack-commons-runtime:jar:3.0.12:compile
[INFO] |  +- org.springframework.data:spring-data-jpa:jar:2.7.6:compile
[INFO] |  |  +- org.springframework.data:spring-data-commons:jar:2.7.6:compile
[INFO] |  |  \- org.springframework:spring-orm:jar:5.3.24:compile
[INFO] |  \- org.springframework:spring-aspects:jar:5.3.24:compile
[INFO] \- com.h2database:h2:jar:2.1.214:runtime
</code>```

I have removed the .m2 file, and I have removed the JDBC part in the server pom with no luck.

Body:
I am facing an issue with my Spring Boot project and H2 DB and I am not sure how to locate the root of the issue.

I have ran the project localy in STS and it is working as expected, when I move it to a server (redhat with Tomcat 7) I am getting the below error. The only diffrance between both deployments is the JDBC dependancy is only in the pom.xml which is deployed to the server and not locally.

pom.xml file

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.6</version>
        <relativePath />
    </parent>
         <groupId>com.example</groupId>
         <artifactId>spring_start</artifactId>
         <version>0.0.1-SNAPSHOT</version>
          <packaging>war</packaging>
         <name>spring_start</name>
        <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>1.8</java.version>
        <itext.version>7.2.4</itext.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.11.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>com.itextpdf</groupId>
            <artifactId>itext7-core</artifactId>
            <version>${itext.version}</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>com.konghq</groupId>
            <artifactId>unirest-java</artifactId>
            <version>3.7.04</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-cache</artifactId>
            <version>3.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-csv</artifactId>
            <version>1.9.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>

    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
        <finalName>example</finalName>
    </build>
</project>

application properties h2 part

#H2 DB
spring.datasource.url=jdbc:h2:mem:dipattdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.h2.console.enabled=true
spring.h2.console.settings.web-allow-others=false
#spring.h2.console.settings.trace=true
spring.jpa.hibernate.ddl-auto= update

error log

11-Jan-2023 19:10:19.388 INFO [main] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
11-Jan-2023 19:10:24.270 SEVERE [main] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive [/var/opt/rh/jws5/lib/tomcat/webapps/example.war]
    java.lang.IllegalStateException: Error starting child
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:729)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:698)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:696)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1024)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1911)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:825)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:475)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1618)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:319)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
        at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
        at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:946)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:263)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:432)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:927)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:772)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476)
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/example]]
        at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
        ... 37 more
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: Factory method 'entityManagerFactory' threw exception; nested exception is java.lang.AbstractMethodError: org.apache.commons.dbcp.BasicDataSource.isWrapperFor(Ljava/lang/Class;)Z
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
        at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:175)
        at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:155)
        at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:97)
        at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:174)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5219)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        ... 38 more
    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: Factory method 'entityManagerFactory' threw exception; nested exception is java.lang.AbstractMethodError: org.apache.commons.dbcp.BasicDataSource.isWrapperFor(Ljava/lang/Class;)Z
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
        ... 60 more
    Caused by: java.lang.AbstractMethodError: org.apache.commons.dbcp.BasicDataSource.isWrapperFor(Ljava/lang/Class;)Z
        at org.springframework.boot.jdbc.DataSourceUnwrapper.safeUnwrap(DataSourceUnwrapper.java:95)
        at org.springframework.boot.jdbc.DataSourceUnwrapper.unwrap(DataSourceUnwrapper.java:60)
        at org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration$HikariPoolDataSourceMetadataProviderConfiguration.lambda$hikariPoolDataSourceMetadataProvider$0(DataSourcePoolMetadataProvidersConfiguration.java:73)
        at org.springframework.boot.jdbc.metadata.CompositeDataSourcePoolMetadataProvider.getDataSourcePoolMetadata(CompositeDataSourcePoolMetadataProvider.java:50)
        at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration.isDataSourceAutoCommitDisabled(HibernateJpaConfiguration.java:167)
        at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration.configureProviderDisablesAutocommit(HibernateJpaConfiguration.java:161)
        at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration.customizeVendorProperties(HibernateJpaConfiguration.java:143)
        at org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.entityManagerFactory(JpaBaseConfiguration.java:133)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
        ... 61 more

mvn tree

[INFO] --- maven-dependency-plugin:3.3.0:tree (default-cli) @ diploma.attestation ---
[INFO] edu.aus.oor:diploma.attestation:war:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.7.6:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:2.7.6:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:2.7.6:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:2.7.6:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.7.6:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.2.11:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.2.11:compile
[INFO] |  |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.17.2:compile
[INFO] |  |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.17.2:compile
[INFO] |  |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.36:compile
[INFO] |  |  +- org.springframework:spring-core:jar:5.3.24:compile
[INFO] |  |  |  \- org.springframework:spring-jcl:jar:5.3.24:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.30:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:2.7.6:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.13.4.2:compile
[INFO] |  |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.13.4:compile
[INFO] |  |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.13.4:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.13.4:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.13.4:compile
[INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.13.4:compile
[INFO] |  +- org.springframework:spring-web:jar:5.3.24:compile
[INFO] |  |  \- org.springframework:spring-beans:jar:5.3.24:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:5.3.24:compile
[INFO] |     +- org.springframework:spring-aop:jar:5.3.24:compile
[INFO] |     +- org.springframework:spring-context:jar:5.3.24:compile
[INFO] |     \- org.springframework:spring-expression:jar:5.3.24:compile
[INFO] +- org.projectlombok:lombok:jar:1.18.24:compile
[INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.7.6:provided
[INFO] |  +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.69:provided
[INFO] |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.69:compile
[INFO] |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.69:provided
[INFO] +- org.apache.commons:commons-lang3:jar:3.12.0:compile
[INFO] +- commons-io:commons-io:jar:2.11.0:compile
[INFO] +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.7.6:compile
[INFO] |  +- com.zaxxer:HikariCP:jar:4.0.3:compile
[INFO] |  |  \- org.slf4j:slf4j-api:jar:1.7.36:compile
[INFO] |  \- org.springframework:spring-jdbc:jar:5.3.24:compile
[INFO] |     \- org.springframework:spring-tx:jar:5.3.24:compile
[INFO] +- com.itextpdf:itext7-core:pom:7.2.4:compile
[INFO] |  +- com.itextpdf:barcodes:jar:7.2.4:compile
[INFO] |  +- com.itextpdf:font-asian:jar:7.2.4:compile
[INFO] |  +- com.itextpdf:forms:jar:7.2.4:compile
[INFO] |  +- com.itextpdf:hyph:jar:7.2.4:compile
[INFO] |  +- com.itextpdf:io:jar:7.2.4:compile
[INFO] |  |  \- com.itextpdf:commons:jar:7.2.4:compile
[INFO] |  +- com.itextpdf:kernel:jar:7.2.4:compile
[INFO] |  |  +- org.bouncycastle:bcpkix-jdk15on:jar:1.70:compile
[INFO] |  |  |  \- org.bouncycastle:bcutil-jdk15on:jar:1.70:compile
[INFO] |  |  \- org.bouncycastle:bcprov-jdk15on:jar:1.70:compile
[INFO] |  +- com.itextpdf:layout:jar:7.2.4:compile
[INFO] |  +- com.itextpdf:pdfa:jar:7.2.4:compile
[INFO] |  +- com.itextpdf:sign:jar:7.2.4:compile
[INFO] |  +- com.itextpdf:styled-xml-parser:jar:7.2.4:compile
[INFO] |  \- com.itextpdf:svg:jar:7.2.4:compile
[INFO] +- com.konghq:unirest-java:jar:3.7.04:compile
[INFO] |  +- org.apache.httpcomponents:httpclient:jar:4.5.13:compile
[INFO] |  |  +- org.apache.httpcomponents:httpcore:jar:4.4.15:compile
[INFO] |  |  \- commons-codec:commons-codec:jar:1.15:compile
[INFO] |  +- org.apache.httpcomponents:httpmime:jar:4.5.13:compile
[INFO] |  +- org.apache.httpcomponents:httpcore-nio:jar:4.4.15:compile
[INFO] |  +- org.apache.httpcomponents:httpasyncclient:jar:4.1.5:compile
[INFO] |  \- com.google.code.gson:gson:jar:2.9.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-cache:jar:2.7.6:compile
[INFO] |  \- org.springframework:spring-context-support:jar:5.3.24:compile
[INFO] +- org.springframework.boot:spring-boot-starter-thymeleaf:jar:2.7.6:compile
[INFO] |  +- org.thymeleaf:thymeleaf-spring5:jar:3.0.15.RELEASE:compile
[INFO] |  |  \- org.thymeleaf:thymeleaf:jar:3.0.15.RELEASE:compile
[INFO] |  |     +- org.attoparser:attoparser:jar:2.0.5.RELEASE:compile
[INFO] |  |     \- org.unbescape:unbescape:jar:1.1.6.RELEASE:compile
[INFO] |  \- org.thymeleaf.extras:thymeleaf-extras-java8time:jar:3.0.4.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-mail:jar:2.7.6:compile
[INFO] |  \- com.sun.mail:jakarta.mail:jar:1.6.7:compile
[INFO] |     \- com.sun.activation:jakarta.activation:jar:1.2.2:compile
[INFO] +- org.apache.commons:commons-csv:jar:1.9.0:compile
[INFO] +- org.springframework.boot:spring-boot-starter-validation:jar:2.7.6:compile
[INFO] |  \- org.hibernate.validator:hibernate-validator:jar:6.2.5.Final:compile
[INFO] |     +- jakarta.validation:jakarta.validation-api:jar:2.0.2:compile
[INFO] |     +- org.jboss.logging:jboss-logging:jar:3.4.3.Final:compile
[INFO] |     \- com.fasterxml:classmate:jar:1.5.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.7.6:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-aop:jar:2.7.6:compile
[INFO] |  |  \- org.aspectj:aspectjweaver:jar:1.9.7:compile
[INFO] |  +- jakarta.transaction:jakarta.transaction-api:jar:1.3.3:compile
[INFO] |  +- jakarta.persistence:jakarta.persistence-api:jar:2.2.3:compile
[INFO] |  +- org.hibernate:hibernate-core:jar:5.6.14.Final:compile
[INFO] |  |  +- net.bytebuddy:byte-buddy:jar:1.12.19:compile
[INFO] |  |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  |  +- org.jboss:jandex:jar:2.4.2.Final:compile
[INFO] |  |  +- org.hibernate.common:hibernate-commons-annotations:jar:5.1.2.Final:compile
[INFO] |  |  \- org.glassfish.jaxb:jaxb-runtime:jar:2.3.7:compile
[INFO] |  |     +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:compile
[INFO] |  |     +- org.glassfish.jaxb:txw2:jar:2.3.7:compile
[INFO] |  |     \- com.sun.istack:istack-commons-runtime:jar:3.0.12:compile
[INFO] |  +- org.springframework.data:spring-data-jpa:jar:2.7.6:compile
[INFO] |  |  +- org.springframework.data:spring-data-commons:jar:2.7.6:compile
[INFO] |  |  \- org.springframework:spring-orm:jar:5.3.24:compile
[INFO] |  \- org.springframework:spring-aspects:jar:5.3.24:compile
[INFO] \- com.h2database:h2:jar:2.1.214:runtime

I have removed the .m2 file, and I have removed the JDBC part in the server pom with no luck.


问:
TextBox is binded with duplicate values while pasting in angular
[Please Refer stackblitz]1

When i try to paste something in the text box it is giving duplicate for example i pasted "Any" the textbox is populated with "AnyAny" but i want only what i paste which "Any" (It should able to assign a new value from ts file)


问:
Reuse a shared declarative Jenkins pipeline and overwrite/extend stages
I have a couple of projects and i am sharing a "default" Jenkins pipeline via "shared library". The default pipeline looks something like this:

```<code>def call(body) {

    def pipelineParams = [:]
    body.resolveStrategy = Closure.DELEGATE_FIRST
    body.delegate = pipelineParams
    body()

    pipeline {
        tools {
            maven pipelineParams.mavenId
            jdk pipelineParams.jdkId
        }
        options {
            timestamps()
        }
        stages {
            stage('A') {
                steps {
                    // do stuff
                }
            }
            stage('B') {
                steps {
                    // do stuff
                }
            }
        }
    }
}
</code>```

In most cases/projects this works just fine, but in some, i would like to change the behaviour/steps of some of these predefined stages.

Currently i have to copy the default pipeline, add it to the "special" project and alter the steps that i need to change. A problem arises the moment i need to add a step or configuration to all of my projects, regardless if the project is using the default or a special pipeline.

Another way i thought of is to implement something like extension points, pass closures into the default pipeline and call them in predefined places.

I would like to know, if there is any other way to deal with this kind of problem?

Body:
I have a couple of projects and i am sharing a "default" Jenkins pipeline via "shared library". The default pipeline looks something like this:

def call(body) {

    def pipelineParams = [:]
    body.resolveStrategy = Closure.DELEGATE_FIRST
    body.delegate = pipelineParams
    body()

    pipeline {
        tools {
            maven pipelineParams.mavenId
            jdk pipelineParams.jdkId
        }
        options {
            timestamps()
        }
        stages {
            stage('A') {
                steps {
                    // do stuff
                }
            }
            stage('B') {
                steps {
                    // do stuff
                }
            }
        }
    }
}

In most cases/projects this works just fine, but in some, i would like to change the behaviour/steps of some of these predefined stages.

Currently i have to copy the default pipeline, add it to the "special" project and alter the steps that i need to change. A problem arises the moment i need to add a step or configuration to all of my projects, regardless if the project is using the default or a special pipeline.

Another way i thought of is to implement something like extension points, pass closures into the default pipeline and call them in predefined places.

I would like to know, if there is any other way to deal with this kind of problem?


问:
How can I create Mesh from PointCloud?
How can I create Mesh from PointCloud, using draco or similar package for node.js

Expect to get Mesh so that I could encode or create compressed file

Title: How can I create Mesh from PointCloud?


问:
ScrollOptions.behavior: 'smooth' not working in Chrome unless smooth-scrolling flag is changed to enabled for localhost environment?
I have a piece of JavaScript code for a scroll to top button when onClick:

```<code>const handleScrollToTop = () => {
    window.scrollTo({ top: 0, behavior: 'smooth' });
  }
</code>```

This does not work on my localhost React website. I have to do what this answer says:
https://stackoverflow.com/a/67124806/6368685
and change the flag to enabled from default. This is obviously not useful for users to have to do this to get it to work.

On a production site(s) with this feature, it works fine in this same instance of my Chrome browser. Unless if they are using another implementation I am not aware of, is it because they have an SSL certificate and my localhost site does not?

I have also tried adding these options in several combinations with css:

```<code>*, html:focus-within, body {
  overflow: visible;
  scroll-behavior: smooth !important;
}
</code>```

Or like this:

```<code>*, html, body {
  overflow: visible;
  scroll-behavior: smooth !important;
}
</code>```

Body:
I have a piece of JavaScript code for a scroll to top button when onClick:

const handleScrollToTop = () => {
    window.scrollTo({ top: 0, behavior: 'smooth' });
  }

This does not work on my localhost React website. I have to do what this answer says:
https://stackoverflow.com/a/67124806/6368685
and change the flag to enabled from default. This is obviously not useful for users to have to do this to get it to work.

On a production site(s) with this feature, it works fine in this same instance of my Chrome browser. Unless if they are using another implementation I am not aware of, is it because they have an SSL certificate and my localhost site does not?

I have also tried adding these options in several combinations with css:

*, html:focus-within, body {
  overflow: visible;
  scroll-behavior: smooth !important;
}

Or like this:

*, html, body {
  overflow: visible;
  scroll-behavior: smooth !important;
}


问:
How detect platform send to firebase
I have a web, an android, and an iPhone app using the same firebase database how I can know which of them send to firebase

there is a solution "send type platform" are there another solution?

Title: How detect platform send to firebase


问:
TZ parameter not working in SOLR timeseries streaming expression
We are using Solr 9.1. We want to calculate a monthly time series metric. We are using following request

```<code>https://localhost/solr/metrics/stream?expr=timeseries(
                metrics,
                q="type_i:4",
                field="ended_at_dt",
                start="NOW/MONTH",
                end="NOW/MONTH+5MONTH",
                gap="+1MONTH"
            )&TZ=Asia/Kolkata
</code>```

Irrespective of TZ parameter we are getting monthly results based on UTC tie zone shown in below screnshot

While in SOLR documentation It is mentioned

By default, all date math expressions are evaluated relative to the UTC TimeZone, but the TZ parameter can be specified to override this behaviour, by forcing all date based addition and rounding to be relative to the specified time zone.
For example, the following request will use range faceting to facet over the current month, "per day" relative UTC:

I have tested below example given in document

```<code>http://localhost/solr/metrics/select?q=*:*&facet.range=ended_at_dt&facet=true&facet.range.start=NOW/MONTH&facet.range.end=NOW/MONTH+5MONTH&facet.range.gap=+1MONTH&TZ=Asia/Kolkata
</code>```

And it is giving result as expected as shown in below screenshot

Please guide how to use timeseries expression to show results based on timezone.

Body:
We are using Solr 9.1. We want to calculate a monthly time series metric. We are using following request

https://localhost/solr/metrics/stream?expr=timeseries(
                metrics,
                q="type_i:4",
                field="ended_at_dt",
                start="NOW/MONTH",
                end="NOW/MONTH+5MONTH",
                gap="+1MONTH"
            )&TZ=Asia/Kolkata

Irrespective of TZ parameter we are getting monthly results based on UTC tie zone shown in below screnshot

While in SOLR documentation It is mentioned

By default, all date math expressions are evaluated relative to the UTC TimeZone, but the TZ parameter can be specified to override this behaviour, by forcing all date based addition and rounding to be relative to the specified time zone.
For example, the following request will use range faceting to facet over the current month, "per day" relative UTC:

I have tested below example given in document

http://localhost/solr/metrics/select?q=*:*&facet.range=ended_at_dt&facet=true&facet.range.start=NOW/MONTH&facet.range.end=NOW/MONTH+5MONTH&facet.range.gap=+1MONTH&TZ=Asia/Kolkata

And it is giving result as expected as shown in below screenshot

Please guide how to use timeseries expression to show results based on timezone.


问:
Microsoft SQL Server Bulk Insert NOT failing when inserting bigint values into int column
We recently had an identifier column move from int values to bigint values.  An ETL process which loads these values was not updated.  That process is using SQL bulk insert, and we are seeing incorrect values in the destination table.  I would have expected a hard failure.

Please note this process has been running successfully for a long time before this issue.

Can anyone tell me what the heck SQL Server is doing here!?  I know how to fix the situation, but I'm trying to better understand it for the data cleanup effort that I'll need to complete, as well as just for the fact that it looks like black magic!

I've been able to re-create this issue in SQL Server 2017 and 2019.

Simplified Example CSV file contents:

```<code>310067463717
310067463718
310067463719
</code>```

Example SQL:

```<code>create table #t (t int)

bulk insert #t from 'c:\temp\test.csv'
with (datafiletype = 'char',
fieldterminator = '|'
)

select * from #t
</code>```

Resulting data:

```<code>829818405
829818406
829818407
</code>```

Interestingly, I tried with smaller values, and I do see an error:

Example CSV file contents (2147483647 is the largest int value for SQL Server):

```<code>310067463717
310067463718
310067463719
2147483647
2147483648
</code>```

Running the same SQL code as above, I get an error for one row:

Msg 4867, Level 16, State 1, Line 4

Bulk load data conversion error (overflow) for row 5, column 1 (t).

The resulting data looks like this:

```<code>829818405
829818406
829818407
2147483647
</code>```

I also tried just now with a much higher value, 31006746371945654, and that threw the same overflow error as 2147483648.

And last, I did confirm that if I create the table with the column defined as bigint, the data inserted is correct.

```<code>create table #t (t bigint)

bulk insert #t from 'c:\temp\test.csv'
with (datafiletype = 'char',
fieldterminator = '|'
)

select * from #t
</code>```

Resulting data:

```<code>2147483647
2147483648
310067463717
310067463718
310067463719
</code>```

Body:
We recently had an identifier column move from int values to bigint values.  An ETL process which loads these values was not updated.  That process is using SQL bulk insert, and we are seeing incorrect values in the destination table.  I would have expected a hard failure.

Please note this process has been running successfully for a long time before this issue.

Can anyone tell me what the heck SQL Server is doing here!?  I know how to fix the situation, but I'm trying to better understand it for the data cleanup effort that I'll need to complete, as well as just for the fact that it looks like black magic!

I've been able to re-create this issue in SQL Server 2017 and 2019.

Simplified Example CSV file contents:

310067463717
310067463718
310067463719

Example SQL:

create table #t (t int)

bulk insert #t from 'c:\temp\test.csv'
with (datafiletype = 'char',
fieldterminator = '|'
)

select * from #t

Resulting data:

829818405
829818406
829818407

Interestingly, I tried with smaller values, and I do see an error:

Example CSV file contents (2147483647 is the largest int value for SQL Server):

310067463717
310067463718
310067463719
2147483647
2147483648

Running the same SQL code as above, I get an error for one row:

Msg 4867, Level 16, State 1, Line 4

Bulk load data conversion error (overflow) for row 5, column 1 (t).

The resulting data looks like this:

829818405
829818406
829818407
2147483647

I also tried just now with a much higher value, 31006746371945654, and that threw the same overflow error as 2147483648.

And last, I did confirm that if I create the table with the column defined as bigint, the data inserted is correct.

create table #t (t bigint)

bulk insert #t from 'c:\temp\test.csv'
with (datafiletype = 'char',
fieldterminator = '|'
)

select * from #t

Resulting data:

2147483647
2147483648
310067463717
310067463718
310067463719