Thursday, April 19, 2018

Integration spring-boot-security-dataJPA-oauth2-google-angular5

I share basic example, how to integrate Spring-boot-security-dataJPA-oauth2-googe with angular 5

Technologies used:

1. Spring Boot 2.0.1.RELEASE
2. Oracle (Ojdbc) 11.2.0.4
3. Tomcat Embed
4. Maven 4
5. Java 8
6. Angular CLI: 1.7.4
7. Node: 8.9.4
8. Eclipse: Oxygen.1.a Release (4.7.1a)


Steps:

1. Create your project in google for get your clientId and clientSecret, we need both for use OAuth2 with google.  go to 

https://console.developers.google.com

And create your project and credentials for OAuth2

check images.








2. In Backend App -> file application.yml set your Client ID and Client secret

Check image.




3. Import projects in eclipse then your import backend project: 

Right click on backend project -Show in -> Terminal.

build and run the SpringBoot server again with commands:

– Build: mvn clean install

– Run:  mvn spring-boot:run


4. if you want to know, how to integrate step to step spring boot with angular 5
check my blog: http://jarmx.blogspot.com/2018/04/integration-springboot-springdatajpa.html


5. if you to do the steps succes then. -request url: http://localhost:8080/google/login

check images:















Code on GitHub: 

Backend: https://github.com/HenryXiloj/spring-boot-security-dataJPA-oauth2-google
Front-end: https://github.com/HenryXiloj/angular5-front-end


References: https://dzone.com/articles/build-a-secure-spa-with-spring-boot-and-oauth


Wednesday, April 18, 2018

ORA-01034: ORACLE not available, ORA-27101: shared memory realm does not exist

I share solution the next error:

ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Process ID: 0
Session ID: 0 Serial number: 0

Steps:

Step 1:

Connect user from linux or unix.

*oracle is my user.

sudo su - oracle

* set your password.
* if you don't remmeber your password change password with the next command.

sudo passwd oracle

Step 2:

Use the lsnrctl command to start service

lsnrctl start

Step 3:

Start database:

dbstart

* Try connect your database.
* if you have the next error: try with the step 4.






Step 4:

* Try to login sysdba user:

sqlplus '/ as sysdba'


Step 5:

* Type startup command:

startup.

* Try connect your database

Check image below with commands:




































Great :).


References: https://www.cyberciti.biz/faq/how-do-i-start-oracle-service-in-unix/




Wednesday, April 11, 2018

Create maven archetype from existing project

I share basic example, how to create maven archetype from existing project.

Steps:

Step 1.

-cd your_project

run next command: mvn archetype:create-from-project





































It then generates the directory tree of the archetype in the target/generated-sources/archetype directory.
Step 2. Move directory.

- cd target/generated-sources/archetype/

- And run command mvn install






























Step 3. Move to a fresh directory and use your archetype.

- mkdir /tmp/archetype

- cd /tmp/archetype

- mvn archetype:generate -DarchetypeCatalog=local































References: https://maven.apache.org/archetype/maven-archetype-plugin/advanced-usage.html






Monday, April 9, 2018

Integration-SpringBoot-SpringDataJPA-Angular5

I share basic example, how to integrate Spring Boot - SpringDataJPA-Angular5


Technologies used:


1. Spring Boot 2.0.1.RELEASE
2. Oracle (Ojdbc) 11.2.0.4
3. Tomcat Embed
4. Maven 4
5. Java 8
6. Angular CLI: 1.7.4
7. Node: 8.9.4
8. Eclipse: Oxygen.1.a Release (4.7.1a)

Steps:

1. Create project angular

  



if you want to test and start application,  you have to run the next command in your console.

















Open your browser: http://localhost:4200/

2. Import your project angular to eclipse:

Import -> General -> Projects from Folder or Archieve -> Directory, press finish


























3. To clean the sourcecode in STS, we need to remove node_modules:
– Right click on angular5-client project, choose Properties, then choose:  Resource --> Resource Filter.
– Press Add Filter, choose Filter Type, press OK -> Apply and Close





























4. Create a file proxy.conf.json


{

"/ws": {

"target": "http://localhost:8080",

"secure": false

}
}



5. Edit package.json file for “start” script:

Edit next line: "start": "ng serve --proxy-config proxy.conf.json",













6. Right click on angular5-client project
  -Show in -> Terminal.

 Build angular5 client with command  ng build --env=prod










Result is a dist folder:






















7. References folder dist from pom.xml Eclipse project.






                         





















8. build and run the SpringBoot server again with commands:

– Build: mvn clean install






















– Run:  mvn spring-boot:run




































--request url from test: http://localhost:8080/









--





request url web service rest: http://localhost:8080/ws/read












Code on GitHub: 

Backend: https://github.com/HenryXiloj/SpringBoot-SprinDataJPA
Front-end: https://github.com/HenryXiloj/angular5-client









References: http://javasampleapproach.com/java-integration/integrate-angular-4-springboot-web-app-springtoolsuite


Multiple Data Sources in Spring Boot 3 with Java 21

  In this blog post, we'll explore the configuration and setup for a Spring Boot 3 application with Java 21 that uses multiple data sour...