Friday, December 7, 2018

ERROR 1698 (28000): Access denied for user 'root'@'localhost'

I share solution the next error: ERROR 1698 (28000): Access denied for user 'root'@'localhost'

1. When you create new install mysql use 'sudo' on ubuntu.

2. First connect you db from command line.


sudo mysql -u root

3.



SELECT User, Host, plugin from mysql.user;

if you check User 'root' have 'auth_sockect' update to 'mysql_native_password'

4. in your case User='root'

  

5. FLUSH PRIVILEGES;
6. exit;

Try again.


References:

https://stackoverflow.com/questions/39281594/error-1698-28000-access-denied-for-user-rootlocalhost

Thursday, December 6, 2018

Example consuming Gmail API

I share basic example, how to integrate Gmail API with Gradle

Technologies used:

1. Spring Tools Suite
4. Gradle 3.4.1
5. Java 8
8. Eclipse: Oxygen.1.a Release (4.7.1a)

Code on GitHub: https://github.com/HenryXiloj/api-gmail

Steps:

1:

Create credentials:



- if you have account on devolepers google, just on click dialgog ENABLE THE GMAIL API and create new proyect or choose exist proyect. from there page I get code for this example, below left the link on references.

- Dowload the configuration file and check the name file is credentials.json

2:

-create folder
mkdir your_proyect
cd your_proyect
-- run next command
gradle init --type basic
mkdir -p src/main/java src/main/resource
--Copy the credentials.json into src/main/resource


3: run your proyect with next command.


gradle -q run
Check de images when you run the project:




Result get my labels from my gmail.




References:

https://developers.google.com/gmail/api/quickstart/java


Wednesday, December 5, 2018

Manually Install Java on Ubuntu 18.04.1

How to manually install Java on Ubuntu:

Check next steps:

Step 1:

Download JDK from Oracle page, Link

https://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase9-3934878.html

Step 2:

For example I'm install JDK 9, but others version is similar.

Choose  file --> .tar.gz

 


Step 3:

Extract file on next path.

/usr/lib/jvm

Step 4:

Run next comands:

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/YOUR_JDK/bin/java 0
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/YOUR_JDK/bin/javac 0
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/YOUR_JDK/bin/javaws 0

Step 5: Configuration, Choose your version java, javac and javaws.

sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws

Check the image, below:


















Friday, October 19, 2018

Adding trusted root certificates (CentOS Linux 7)

If you want add a trusted root certificate manually on CentOS.

Steps:

  1. Install the ca-certificates package: yum install ca-certificates
  2. Enable the dynamic CA configuration feature: update-ca-trust force-enable
  3. Add it as a new file to /etc/pki/ca-trust/source/anchors/: cp foo.crt /etc/pki/ca-trust/source/anchors/
  4. Use command: update-ca-trust extract



References:

https://manuals.gfi.com/en/kerio/connect/content/server-configuration/ssl-certificates/adding-trusted-root-certificates-to-the-server-1605.html

Thursday, October 18, 2018

Mensaje del Receptor Facturación electronica Costa Rica (Version 4.2 and 4.3)

Les comparto un ejemplo de como firmar XML y enviar JSON  mensaje receptor hacienda CR, los metodos genericos realizados tambien lo podrian utilizar para enviar Factura electronica, Tiquete Electronico, Notas de credito Etc. solo cambiando el schema que corresponda.


Tecnologias utilizadas.

1. Spring Boot 2.0.5.RELEASE
2. Maven 4
3. Java 8
4. Eclipse: Oxygen.1.a Release (4.7.1a)
5. Tomcat 8.5
6. Postman 6.4.4



Proyecto.




Insumos necesarios:

-Certificado .p12  + clave.
-clientId + usuario + contraseña --> para genera el token de seguridad.
-Url se encuentra en la pagina hacienda CR.

Cambiar datos en el proyecto.

1.  Importar proyecto Maven eclipse.
2.  messages.properties y FeMensajeReceptorRestController.java colocar datos correspondientes.
3. en el folder certificado colocar certificado.
4.  Run as -> Run on Server.
5. Probar con Postman.

Respuesta Hacienda.






Codigo en GitHub.


Referencias:

https://tribunet.hacienda.go.cr/FormatosYEstructurasXML.jsp
https://www.flecharoja.com/blog/2018-03/mensaje-receptor/
https://github.com/tim1991/facturaci-n-electronica-costarica-java






Tuesday, June 12, 2018

ERROR: ORA-28000: the account is locked (CentOS Linux 7)

I share solution the next error:

ERROR: 
ORA-28000: the account is locked

Steps:

Step 1:

Check if you have ORACLE_HOME in your environment, run next command.

echo $ORACLE_HOME

Result:



Step 2:

-If you have ORACLE_HOME  past step 3.

If you don't have ORACLE_HOME in your environment.

2.1 -> Find the directory oracle, where you were install.

2.2 -> export ORACLE_HOME=your_path_oracle 
Example: export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe

2.3 -> export PATH=your_path_oracle_bin:$PATH

Example: export PATH=/u01/app/oracle/product/11.2.0/xe/bin:$PATH

2.4 -> cd ~/
2.5 -> vim .bash_profile
2.6 ->  Add next lines in the end file.

ORACLE_SID=XE
export ORACLE_SID
ORACLE_HOME=your_path_oracle
#ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$PATH
export PATH

2.7 -> Save and exit. 
:wq

Check again if you have ORACLE_HOME in your environment.

Step 3: Run next command:

sqlplus sys/"YOUR_PASSWORD"@xe as sysdba


Step 4: Run next command:

alter user YOUR_USER account unlock;

Please check again your connection with your user unlock.


References:

http://techxploration.blogspot.com/2012/01/resolving-sp2-0750-you-may-need-to-set.html



Tuesday, May 29, 2018

Spring-Boot-Security-RestAPI-OAuth2 'JOT'

I Share Example, how to integrate Spring Boot, Security and RestAPI with OAuth2.

Technologies used:

1. Spring Boot 1.5.6.RELEASE
2. Maven 4
3. Java 8
4. Eclipse: Oxygen.1.a Release (4.7.1a)
5. Tomcat 8.5

Code on GitHub:

https://github.com/HenryXiloj/Spring-Boot-Security-RestAPI-OAuth2

Proyect.



Steps:

1. Import maven proyect in eclipse.

2. Right click on Spring-Boot-Security-RestAPI-OAuth2 project -Run as -> Run on Server.



3.  package: com.hxiloj.controller -> RestClient.java -> Right click on Class -> Run as -> Java Application






References: http://websystique.com/spring-security/secure-spring-rest-api-using-oauth2/














🚀 Spring Boot 3.5 → 4.0.3 Migration Summary

Import Changes, API Adjustments & Compatibility Results Migration summary from Spring Boot 3.5 → 4.0, including breaking changes, depend...