Monday, April 11, 2022

Spring Boot: web service returns with 404

 

>PROBLEM


web service returns with 404


>SOLUTION

If you have already checked the protocol, then check if the @ResponseBody annotation is missing.


- BEFORE:


@PostMapping(value = {"/reset/{token}"})

public ResponseDTO resetPassword(HttpServletRequest request, @PathVariable String token) {

ResponseDTO dto = request(request, token);

dto.setData("hello there!");

return dto;

}



- AFTER:


@PostMapping(value = {"/reset/{token}"})

@ResponseBody

public ResponseDTO resetPassword(HttpServletRequest request, @PathVariable String token) {

ResponseDTO dto = request(request, token);

dto.setData("hello there!");

return dto;

}


>ENV

spring boot 2

java 17


Monday, February 21, 2022

eclipse: sonarlint: deactivate the @SuppressWarnings warning

 

>PROBLEM


Undesirable warning.





>SOLUTION

Go to menu, Window, Preferences and follow by the image:






>ENV

Eclipse jee-2021-12
Windows 10

Sunday, February 20, 2022

Eclipse: Store preferences has encountered a problem. An internal error occurred during "Store Preferences". The system was not able to find the filepath

 

>PROBLEM


Eclipse returns the following error after altering data on preferences (menu, Windows, Preferences):

  Store preferences has encountered a problem. An internal error occurred during "Store Preferences". The system was not able to find the filepath


>SOLUTION


- Follow the images:








>ENV


Windows 10
Eclipse jee-2021-12


eclipse: sonarlint: restore rule


>PROBLEM

Using Eclipse's sonarlint , a rule was removed and it is wished to be restored. 


>SOLUTION




>ENV

Eclipse



Wednesday, February 16, 2022

JEE, Hibernate, PostgreSQL: Caused by: org.postgresql.util.PSQLException: ERROR: must be owner of table server


 >PROBLEM


Hibernate fails when the application starts throwing the following messages:


Caused by: org.postgresql.util.PSQLException: ERROR: must be owner of table server 2022-02-16 22:18:43 # [restartedMain] # WARN  # o.h.t.s.i.ExceptionHandlerLoggedImpl # method: handleException # GenerationTarget encountered exception accepting command : 

Error executing DDL "alter table public.provider 

       add column provider_details_pk int8" via JDBC Statement

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "

    alter table public.provider 

       add column provider_details_pk int8" via JDBC Statement

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "

    alter table public.server 

       add column provider_pk int8" via JDBC Statement



>SOLUTION


The tables were create via terminal using postgres' admin account that it is now allowed to remote access due to security issues.

Drop the tables that have the owner access issue using the terminal and the admin's account, the same used to create them.

Recreate the tables using another account that has remote access priviledges.


>ENV

Debian 10
PostgreSQL 10
Windows 10


Tuesday, February 8, 2022

Git: Windows: Failed to add the host to the list of known hosts


>PROBLEM

Attempt to a Git operation over remote repository returns the following message:

Could not create directory 'your path here' (No such file or directory).
Failed to add the host to the list of known hosts (/your local path here/known_hosts).

See picture where it points to "issue".






>SOLUTION 

1. Open Git Bash console.




2. Perform the command below to enable read and write;

chmod 776 your local path here/known_hosts






3. Keep the git bash console opened, test running a git command again.
For instance:

git ls-remote


The problem is gone as the figure shows where it points to "solved".




>ENV

Windows 10




[REF]: faq-Failed to add the host to the list of known hosts

Wednesday, January 12, 2022

docker: Angular client fails to call web service on docker


 >PROBLEM


You've have an Angular project that uses a web services, for instance Java Spring Boot, that works on the environment that is was created, but when the projects (the client and the WS) are migrated to Docker containers, they fail to communicate.

>SOLUTION


If the usual call using localhost fails, replace it with “host.docker.internal”.

  // usual, outside docker
  //private serverUrl = 'http://localhost:8081'

  // docker, if it fails localhost
  private serverUrl = 'http://host.docker.internal:8080'


Detailed procedure here:

>ENV

Windows 10
Docker
Angular 7..13
Node.js 12..16

Tuesday, January 11, 2022

node.js: angular: An unhandled exception occurred: require() of ES Module node_modules/@angular/compiler-cli/bundles/index.js


 >PROBLEM


- After the following procedure:


ng new myproject

npm install rxjs

npm audit fix --force

ng serve


- The angular application fails to start returning the following message:


An unhandled exception occurred: require() of ES Module node_modules/@angular/compiler-cli/bundles/index.js 

/data/prj/node_modules/@angular-devkit/build-angular/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js not supported. 

Instead change the require of index.js in 

/data/prj/node_modules/@angular-devkit/build-angular/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js to a dynamic 

import() which is available in all CommonJS modules. 

See "/tmp/ng-Fe4Op7/angular-errors.log" for further details. 





>SOLUTION


Avoid using --force argument with "npm audit" with this versions (detailed below under ENV topic) until the bug is fixed.

Use just: 

npm audit fix


>ENV

Windows 10

Angular CLI: 13.1.2

Node: 16.13.1

Package Manager: npm 8.1.2

OS: win32 x64


Saturday, January 8, 2022

maven: Error: Could not find or load main class...Caused by: java.lang.ClassNotFoundException:...

 

>PROBLEM


Attempt to run a mvn command, for instance:

  mvn -version

  

Returns:

  <!--Could not find or load main class ...

  Caused by: java.lang.ClassNotFoundException: ...-->



>SOLUTION


Check your envvars (environment variables).

The configuration shall be something like this:


M2_HOME = C:\apache-maven

MAVEN_OPTS=-Xms256m -Xmx512m

Path=%Path%;%M2_HOME%\bin


For some mistake, you may have a misconfiguration. For example:


***WRONG:

MAVEN_OPTS=-%M2_HOME%\bin



>ENV

Windows 10

apache-maven





@CTL: y;faq-Error: Could not find or load main class...Caused by: java.lang.ClassNotFoundException:<memo<maven;.

Tuesday, January 4, 2022

angular: Cannot parse arguments. See below for the reasons. Argument --ssl could not be parsed using value "true\r".Valid type(s) is: boolean

 

>PROBLEM


Angular project fails starting and returns the following error message:


Cannot parse arguments. See below for the reasons.

Argument --ssl could not be parsed using value "true\r".Valid type(s) is: boolean



>SOLUTION


It happens when a project using Windows encoding is deploy on *nix environment due the carriage return (CR) differences.

Convert the CRs to unix format.

There are many ways of doing that:


1. If using Git, when it is installed, during its install wizard, there are options to set automatically de CR format.


2. Free apps like SciTE, Notepad++, VSCode and etc. have encoding and CR converters.


>ENV

windows 10

angular



@CTL:
y;faq-Cannot parse arguments. See below for the reasons. Argument --ssl could not be parsed using value "true\r".Valid type(s) is: boolean<memo<angular;.

Monday, January 3, 2022

docker: angular service returns ERR_EMPTY_RESPONSE

 

>PROBLEM


Attempt to access an Angular project running from a docker fails, returning on the browser "ERR_EMPTY_RESPONSE".


>SOLUTION


Add --host argument to the "ng serve" command to start the service.


- before:

ng serve --port 4400 --ssl true


- after:

ng serve --port 4400 --ssl true --host 0.0.0.0

also tested OK with:
ng serve --port 4400 --ssl true --host=0.0.0.0


>ENV

windows 10
angular 16


>ref

tipsfordev.com/localhost-didn-t-send-data-err-empty-response-and-curl-52-empty-reply-from-server


@CTL:

y;faq-angular: ERR_EMPTY_RESPONSE<memo<docker;.

Sunday, January 2, 2022

docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "-v": executable file not found in $PATH: unknown.

 

>PROBLEM


Attempt to map a volume fails retuning:


docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "-v": executable file not found in $PATH: unknown.


>SOLUTION


WRONG:

docker run -it --name extodo alsdias/express_todo -v C:\data:/home


RIGHT:

docker run -it --name extodo -v C:\data:/home alsdias/express_todo


>ENV

w10

docker


Friday, December 31, 2021

vmware v.15: VMware Workstation and Device/Credential Guard are not compatible


>PROBLEM

VMware Workstation and Device/Credential Guard are not compatible


>SOLUTION

If using VMWare v.15, upgrade it to v15.5


>ENV

w10

vmware15


Monday, December 13, 2021

Jira Application: Listing closed sprints

 

>PROBLEM

You need to access the issues from closed sprints.


>SOLUTION

On the images below, follow the arrows by their order:









Tuesday, November 16, 2021

Angular: SassError: Expected newline

>PROBLEM

You have a Angular project using SaSS.

Starting the server, returns the following message:

  SassError: Expected newline


>SOLUTION

Correct the .sass files converting to Sass syntax.

- syntax:
https://sass-lang.com/documentation/syntax

- Example:


>before


label {
  display: block;
  margin-top: 10px;
}

.card-container.card {
  max-width: 400px !important;
  padding: 40px 40px;
}

.card {
  background-color: #f7f7f7;
  padding: 20px 25px 30px;
  margin: 0 auto 25px;
  margin-top: 50px;
  -moz-border-radius: 2px;
  -webkit-border-radius: 2px;
  border-radius: 2px;
  -moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
  -webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
  box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
}

.profile-img-card {
  width: 96px;
  height: 96px;
  margin: 0 auto 10px;
  display: block;
  -moz-border-radius: 50%;
  -webkit-border-radius: 50%;
  border-radius: 50%;
}


>after


label
  display: block
  margin-top: 10px


.card-container.card
  max-width: 400px !important
  padding: 40px 40px


.card
  background-color: #f7f7f7
  padding: 20px 25px 30px
  margin: 0 auto 25px
  margin-top: 50px
  -moz-border-radius: 2px
  -webkit-border-radius: 2px
  border-radius: 2px
  -moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3)
  -webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3)
  box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3)


.profile-img-card
  width: 96px
  height: 96px
  margin: 0 auto 10px
  display: block
  -moz-border-radius: 50%
  -webkit-border-radius: 50%
  border-radius: 50%


>ENV

w10
node16
Angular13

Tuesday, October 12, 2021

vue create fails to start project using npm run serve returning: Local: "http://[C:]:3000/"


>PROBLEM

Following the instructions in Vue's documentation after issuing the command:

npm run service


returns the following:

Local: "http://[C:]:3000/"


Naturally, this address fails.

 



>SOLUTION

After searching Vue's documentations and trying to set configuration files, the easiest way was to start the app using the following comand:

npm run serve -- --port 3000 --host localhost








TIP

Try vite instead using just vue. Check its topic here.


>ENV

Windows 10
Tested with Vue 2 and 3



The App Stalking Thing And The Disguised Threats

For Portuguese Version


Cell phones (smartphones) are objects of our daily lives.

If before we could not leave the house without a wallet (money and documents), today we are moving to replace it through the cell phone.

At first, I saw this as a good thing.

Wallet and cell phone are uncomfortable to carry because of their volume and weight.

Women wear purses, maybe they don't mind too much, but men like to use their pockets to avoid having their hands full.

With the possibility of paying bills via cell phone, I almost thought of retiring the old wallet, but I thought again.

There are several points of consideration, however, I will stick to the main ones:


- If someone steals your cell phone, or you lose it?
The cellphone concentrates everything and this increases the chances of deceit.
Despair is greater.

- If the cellphone is "contaminated" by apparently harmless applications that we installed ourselves because they offered something that interested us, and for free (something irresistible for most of us).

These "pseudo-harmless" applications mostly collect information as a form of payment for the so-called free service. 


Nothing is free.
Everything needs a livelihood.

When the information collected is not that harmful, we still don't care.

The question is how to measure this?
How can we know the content of the information passed on that was presumable safe to be made public today but will no longer be so tomorrow?

Sometimes the useless information today, under a future context may become something very sensitive.


In the face of all this, I have long been reduced my personal exposure, because accepting this exposure is contributing to the loss of the little freedom that will be left tomorrow, as we get used to via gradual acceptance to, as it was like in the past when the boyfriend went out with a girlfriend accompanied by her younger brother by her parents' imposition. 😊

I didn't catch that time, but I became the younger brother. Terrible for me and for them. 😁


My attention to the subject of security has worsened, resulting in a very serious occurrence with access to my bank account at Itaú (Brazil's bank). Despite accessing the account, bill payments were blocked, which required me to wait from a few hours to a few days to unlock them.

I sometimes resorted to the bank's IT support, but without a solution.

They always returned the same small list of apps that are not compatible with the itaú's bank app and must be uninstalled, otherwise they block any transaction.


There were two solutions: either give up on the bank or solve the problem by digging yourself into the issue.

Since I like Itaú (many years of account), and being an IT professional, I accepted as a challenge to solve the problem because I had time to do so, as I was on vacation.

If in the day-to-day rush, I wouldn't have had time, and I would certainly have transferred all the operations to another bank's account that hasn't this obstacle.

I had already uninstalled all remote cell phone applications that Itaú's IT support had condemned as incompatible with the bank's security terms, but the problem remained.


I had to create a new criterion, different from the support direction so that I wouldn't end up having to uninstall all mobile apps using that mobile option that deletes everything and returns to the original state when you bought it. . 👿

It would be my last option.



The criterion I've chosen was to survey by the name of the manufacturer.

As the TeamViewer application causes this blocking for the Itaú Bank app, I searched my cell phone for all the applications and started research through the notebook via browser, collecting information about each one of them, until... I discovered that the LifeAR application was manufactured by TeamViewer, the same manufacturer as the remote connection application that goes by that name (TeamViewer).

The problem is that this application has nothing to do with a remote connection, at least by its description.
It is an application of "augmented reality", and for this reason, I would never discover it if I had not adopted a different approach of solution, different from the one that the bank's support had given me.

I uninstalled the LifeAR app and tested it after 2 days of waiting for support to unlock my transactions. This delay in blocking made the testings quite difficult. 
Each unsuccessful attempt represented 1 to 2 days waiting for unlock until I could make a new test.
I needed to get it right fast, with as few tries as possible, or wipe everything off my cell if I didn't have the time.

Bingo!
Once I uninstalled the LifeAR augmented reality app, the locks were gone and I was able to start scheduling my accounts. 
Lucky I don't leave accounts until the last minute to pay them.
I always act in advance because I don't trust connectivity: Murphey's Law.

What if you weren't an IT professional, or weren't lucky enough to have the time to "play" with this issue for days? 
It would certainly end up in line at the bank, or in line at an ATM (those self-service machines).

A few days later, through Estadão Newspaper, I accessed this article from the Link channel, which deals with IT issues, talking about the most recent threats of hacking via stalking through apps that we install ourselves on cell phones.

After re-evaluating the news that threatens our security, as the antivirus is often not prepared for such new issues, and therefore lets them pass and does not detect them until you become the guinea pig (or lab mouse) that will trigger the alert to the manufacturers who will then take action.
But becoming a lab mouse can be very expensive.

Conclusion: the best solution is to have two different cell phones.
One without any apps installed except those of the banking and finance agents we trust.
Another "playground" phone, where you can install the apps you like, those utilities that make a difference in our lives.

Indeed!...
However, it is worth remembering that you will continue to be tracked by Google for all your activities (pictured below).
Turning off the cell phone is no use. Just taking out the battery is effective while they do not embed a not removable extra battery (in this extreme case, just letting it behind would be the solution or buying an alternative without this resource).
 
Don't conform.
If your freedom isn't important for you, maybe others' freedom is, including your children's future.

Government despotism grows intensely, whether by democracies or by totalitarian regimes.
The cell phone is the perfect surveillance tool.

Mind about this!


PARTIAL COPY OF E-MAIL SENT TO THE MANAGEMENT OF ITAÚ BANK




GOOGLE MAPS TIMELINE (TRACKING REPORT)












Novas Ameaças de Segurança em APPs





Celulares (smartphones) tornaram-se objetos do cotidiano.
Se antes não podíamos sair de casa sem a carteira (dinheiro e documentos), hoje caminhamos para substituí-la através do celular.

A priori vi com bons olhos.
Carteira e celular são incômodos para carregar pelo volume e peso que têm.
Mulheres usam bolsa, talvez não se importem muito, mas homens gostam de usar os bolsos para evitar ter as mãos ocupadas.

Com o viabilização do pagamento de contas via celular, quase pensei em aposentar a velha carteira, mas repensei.

Existem vários pontos de consideração, no entanto, vou ficar com os principais:

- Se roubarem o celular, ou perdê-lo?
O celular concentra tudo e isso aumenta as chances de dolo.
O desespero é maior.

- Se o celular estiver "contaminado" por aplicações aparentemente inofensivas que nós mesmos instalamos porque ofereciam algo que nos interessava, e de graça (algo irresistível para a maioria de nós).
Essas aplicações "pseudoinofensivas" na maioria das vezes coletam informações como forma de pagamento pelo serviço dito gratuito. Nada é de graça. Tudo precisa de uma forma de subsistência.
Quando a informação coletada não é tão prejudicial, ainda não nos importamos.

A questão é como medir isso?
Como podemos saber o teor da informação repassada e quando o que é aparentemente seguro tornar público hoje deixa de sê-lo amanhã?


Às vezes, a informação inútil de hoje, sob um novo contexto do amanhã, torna-se algo muito sensível.

Diante de tudo isso, há muito venho reduzindo minha exposição pessoal, porque aceitar essa exposição é contribuir para a perda da pouca liberdade que sobrará amanhã, à medida que vamos nos acostumando (e aceitando) a ser pajeados pelos nossos celulares, assim como era bem antigamente em que o namorado saia com a namorada acompanhada do irmão caçula por imposição dos pais dela. 😊

Eu não peguei essa época, mais cheguei a ser o irmão caçula. Terrível para mim e para eles. 😁

A minha atenção sobre o assunto segurança se agravou diante uma ocorrência muito séria com o acesso à minha conta bancária no Itaú. Apesar de acessar a conta, os pagamentos de contas eram bloqueados, o que me exigia esperar de algumas horas a alguns dias para desbloqueá-los.

Recorri inúmeras vezes ao suporte de TI do banco, mas sem solução.
Eles retornavam sempre a mesma pequena lista de aplicações que não são compatíveis com a app do banco e que devem ser desinstaladas, pois do contrário, elas bloqueiam qualquer transação.


Tinha duas soluções: ou desistir do banco ou descobrir o problema.

Já que gosto do Itaú (muitos anos como correntista), e sendo profissional de TI, aceitei como desafio resolver o problema pois tinha tempo à ocasião, já que estava de férias.
No corre-corre do dia-a-dia, eu não teria tido tempo, e certamente teria transferido todas as operações para outro banco onde também tenho conta e que não apresentava esse empecilho.

Eu já havia desinstalado todos os aplicativos de conexão remota do celular que o suporte de TI do Itaú havia condenado como incompatível com os termos de segurança do banco, mas o problema continuava.

Eu tinha que criar um critério novo, diferente da orientação do suporte, para que não acabasse tendo que desinstalar todas as apps do celular, ou seja, utilizar aquela opção do celular em que o mesmo apaga tudo e retorna ao estado original de quando você comprou. 👿
Seria minha última opção.

O critério que escolhi foi eleger o nome do fabricante.
Como a aplicação TeamViewer provoca esse bloqueamento para a app do Itaú, pesquisei no meu celular todas as aplicações que tinha e comecei uma pesquisa pelo notebook via browser coletando informações sobre cada uma delas, até que... descobri que a aplicação LifeAR era fabricada pela TeamViewer, o mesmo fabricante da aplicação de conexão remota que leva esse nome (TeamViewer).

O problema é que tal aplicação nada tem com conexão remota, ao menos no descritivo que ela traz.
Trata-se de uma aplicação de "realidade aumentada", e que por essa razão jamais iria descobrir se não tivesse adotado uma outra lógica de solução, diferente daquela que o suporte havia me passado.

Desinstalei a aplicação LifeAR e testei após 2 dias de espera para que o suporte desbloqueasse minhas transações. Essa demora nos bloqueios tornavam os testes bastante difíceis. Cada tentativa com insucesso representava de 1 a 2 dias para desbloquear, até que pudesse fazer um novo teste.
Eu precisava acertar rápido, com o menor número de tentativas possível ou apagar tudo do celular, se não tivesse mais tempo.

Bingo!
Uma vez desinstalada a app de realidade aumentada LifeAR, os bloqueios se foram e pude começar a agendar minhas contas. Sorte que não deixo contas para a última hora, sempre agendo com muita antecedência porque não confio em conectividade: Lei de Murphey.

E se você não fosse um profissional de TI, ou não tivesse tido a sorte de ter tempo para "brincar" com isso durante dias?  Certamente acabaria na fila do banco, ou na fila de uma ATM (aquelas máquinas de autoatendimento).

Alguns dias depois, através do Jornal Estadão acessei este artigo do canal Link que trata de assuntos de TI, falando das ameaças mais recentes de hackeamento via stalking através de apps que nós mesmos instalamos no celular.

Depois de reavaliar as novidades que ameaçam nossa segurança, já que o antivirus muitas vezes ainda não está preparado para tais novidades, e portanto deixa passar porque ainda não detecta, até que você se torne a cobaia que irá disparar o alerta aos fabricantes que então tomarão providência. 
Só que virar cobaia pode sair muito caro.

Conclusão: a melhor solução é ter dois celulares diferentes.
Um sem qualquer app instalada, exceto aquelas dos agentes bancários e financeiros em que temos confiança, e um outro celular de "playground", onde você pode instalar as apps que gosta, aquelas utilidades que fazem diferença em nossas vidas.

Deveras!... 
Contudo convém lembrar que você continuará rastreado pelo Google em todas a suas atividades (foto abaixo).
Desligar o celular não adianta. Só mesmo tirando a bateria até que eles inventem 
a qualquer pretexto uma bateria extra embutida, não removível. Neste caso só desativando tal bateria extra ou dando preferência a celulares sem a mesma. Futuro? Sim, mas não improvável.
 
Não se conforme.
Se a sua liberdade não é importante, talvez a dos outros seja, incluindo o futuro dos seus filhos.

O despotismo governamental cresce intensamente, sejam nas democracias ou nos regimes totalitários.
O celular é o instrumento perfeito de
surveillance.

Pensa nisso!

Nota: alguns links podem estar em inglês. Utilize o modo de tradução do browser ou do próprio site.


CÓPIA PARCIAL DE E-MAIL ENVIADO À GERÊNCIA DO BANCO ITAÚ





GOOGLE MAPS TIMELINE (RELATÓRIO COM SEU RASTREAMENTO)







Monday, October 11, 2021

Avoid Lenovo - Short-term Support (Evite Lenovo - Assistência Técnica de Curto Prazo)


NOTE
ENGLISH  VERSION (below after prints)


PORTUGUESE VERSION


Aproximadamente 1 ano e meio atrás comprei um Lenovo Yoga.
A máquina sempre teve uma performance no limite do desejável.
No resto, funcionava sem problemas.
Imaginava comprar uma SSD para resolver o problema da lentidão.

Repentinamente, o notebook perdeu a conexão com o Wi-Fi usando cabo.
Verificando o problema, descobri que as portas USB haviam parado de funcionar.

Qualquer tentativa de reparo via disco de recuperação ou imagem, tornou-se inviável sem conexão USB. Notebooks modernos não vêm mais com CD-ROM, que embora algo já em desuso, poderia representar uma medida paliativa.

Acessei o suporte, expliquei o problema.

A resposta foi que não têm mais peças e a fábrica não dá mais assistência.

Aproximadamente 18 meses depois da compra, a minha lata de lixo ficou mais gorda.

Lições aprendidas:

- Lenovo de novo, JAMAIS!

- Produto chinês? Só em último caso.


Lembrando que temos duas boas razões para evitar produtos chineses:

- A política one-way: compre, mas fora da garantia, só a sorte.

- A política expansionista: comprando produtos chineses você transfere dinheiro (recursos) e fortalece um regime político que à medida que se fortalece, está mostrando a que veio (Tibete, Taiwan, etc.)


 

 






ENGLISH VERSION


I purchased a Lenovo Yoga notebook approximately 1.5 years ago.

The machine performed at its minimum desirable limit.

Anyway, it worked without problems, so I imagined buying an SSD to help to solve the performance issue.


Suddenly, the notebook lost the Wi-Fi connection using cable.

Checking the malfunction, I found that the USB ports had stopped working.

Any repair attempt via recovery disk or image became unfeasible without the USB connection. Modern notebooks have no longer CD-ROM, which could be a palliative measure.


Accessing Lenovo's support, I explained the malfunction.

The answer was that they do not have any more replaceable parts and the factory provides no further assistance.

Approximately 18 months after purchase, my trash got fatter.


Lessons Learned:

- Lenovo again, NEVER!

- Chinese product? Only as a last resort.

Remembering that we have two good reasons to avoid Chinese products:

- Unilateral policy: buy, but out of warranty, just luck may help you.

- The expansionist policy: by buying Chinese products, you transfer money (resources) and strengthen a political regime that, as it gets stronger, shows what purposes come for.  (Tibet, Taiwan, etc.)

Wednesday, August 25, 2021

hibernate: java.lang.IllegalArgumentException: org.hibernate.QueryException: Unable to resolve path


 >PROBLEM


java.lang.IllegalArgumentException: org.hibernate.QueryException: Unable to resolve path [e.title], unexpected token [e] [select e from br.com.adr.model.entity.security.uni.RoleEntity WHERE e.title = :title]



>SOLUTION


Original code:

String sql = "select e from " + this.entityName + " WHERE e.title = :title";

Query query = em.createQuery(sql, RoleEntity.class);

query.setParameter("title", title);


Fixing the code:

Missing the 'e' entity alias:

String sql = "select e from " + this.entityName + " e WHERE e.title = :title";


>ENV

Windows 10
JSF 2.2
WildFly 21

Tuesday, August 24, 2021

JEE: Using JSF, Primefaces and p:growl the messages return duplicated (twice).

 

>PROBLEM

Using JSF, Primefaces and p:growl the messages return duplicated (twice).





This kind of issue may have alternative reasons.
On this post it is shown two of them:
- The simple case
and
- The modal case


>SOLUTION #1 - SIMPLE CASE

Find the p:grow element.

Switch the p:growl attribute from:

<p:growl id="growl" showDetail="true"/>

to:

<p:growl id="growl" showDetail="false"/>


Supposing the java code is something like this:

public String remove() {
FacesMessage success = null;
try {
bsn.delete(toEntity());
success = new FacesMessage(FacesMessage.SEVERITY_INFO, "SUCCESS: ID " + this.id + " removed", null);
FacesContext.getCurrentInstance().addMessage(null, success);
clean();
return ModelConfigSvc.SUCCESS;
} catch (BsnException e) {
success = new FacesMessage(FacesMessage.SEVERITY_ERROR, "deletion failed",null);
FacesContext.getCurrentInstance().addMessage(null, success);
return ModelConfigSvc.FAIL;
}
}


or
public String remove() {
FacesMessage success = null;
try {
bsn.delete(toEntity());
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "SUCCESS: ID " + this.id + " removed", null));
clean();
return ModelConfigSvc.SUCCESS;
} catch (BsnException e) {
success = new FacesMessage(FacesMessage.SEVERITY_ERROR, "deletion failed",null);
FacesContext.getCurrentInstance().addMessage(null, success);
return ModelConfigSvc.FAIL;
}
}






>SOLUTION #2 - MODAL CASE

Scenario:
There is a page that lists entities and it may trigger modal pages to update, delete, etc.
In such cases, the modal message may aggregate to the origin page's message, in this case the listing page.

A fast way to fix this leads us to switch the return value to keep the modal opened and not returning to the listing page, so the message doesn't accumulate twice, one from the modal (p:messages) and the other from the listing page (p:growl).

So, it is changed from:
return ModelConfigSvc.SUCCESS;

To:
return ModelConfigSvc.FAIL;

Below, it is shown the detailed information using the "deletion" to illustrate the example.






Issue to be fixed - doubled messages when the modal is closed after the deletion





THE CODE

faces-config.xhtml



roleList.xhtml





roleDeletion.xhtml exibted as modal







FIXING THE ISSUE


RoleDeletion.java







Return value switched to fix the issue

RoleDeletion.java 





Issue fixed






>ENV


Windows 10
JSF 2.2
WildFly 21





Saturday, August 21, 2021

JEE: Caused by: java.lang.IllegalArgumentException: UT010009: Servlet Faces Servlet of type class javax.faces.webapp.FacesServlet does not implement jakarta.servlet.Servlet

 

>PROBLEM


The application fails when deployed on the server (Wildfly/jBoss) return the following message:

  Caused by: java.lang.IllegalArgumentException: UT010009: Servlet Faces Servlet of type class javax.faces.webapp.FacesServlet does not implement jakarta.servlet.Servlet



>SOLUTION


Check the following configuration:

- JDK'S version

- Libraries' versions (Maven's dependencies, etc.)

If the configuration seems correct, try to downgrade (or maybe upgrade) the server's version of JBoss or Wildfly.

For instance, from v.23 to v.21 or lower.

The application server's JEE version must be compatible with the project's libraries versions.

        Check WildFly's JEE versions on its download page.



>ENV

JDK 8/11

Wildfly 21

Eclipse

Windows 10

Tuesday, August 17, 2021

iptables: No chain/target/match by that name.


>PROBLEM

When running a "iptables conntrack" command, for instance like this:
    iptables -A INPUT -p tcp --dport 8081 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
 
returns the error message:
  
  iptables: No chain/target/match by that name.


>SOLUTION

The solution may contemplate alternatives due different causes.
This post shows two of them.

>using linux on a openvz container

OpenVZ servers share a kernel with the host, and as a result, you cannot load any kernel modules, and do some other tasks.

Ask your service provider to turn on the NetFilter for the server.


>linux, but not a container

Check this link.


>ENV

OpenVz container


Wednesday, August 4, 2021

debian 10: nginx fails to install after system upgrade


 >PROBLEM


Scenario:

After performing an upgrade using:

apt update

apt upgrade


nginx returns installing issues and fails to start, returning an error message like this:


Aug 04 13:28:47 myserver.com systemd[1]: Failed to start A high performance web server and a reverse proxy server.

dpkg: error processing package nginx-full (--configure):

 installed nginx-full package post-installation script subprocess returned error exit status 1

dpkg: dependency problems prevent configuration of nginx:

 nginx depends on nginx-full (<< 1.14.2-2+deb10u4.1~) | nginx-light (<< 1.14.2-2+deb10u4.1~) | nginx-extras (<< 1.14.2-2+deb10u4.1~); however:

  Package nginx-full is not configured yet.

  Package nginx-light is not installed.

  Package nginx-extras is not installed.


>SOLUTION

1. Check the installed packages:

  dpkg -l nginx*

Returns:

||/ Name           Version          Architecture Description
+++-==============-================-============-=========================================================
iU  nginx          1.14.2-2+deb10u4 all          small, powerful, scalable web/proxy server
ii  nginx-common   1.14.2-2+deb10u4 all          small, powerful, scalable web/proxy server - common files
un  nginx-doc      <none>           <none>       (no description available)
un  nginx-extras   <none>           <none>       (no description available)
iF  nginx-full     1.14.2-2+deb10u4 amd64        nginx web/proxy server (standard version)
un  nginx-light    <none>           <none>       (no description available)
root@again4u:/opt# dpkg remove nginx-1.14.2


2. Purge the packages:

  apt purge nginx-common nginx-full


3. Testing the removal:

  dpkg -l nginx*
root@again4u:/opt# dpkg -l nginx*
dpkg-query: no packages found matching nginx*

Shall return "no packages found..."


4. Deactivate the firewall, temporarily.


5. Reinstall nginx.

  apt install -f nginx
  

6. If reinstallation fails returning the same previous issue, uninstall nginx again, repeating the steps above and reboot the server.

If using a remote server, use the provider's interface to reboot it.

Deactivate the firewall, temporarily, and install nginx again:

  apt install -f nginx



7. Test the installation.

  systemctl status nginx

If successful, return something like this:

● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2021-08-04 13:54:48 EDT; 22min ago
     Docs: man:nginx(8)
 Main PID: 723 (nginx)
    Tasks: 3 (limit: 4915)
   Memory: 16.3M
   CGroup: /system.slice/nginx.service
           ├─723 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
           ├─726 nginx: worker process
           └─727 nginx: worker process


8. Start the firewall.


>ENV

debian 10

eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...