java – Aplicação Spring Boot Error 500 não lista meus paises


import com.github.Anacarlags.citiesapi.repository.CountryRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RestController
@RequestMapping("/countries")
public class CountryResource {
    @Autowired
    private CountryRepository repository;
    public CountryResource(CountryRepository repository) {
        this.repository = repository;
    }

    @GetMapping
    public List<Country> countries(){
        return repository.findAll();
    }

}```

**Mostra isso**

´´´2021-02-25 18:01:43.653  INFO 3050 --- (           main) c.g.A.citiesapi.CitiesApiApplication     : Starting CitiesApiApplication using Java 11.0.10 on aninhacarla with PID 3050 (/home/ana-carla/Documentos/cities-api/build/classes/java/main started by ana-carla in /home/ana-carla/Documentos/cities-api)
2021-02-25 18:01:43.675  INFO 3050 --- (           main) c.g.A.citiesapi.CitiesApiApplication     : No active profile set, falling back to default profiles: default
2021-02-25 18:01:45.611  INFO 3050 --- (           main) .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-02-25 18:01:45.791  INFO 3050 --- (           main) .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 135 ms. Found 1 JPA repository interfaces.
2021-02-25 18:01:47.209  INFO 3050 --- (           main) o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2021-02-25 18:01:47.237  INFO 3050 --- (           main) o.apache.catalina.core.StandardService   : Starting service (Tomcat)
2021-02-25 18:01:47.238  INFO 3050 --- (           main) org.apache.catalina.core.StandardEngine  : Starting Servlet engine: (Apache Tomcat/9.0.43)
2021-02-25 18:01:47.429  INFO 3050 --- (           main) o.a.c.c.C.(Tomcat).(localhost).(/)       : Initializing Spring embedded WebApplicationContext
2021-02-25 18:01:47.429  INFO 3050 --- (           main) w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 3434 ms
2021-02-25 18:01:47.801  INFO 3050 --- (           main) com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2021-02-25 18:01:47.980  INFO 3050 --- (           main) com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2021-02-25 18:01:48.080  INFO 3050 --- (           main) o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo (name: default)
2021-02-25 18:01:48.206  INFO 3050 --- (           main) org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.4.28.Final
2021-02-25 18:01:48.426  INFO 3050 --- (           main) o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2021-02-25 18:01:48.687  INFO 3050 --- (           main) org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL10Dialect
2021-02-25 18:01:49.234  INFO 3050 --- (           main) org.hibernate.tuple.PojoInstantiator     : HHH000182: No default (no-argument) constructor for class: com.github.Anacarlags.citiesapi.Country (class must be instantiated by Interceptor)
2021-02-25 18:01:49.650  INFO 3050 --- (           main) o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: (org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform)
2021-02-25 18:01:49.663  INFO 3050 --- (           main) j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2021-02-25 18:01:50.365  WARN 3050 --- (           main) JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2021-02-25 18:01:50.654  INFO 3050 --- (           main) o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2021-02-25 18:01:51.141  INFO 3050 --- (           main) o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2021-02-25 18:01:51.172  INFO 3050 --- (           main) c.g.A.citiesapi.CitiesApiApplication     : Started CitiesApiApplication in 8.703 seconds (JVM running for 9.563)```

disk encryption – Can I safely disable and re-enable Secure Boot when Bitlocker is used in order to make a Forensic Image?

I am about to make a forensic image (using dc3dd from OSFClone) of a laptop and in this specific case I’d like to startup using an bootable USB stick with OSFClone and image the disk to an external disk. The laptop in this case used Bitlocker with (I suspect) a TPM 2 chip. I did receive a Bitlocker recovery key for this laptop but I cannot be 100% sure that the recovery key is correct. I did also receive a local Windows Administrator user which I could use to boot and login to Windows and check the recovery keys but I rather don’t want to boot the machine into Windows at all.

My plan is to (temporarily) disable Secure Boot, boot from the OSFClone USB and make a forensic image to an external disk. After that I want to re-enable Secure Boot again. I wonder if Bitlocker will prompt to enter a Recovery Key in this case when booting normally again? Or will it boot straight into Windows (after re-enabling) like nothing has happened?

It’s an option if I have to enter the Bitlocker recovery key once after imaging and boot into Windows. But I rather don’t boot into Windows and as I said I cannot be 100% sure the recovery key I’ve received is correct.

Lastly, what happens if I do (accidentally) boot into Windows before re-enabling Secure Boot, does re-enabling Secure Boot change back the old behavior (no recovery key required) or did it then save that one “unsecure boot” state and prompt it anyway till a recovery key is entered.

Also in this case I am not sure if OSFClone will image the unencrypted disk (which I suspect in case of a SED disk with TPM-only, as it should unlock when the machine with TPM and disk power on) or will I only manage to image the encrypted disk (which I suspect when SED and/or TPM is not used). Either way, the forensic processing software we use (Intella by Vound-Software) should be able to handle Bitlocker encrypted images when the recovery key is supplied but I rather want to understand exactly how it works and if my understanding of this matter is correct.

java – What is the better way to save swagger code gen plugin generated model classes in spring boot maven application?

So, I am working on a spring boot maven project in Eclipse IDE. And here is my pom.xml.


<?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 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <artifactId>spring-swagger-codegen-api-client</artifactId>
    <name>spring-swagger-codegen-api-client</name>
    <packaging>jar</packaging>
    <url>https://github.com/swagger-api/swagger-codegen</url>
    <description>Swagger Java</description>
...
...ommited for brevity
...

    <build>
        <plugins>

<plugin>
    <groupId>io.swagger</groupId>
    <artifactId>swagger-codegen-maven-plugin</artifactId>
    <version>2.3.1</version>
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <inputSpec>${project.basedir}/src/main/resources/customer-data-v2.json</inputSpec>
                <language>java</language>
                <configOptions>
                   <sourceFolder>swagger</sourceFolder>
                </configOptions>
            </configuration>
        </execution>
    </executions>
</plugin>
        </plugins>
    </build>

</project>

So when I compile the project using mvn compile it executes swagger code gen plugin and outputs all the generated classes to swagger folder under target folder.

And I am using swagger code gen plugin to generate all the model classes using the customer json schema which it currently outputs to swagger sub folder under target folder.

So I know that I can keep all the generated classes under target folder itself as maven executes swagger plugin before compiling the actual source code. So right now there is no issue with it.

But all the generated classes are Model classes which are used for processing request and response data. So currently there is no issue in doing so, but in future we might add additional functionality which might require updates to generated model classes and may be difficult to update them from target folder.

So my main question is should I move all the generated pojo classes to something like src/main/org/**/* folder or keep the model classes inside target folder itself? What is the better approach including other alternative?

linux – How do I boot xen kernel on Fedora

In stalled xen on Fedora 33 and I get this error when I try to load the xen kernel

Loading Xen 4.14.1 ...
error: ../../grub-core/fs/fshelp.c:257:file
`/EFI/fedora/x86_64-efi/multiboot2.mod' not found.
error: ../../grub-core/script/function.c:119:can't find command `multiboot2'.
Loading Linux 5.8.15-301.fc33.x86_64 ...
error: ../../grub-core/script/function.c:119:can't find command `module2'.
Loading initial ramdisk ...
error: ../../grub-core/script/function.c:119:can't find command `module2'.

Is this the right kernel 1.1M gzip file and how do you boot this to test this?

dual boot – Setting swap file as default results in “Permission denied”

I have been following the tutorial on Linuxize on how to create a swap file however when I try to permanently keep the swap file on using /swapfile swap swap defaults 0 0 it comes back saying “Permission denied”. I am running a dual-boot of ubuntudde and pop! os and there is only one user on each os, both of which are mine. I have tried to do this on both operating systems which didn’t work either, though they both share a /home directory so this shouldn’t be an issue as far as I am aware. What do I need to do to remove the permission? Also why would it be there in the first place as I have set no restrictions?

boot – Ubuntu 20.04 not booting correctly

I have a Dell Inspiron 15 5000 with NVIDIA GeForce MX230.
I upgraded my Ubuntu from 18.04 to 20.04 by means of the graphical updater built-in in the system. During the installation of the packages, the system froze and after many hours of indecision I forced a reboot.
I think the system freeze was somehow related to NVIDIA GPU.
Since then I have faced (and solved) many problems related to this broken system upgrade, however I still have a worrying problem related to the system boot.

Basically, this problem can be faced in two different ways:

  • Sometimes the initial Dell splash screen freezes without showing the grub2 choices menu.
  • Otherwise, when I choose the Ubuntu system, I get the error:
error: Command failed. 
... 
error: Command failed. 
error: you need to load the kernel first.

Press any key to continue...

A trick I use to boot the system is just by restarting it many times until it boots correctly.

To address these booting problems I tried the following:

$ dpkg --list | egrep -i --color 'linux-image|linux-headers|linux-modules' | awk '{ print $2 }'
linux-headers-5.4.0-65
linux-headers-5.4.0-65-generic
linux-image-5.4.0-65-generic
linux-modules-5.4.0-65-generic
linux-modules-extra-5.4.0-65-generic

I thought that something is wrong with partitions at boot, but I was not able to discover more.
The most important partitions of my system are:

$ df -h
Filesystem       Size  Used Avail Use% Mounted on
udev             7,7G     0  7,7G   0% /dev
/dev/nvme0n1p8    37G   26G  9,4G  73% /
/dev/nvme0n1p1   746M   91M  656M  13% /boot/efi
/dev/nvme0n1p10  148G  131G  9,0G  94% /home

Why do you think I am getting this boot errors? Should I reinstall my system? In this case, how can I do it safely?

SAMSUNG a10s boot loop after TWRP flash

I have bought a SAMSUNG A10s phone and tried to install TWRP according to this instruction. I was able to unlock the bootloader and enter the ‘Downloading’ mode. I used a Debian computer and the Heimdall tool to flash this TWRP image into the recovery partition (which replaced the existing recovery.img, I took no backup – daft, I know).

Caused by the unlocked bootloader I got a warning with every startup. The usual key-combination for the bootloader menu did not work. So, after a few boot procedures, I tried the offered option to lock the bootloader and perform a factory reset.

Unfortunately, this brought me to bootloop. I was only able to enter the ‘Downloading’-mode again. Now, the bootloader is locked again but the images are invalid. I get this error message:

<!>
Partition recovery
Reason recovery: Eroor verifying vbmeta image: invalid vbmetaheader
SAMSUNG recovery, A107FXXU7BTL1, 36415554R
SAMSUNG vbmeta, A107FXXU7BTL1, 36415554R

Quitting this ‘Downloading’ mode brings me back to the loop which reaches the SAMSUNG logo before it boots angain.

Can anyone explain this situation? Has anyone an idea for a solution? Using Heimdall, I can still read the PIT. So, maybe I can also flash any images. I am very glad for help!

boot – Delete GRUB From Windows

I used to have windows 10… then i installed ubuntu 20.04 along with it

Now I want to sell my laptop so I formatted the partition which had ubuntu on it.
But now I have a problem which is when I boot my laptop the grub bootloader keeps showing!

This is what I have tried to do so far

  1. I Formatted all the partitions and reset my windows system to factory.
    2)I used cmd as follows:

a)diskpart
b)list disk
c)select disk 0
d)list volume
e)select volume 4 (which is labeled system 570mb)
f)assign leytter=x
g)exit
h)x:
i)dir
j)cd efi
k)dir
l)rmdir /s ubuntu

And then i restarted my pc and when i checked again the ubuntu volume was gone bu the grub bootloader still shows when i boot

I booted into bios(uefi) and found that the boot priority is for something called (limpus lite) and when i made the (windows bootloader) at the top the grub menu stoped showing

But how can i get rif of the grub and that limpus lite forever because from time time suddenly when i boot my system it boots to the grub instead windows although the priority is for windows.

run Macro/Script from a USB Flash-drive on Windows boot

Hellu 🙂
I’ve a question. As the title stated, would it be possible to run a Macro/Script from a USB while windows is booting? To clarify:

I boot up the PC,

I plug in my USB,

My PC recognize that a USB is plugged in,

It runs a macro from the USB to boot into bios (it presses the required key for me)

Perhaps it would take the PC too long to recognize that a USB is plugged in and start up BIOS, before the boot sequence is complete?

windows 10 – Boot from Cloned USB-SSD

I cloned my internal disk (win10) to an usb drive (linux:dd). I want to select at startup which drive to use.

But if I boot from USB, windows always uses the internal drive.

I guess the problem is the same UUID of the original and cloned device-partitions.

Can I change the partition-UUID afterwards and keep booting from USB?

After some testing it seems to me, that windows “discovers” the inernal drive at boot-up and overlays the internal partitions over the usb-partitions.