How to create a new React Application

If this is your first React application that you are building please follow the steps below

  1. Install Node and NPM. Please note that your node needs to be later than or equal to version 8.10. Since I do development on windows and need multiple node versions I installed https://github.com/coreybutler/nvm-windows . This utility lets me switch between varioud node versions on windows but you might not need this.
  2. Go to command line and run the following commands
npx create-react-app my-app
cd my-app
npm start

3. For those in doubt, npx is just a package manager which is supported from npm version 5.2+ onwards.

4. It will launch the application on your browser with URL http://localhost:3000/

5. Once you are done coding and need to deploy to production, run the following command.

npm run build

This will create production ready build for your application.

How to migrate from Oracle Java 8 to OpenJDK 11

Recently I finished migrating my application from Java 8 to OpenJDK 11. Here are few steps where we got stuck and the solutions that helped us.

Problem No 1 – JVM argument UseFastAccessorMethods  argument is not supported anymore in OpenJDK 11

Solution – Removed this JVM argument from batch scripts/shell scripts.

Further Readinghttps://bugs.java.com/bugdatabase/view_bug.do?bug_id=6385687

Problem No 2 – com.myApp.configuration.Module class conflicts with java.lang.Module class introduced in OpenJDK 11. Basically I had a class called Module which was now conflicting with java.lang.Module class introduced in OpenJDK 11.

Solution – Explicitly import com.myApp.configuration.Module class in required classes.

Further Readinghttps://docs.oracle.com/javase/9/docs/api/java/lang/class-use/Module.html

Problem No 3 – Compile/Runtime issues with commons-lang:commons-lang:2.1@jar

Solution – Upgraded to commons-lang:commons-lang:2.6@jar

Problem No 4

Jersey Rest APIs were not working (Runtime issue) with following libraries
‘org.glassfish.jersey.core:jersey-client:2.16@jar’
‘org.glassfish.jersey.core:jersey-common:2.16@jar’
‘org.glassfish.jersey.containers:jersey-container-servlet:2.16@jar’
‘org.glassfish.jersey.containers:jersey-container-servlet-core:2.16@jar’
‘org.glassfish.jersey.bundles.repackaged:jersey-guava:2.16@jar’
‘org.glassfish.jersey.media:jersey-media-jaxb:2.16@jar’
‘org.glassfish.jersey.core:jersey-server:2.16@jar’

Solution

Migrated these libraries to below libraries. Post this upgrade Jersey APIs were working fine ‘org.glassfish.jersey:jersey-bom:2.27’ 
‘org.glassfish.jersey.containers:jersey-container-servlet:2.27’
‘org.glassfish.jersey.inject:jersey-hk2:2.27’
‘org.glassfish.jersey.core:jersey-client:2.27’

‘org.glassfish.jersey:jersey-bom:2.27’ 
‘org.glassfish.jersey.containers:jersey-container-servlet:2.27’
‘org.glassfish.jersey.inject:jersey-hk2:2.27’
‘org.glassfish.jersey.core:jersey-client:2.27’

Problem No 5 – Library com.sun.xml.messaging.saaj missing in OpenJDK 11 which was part of Oracle Java 8. This is used in SOAP

Solution – Explicity import library ‘com.sun.xml.messaging.saaj:saaj-impl:1.3.20’

Further Readinghttps://javaee.github.io/metro-saaj/

Problem No 6 – Library com.sun.org.apache.xml.internal:resolver missing in OpenJDK 11 which was part of Oracle Java 8.

Solution – Explicitly import library compile group: ‘com.sun.org.apache.xml.internal’, name: ‘resolver’, version: ‘20050927’

Further Readinghttps://stackoverflow.com/questions/3889308/xml-catalog-resolving-resolver-jar-vs-com-sun-org-apache-xml-internal-resolver

Problem No 7 – Gradle compilation fails since JAVA_HOME was pointing to older Oracle Java 8 JDK

Solution – Changed JAVA_HOME environment variable to point to new OpenJDK 11

Problem No 8 – Tomcat was not starting since JRE_HOME was pointing to older Oracle Java 8 JDK

Solution – There is no JRE in OpenJDK 11. So we have to remove JRE_HOME variable

I encountered few more problems, will list the solutions soon on this page for those as well. I have tested my application on Windows 10 and CentOS 6 and 7.