Categories
Technical

How to configure SSL on your application

If you have not already configured your Tomcat instance then you can follow the instructions here.

How to setup SSL on Tomcat in less than 5 minutes

By following the above article, you will be fulfilling all the prerequisites and you will be able to proceed to the next step. To enforce your application to work with SSL, the following is the additional step that needs to be done. You will need to add the following code snippet into your application’s web.xml file.

<security-constraint>
    <web-resource-collection>
        <web-resource-name>YOUR SECURED WEBAPP NAME</web-resource-name>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
 </security-constraint>

Observe the following things from this setting that you’ll be putting in your web.xml file:

  1. The url-pattern tag above is set to /* so that any page or resource of your web application needs to be accessed via HTTPS only.
  2. The transport-guarantee tag above is set to CONFIDENTIAL, to ensure that your application is accessible via HTTPS only.
  3. For these changes to take effect, save the web.xml file, and restart your TOMCAT / TomEE service.
  4. In case you want to turn off the SSL settings, you don’t really have to remove this whole setting but mark the transport-guarantee tag to NONE instead of CONFIDENTIAL and restart your TOMCAT / TomEE instance.
Categories
Technical

How to setup SSL on Tomcat in less than 5 Minutes

This article is going to show you how you can configure SSL on your Tomcat / TomEE instance in less than 5minutes, I challenge you that!

For this, the basic pre-requisites are the following (these are obvious, but making a point that this article is self-explanatory to all kinds):

  • Java SDK (JDK 11.0.2 used for this article)
  • Tomcat / TomEE (Tomcat 9 used for this article)

There are basically two important steps to make this configuration work, which is as follows:

  • To create a Keystore file using Java
  • To configure your Tomcat / TomEE instance to use this Keystore file that was generated in the earlier step.

Let us now look at these steps which are outlined above

Create a Keystore file using Java:

For this, open a command prompt for Windows or a terminal for your Linux / macOS:

cd %JAVA_HOME%/bin -> For Windows

cd $JAVA_HOME/bin -> For Linux / macOS

By the above step, you would change directory to JAVA_HOME/bin where you will find a handy tool key tool that takes the responsibility of creating a Keystore file. On that prompt/terminal, key in the following command:

keytool –genkey –alias tomcat –keyalg RSA

After the execution of the above command, you would be posed with the following questions where you can provide answers accordingly:

You would first be prompted for a password, provide it and make sure that you remember or make a note of it correctly.

For the First and Last name, it should be the name of the system where this certificate must be deployed. Eg: HOSTNAME of your TOMCAT instance.

The rest of the questions are straight forward, examples of those are provided in the screenshot below.

At the end of this questionnaire comes a confirmation, for which you need to explicitly say Y / YES after reviewing the details that you’ve provided here.

Once the above command is executed, this would create a .keystore file under the following folder locations based on your choice of OS where you would have attempted this.

WINDOWS -> C:\Users\<USER_NAME>\.keystore

LINUX -> /home/<USER_NAME>/.keystore

MacOS -> /Users/<USER_NAME>/.keystore

Configure Tomcat with a generated Keystore file

Open your Tomcat / TomEE installation directory for which you want to configure SSL, open the conf folder -> server.xml file in Administrator mode (so that the modifications that you make can be saved on exit).

Search for the following XML element:

Uncomment and make the changes to match the following

  1. Make a note of the changes made, here we should add these parameters without fail – Keystore file, keystorePass, and the protocol.

This brings us to the end of the necessary configurations that are required to setup SSL for your TOMCAT / TomEE instances. Restart your TOMCAT / TomEE instances for the changes to take effect.

You could now try and test accessing the following URLs to confirm that the TOMCAT / TomEE instances are available on both HTTP and HTTPS. These should both land to your TOMCAT / TomEE home page respectively.

  1. http://localhost (Considering that you are running your TOMCAT / TomEE instances on the default port 80).
  2. http://localhost:8443

How do I start Tomcat in https mode?

What is SSL in Tomcat

Does Tomcat Use OpenSSL?
How do I configure SSL?

Tomcat 8.5 SSL configuration

How to install SSL certificate in apache tomcat Linux

Two-way-SSL-on-tomcat

Tomcat self-signed certificate

Setting up SSL on tomcat in 5 minutes

How to configure SSL in Tomcat 7

Categories
Technical

How to collect thread dump from Tomcat using JStack utility tool?

Java 1.6 onwards, “jstack.exe”, a utility tool comes along with the JDK installation and can be found in the folder %JAVA_HOME%\bin. If you aren’t able to find it along with your JDK installation, even then you should be able to download this utility without any issues at all. This utility just requires the PID of the Java process that you are interested to collect the thread dump. In this article, you will be able to understand and know how to collect thread dump from Tomcat using Jstack utility tool.

Just FYI, the utility that comes along with the JDK installation isn’t complete and lacks the following features, if you are trying to figure out why these aren’t working on your Production systems.

The process of collecting thread dumps using Jstack utility tool:
  • Option “–m”: This option is used to generate the thread dump in MIXED MODE, which means that you will be able to print native stack traces in addition to the Java stack.
  • Option “-F”: This option is used to generate the thread dump FORCIBLY.

If you are on a UNIX based operating system then you will be able to find the PID of the java process using the following command:

ps –ef | grep java

(OR)

$JAVA_HOME/bin/jps –v

If you are on a Windows-based operating system then you have to follow the steps below:

  • Press Ctrl + Alt + Del and click on “Task Manager” button
  • Click on the “Processes” tab
  • From the menu, click on “View” -> “Select Columns” and check the PID (Process Identifier) check box as well
  • Now you can see the PID of your “java.exe” in the “Processes” tab.

Fire a command prompt window (CMD) and traverse to %JAVA_HOME%\bin directory, and then run the following command with the PID that you’ve obtained in the above step.

Jstack –l %PID% > ThreadDump.log

Since the process is not responding, you could try generating the thread dump using –F option.

By issuing the command above– you will be able to find your thread dump on %JAVA_HOME%\bin with the name as given on the command prompt.

Categories
Technical

5 Best Programming Languages to Learn in 2018

I see this is one of the hottest topics among the budding software engineers across the globe. To quench the thirst of many who will ask the same. This should be a convincing article to go through.

So here are the 5 Best Programming Languages to learn in 2018

To start with, Python:

Python is an awesome object-oriented language that closely resembles the English language.  This is one of the reasons why it is classified as one of the best languages for beginners and seasoned professionals. It is a general purpose programming language and emphasizes on code readability, developer productivity.  It is a well-designed language. The syntax is simple but yet very effective.

To continue with, Javascript:

Javascript is mainly a client-side, dynamic scripting language used in front-end development and is compatible with all the browsers available today.  Javascript in conjunction with jQuery makes it easy to integrate different plugins to your code that can save you lot of time. It is quicker to add a new feature into your code with this duo. There are a lot of variants, flavors of javascript that are available – you will be spoilt for choice.

To carry the momentum, Java:

Java has by far become one of the most successful, compelling languages over that last 15 odd years. It won’t be an exaggeration but no list (5 Best Programming Languages to learn in 2017) will be complete without Java. I am personally in love with it, there is remotely anything impossible that can be achieved with Java. It is used in over 15 BILLION (let me repeat, 15 BILLION) devices and over 10 MILLION developers using it worldwide. That in itself speaks loads and loads about this technology. The later versions of Java have provided ways and means to write clean code with Java Streams and Lambdas.

To understand the data, SQL:

Structured Query Language (SQL) is used to communicate with and to manipulate databases. It is one of the most common skills that would be required of any developer. It started with very few variants earlier, but with NoSQL in the picture, it has grown leaps and bounds. Lately, Microsoft has released their SQL Server 2016 which proved to be surprisingly popular, providing integration with R (popular data analysis programming language) and a Linux version.

To be unique and in demand, C:

If you are a seasoned professional but don’t know least “C" well enough to read/understand it, you will probably feel a sense of shame about it. Java / C# will help you understand the object oriented way, but pointer arithmatic and manual `memory management` are the key things that one should know. C++ is a good language but never can take the place of C.

You need lower memory consumption and high performance but still, don’t want to learn/write,C then Go or Rust should help you do that. It is a definite recommendation to have either of these skills to meet the demand.

Summing it up:

The need of the day is for a FULL STACK developer. For this I’d recommend learning the basics of HTML, CSS, Bootstrap and once you advance in this pick any two backend languages (preferably Java, Python) to cement your place as a FULL Stack developer. Having said that, SQL is still a requirement but this can take a back seat for a while but not always. There is this myth in the programming world that if you know more languages, you’ll be successful. This is not entirely true and refrains from doing something like that. Pick a skill set that you feel comfortable with and master those for your own good. Playing around with the latest technologies is suggested but not at the cost of your core skills.

Now it’s over to you guys, we’ve taken our time to introduce the 5 Best Programming Languages to learn in 2018. Choose wisely, take our advice or not, be fair with your learning always.

Happy Learning, guys!

Categories
Technical

Gang of Four (GoF) Java Design Patterns

What is a Design Pattern?

Basically, a design pattern represents the best practices used by the most experienced object-oriented software developers, as these are the solutions to the most general problems that any Software developer might have faced during the process of software development.

A group of 4 authors named Erich Gamma, John Vlissides, Ralph Johnson and Richard Helm published a book titled “Design Patterns – Elements of Reusable Objected Oriented Software” in the year 1994. This has been the initiation of the concept of Design patterns in the Software development.

These authors are commonly known to be as the infamous “Gang of Four” then onwards and hence the name – “Gang of Four” Java Design Patterns. The two important points that most of the design patterns talk about are:

  • Program to an interface but not to an implementation
  • Favor Object Composition as against Inheritance

With the discussion above giving us the background of the Design Patterns as a whole and the most commonly used phrase “Gang of Four” demystified, we will go to the next section of the topic – the types of design patterns available.

 Types of Design Patterns:

As per the references given in the book Design Patterns – Elements of Reusable Object-Oriented Software, there are 23 design patterns that can be broadly divided into 3 categories.

Creational Pattern:

These kinds of patterns generally provide ways and means of creating Objects in the best possible way, instead of using the traditional new operator. These patterns give the flexibility in making the decision to create what objects based on the given use case.

Structural Pattern:

These design patterns generally talk about the Class and the Object compositions. Inheritance as a concept is used to compose the interfaces and also to define ways to compose objects to obtain newer functionalities.

Behavioral Pattern:

These design patterns are generally used for identifying the best possible way of communication within the objects.

There is also relatively a newer set of patterns discussed as the J2EE patterns identified by the Sun Java Center. These are specifically concerned with the Presentation layer.

23 GoF Design Patterns, their definitions:

The points above should provide you the basic knowledge about the concept of Design patterns and also the kinds of patterns that are available for your consumption directly. Now with these details, we shall directly dive into the details and specifications of these design patterns individually.

1. Mediator design pattern:

Use Mediator pattern to “Define an object that encapsulates how a set of objects interact. Mediator design pattern promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently.”

2. Adapter design pattern:

Adapter design pattern lets you “Convert the interface of a class into another interface the client expects. Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces.”

3. Proxy design pattern:

Use Proxy design pattern to “Provide a surrogate or placeholder for another object to control access to it. Ex: Usage of Proxy design pattern can be seen in RMI (Remote Method Invocation) APIs.

4. Observer design pattern:

Observer design pattern should “Define a one-to-many dependency between objects in that when one object changes state, all its dependents are notified and updated automatically.”

5. Strategy design pattern:

Strategy design pattern should “Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.”

6. Decorator design pattern:

Decorator design pattern should “Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to sub-classing for extending functionality.”

7. Factory design pattern:

Factory design pattern should “Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory method lets a class defer instantiation to subclasses.”

8. Chain of Responsibility design pattern:

Chain of Responsibility design pattern should “Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along with the chain until an object handles it.”

9. Singleton design pattern:

Singleton design pattern must “Ensure a class only has one instance, and provide a global point of access to it.”

10. Flyweight design pattern:

Flyweight design pattern should “Use sharing to support large numbers of fine-grained objects efficiently. A Flyweight is a shared object that can be used in multiple contexts simultaneously. The Flyweight acts as an independent object in each context – it’s indistinguishable from an instance of the object that’s not shared.”

11. Façade design pattern:

Façade design pattern should “Provide a unified interface to a set of interfaces in a system. Façade defines a higher-level interface that makes the subsystem easier to use.”

12. Template Method design pattern:

Template Method design pattern will “Define the skeleton of an algorithm in an operation, differing some steps to subclasses. Template method lets subclasses redefine certain steps of an algorithm without changing the algorithm’s structure.”

13. Builder design pattern:

Builder design pattern lets you “Separate the construction of a complex object from its representation so that the same construction process can create different representations.”

14. Iterator design pattern:

You can use the Iterator design pattern to “Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.”

15. Composite design pattern:

Use Composite design pattern to “Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.”

16. State design pattern:

State design pattern will “Allow an object to alter its behavior when its internal state is changed. The object will appear to change its class.”

17. Command design pattern:

Use Command design pattern to “Encapsulate a request as an object, thereby letting you parameterize clients without different request, queue or log requests, and support undoable operations.”

18. Abstract Factory design pattern:

Abstract Factory design pattern should “Provide an interface for creating families of related or dependent objects without specifying their concrete classes.”

19. Prototype design pattern:

Prototype design pattern should “Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.”

20. Interpreter design pattern:

Interpreter design pattern should “Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language.”

21. Memento design pattern:

Memento design pattern is designed to “Without violating encapsulation, capture and externalize an object’s internal state so that the object can be restored to this state later.”

22. Visitor design pattern:

Visitor design pattern should “Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates.”

23. Bridge design pattern:

Bridge design pattern should “Decouple an abstraction from its implementation so that the two can vary independently.”

Source: “Design Patterns – Elements of Reusable Objected Oriented Software. For more information on these topics, we would suggest going through the above book to get familiarized with the topics.

Categories
Technical

How to edit more than 200 Rows in SQL Server Management 2014- Quick Fix

In this article, we will go through the process of changing modifying the number of rows while displaying for a particular table. As a standard within SQL Server Management Studio 2014, for a particular table user will be able to edit only Top 200 Rows.

The complete SQL Bootcamp will help you master your SQL skills very easily.

But one can change this setting and we will go through the process of modifying in this article.

Grab your free  Java Coding Interview questions pocket book

Step 1:
  • Open up SQL server management studio 2014
  • Go into the Database and specific table where you want to modify the value.
  • Right click on the table, it will show you the standard option of edit top 200 rows
Step 2: 
  • Go into Tools (it is available in header section of SSMS 2014)
  • Sub menu will appear
  • Click on “Options” to continue

Step 3:
  • More options are displayed on the screen.
  • One has to click on “SQL Server Object Explorer”
  • On right-hand side look for Table and View options
  • Enter desired value that you want to Edit for a table and click on Save.

For this article, we have keyed in 2000, see below screen shot

Step 4:

Go back to the table name and right click and see the modified value.

Hope this helps, please comment below if this article has helped you.

Categories
Technical

How to add a JAR as a shared resource for more than one application on Tomcat?

This article will help you understand

How to add a JAR as a shared resource for more than one application on Tomcat

There is a huge change in the architecture of Tomcat itself during the evolution of Tomcat 6.0 / 7.0 releases after the Tomcat 5.5 and hence a change in the folder structure as well. This change has more to do with the default configuration of the class loaders from Tomcat 5.5 to Tomcat 6.0/7.0.

The Tomcat 5.5 instance used to have folders named “shared”, “common” and “server” which are now condensed to just one folder called “lib” starting from Tomcat 6.0. The main purpose of these 3 folders was to hold jars and class files that were made available to the “shared”, “common” and the “server” class loaders. Since the aforementioned folders are all condensed to a single folder, “lib” folder dictates the jars / class files available for all the 3 class loaders (namely shared, common and server).

Depending on the situations that we work on, it is an advantage to have a separate “shared” folder under %CATALINA_HOME% (as previously was available in Tomcat 5.5. If not download Tomcat 5.5).

Steps:
  • Create the following folders in your CATALINA_HOME directory
    • shared
      • classes
      • lib
  • Modify the conf/catalina.properties to dictate Tomcat 6.0/7.0 to use the shared directories instead of the lib directory which is by default. Take a backup of your configuration file, as ALWAYS!
    • Locate shared.loader= property and change it to shared.loader=”shared/classes,shared/lib/*.jar”
  • Save conf/catalina.properties and then start the Tomcat server.

With these steps, the shared class-loader should be configured to load classes from the shared folder.

I hope the article has helped you.

Read more on:

How to collect thread dump from Tomcat using Jstack utility tool

5 Best programming language to learn in 2018

If you thing any information is missing, please do comment below so that the rest of the viewers can benefit out of it.

 

Categories
Technical

Best Practices while Using Tomcat

Best Practices while Using Tomcat

 

Below article will help you understand the  Top best practices that are in use while utilizing Tomcat

Best Practice 1:

  • Installation of Tomcat is pretty straight-forward but a point to note is to use a suitable path (the %CATALINA_HOME% that we set on the environment variables) which do not contain white spaces.
  • Reason to honor this practice is that it might cause issues when you try starting Tomcat as a Web Server.

Best Practice 2:

  • Tomcat should never be run as a PRIVILEGED user on any operating system (root on UNIX/LINUX, or Local System on Windows), it should be run as a low privilege user ONLY.
  • Ideally, it should be run as a user created only for the purpose of running only one application.

Best Practice 3:

  • It is a considered a good practice not to load any libraries/packages other than the standard ones that are distributed along with Tomcat using the Commons loader.
  •  Can cause loads of compatibility issues on a longer run.
  • If there is a need that you need to share a single jar/library amongst several other applications, it is a good idea to create a “shared/lib” or a “shared/classes” directory and configure under the SHARED Loader in the properties.

Best Practice 4:

  • Place your JDBC drivers as a shared library.
  • These should be directly placed under the %CATALINA_HOME%/lib folder only.

Best Practice 5:

  • If you’re finding yourself configuring CLASSPATH rather frequently, then we suggest you rethink your development process.
  • It is suggested to use Tomcat, which is recommended by Apache.

I hope this article has helped you in terms of refreshing your knowledge.  Please subscribe to our newsletter to stay up to date with the technology trends.

Read more on:

http://www.aneetin.com/how-to-collect-thread-dump-tomcat-using-jstack-utility-tool/

 

Categories
Technical

How to resolve frequent crashes on Eclipse Luna?

Have you ever wondered why your eclipse IDE started behaving cranky and crashes very frequently?

If you are one among many individuals having following questions , we have appropriate solution for you 🙂

  • Eclipse Luna hangs frequently?
  • Eclipse frequently hangs with High CPU usage
  • Eclipse freezes every few minutes
  • Eclipse hangs at startup showing only the splash screen

Then the following tips might help you resolve your issue with the IDE. Let’s take a look at what measures can be taken in an attempt to resolve this issue.

APPROACH-1:

If you’ve recently added any plugin to your eclipse IDE, it is better to run your IDE with –clean argument, as this re-scans the installed plugins on your IDE and rebuilds the cache in ECLIPSE_HOME\configuration folder. It is a better idea to startup your eclipse for the first time after the successful installation of any plugin to clear this and at the same time can also help you resolve any crashes that might happen in future as well (due to the new plugin that you added to eclipse).

The approach here is to add the following parameters at the beginning of your eclipse.ini file and open your eclipse only once with these arguments.

clean
  -clearPersistedState

After the first run of your eclipse with these arguments, this can either be chucked off or be left alone (should you choose to leave it as is, you might face a delayed startup time of your IDE)

APPROACH-2:

If it isn’t any new plugins that you’ve added to your IDE, then it could be something else altogether. In such cases, the following arguments have come handy in most of the situations for me (personally). Add the following parameters and it should fix your IDE issue. Along with the arguments that I’ve added to my eclipse.ini file, I will also share the issue that I faced just so that you can refer to – for your case.

Add the following to your eclipse.ini file:

-vmargs
  -Dosgi.requiredJavaVersion=1.8
  -XX:+UseG1GC
  -XX:+UseStringDeduplication
  -Dosgi.requiredJavaVersion=1.8
  -Xms40m
  -Xmx512m
  -XX:PermSize=64M 
  -XX:MaxPermSize=128M
  -XX:+UseCompressedOops

If it’s Windows 7 the OS that you’re running your IDE on, then the above setting will work just fine. The error details that I promised to share along with the solution follows:

Error screenshot:

Eclipse.ini configuration that I had when I had the issue is as follows:

-clean
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20150204-1316
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vm
C:\Program Files\Java\jdk1.8.0_111\bin\javaw.exe
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms40m
-Xmx512m
-XX:+UseCompressedOops

Error stack-trace:
org.eclipse.m2e.logback.configuration: The org.eclipse.m2e.logback.configuration bundle was activated before the state location was initialized.  Will retry after the state location is initialized.
org.eclipse.m2e.logback.configuration: Logback config file: E:\ProjectWorkspace\.metadata\.plugins\org.eclipse.m2e.logback.configuration\logback.1.5.1.20150109-1820.xml
org.eclipse.m2e.logback.configuration: Initializing logback
Exception in thread "org.eclipse.jdt.internal.ui.text.JavaReconciler" java.lang.OutOfMemoryError: GC overhead limit exceeded
        at org.eclipse.core.runtime.Path.append(Path.java:273)
        at org.eclipse.core.internal.dtree.DeltaDataTree.getChildren(DeltaDataTree.java:540)
        at org.eclipse.core.internal.watson.ElementTree.getChildIDs(ElementTree.java:332)
        at org.eclipse.core.internal.watson.ElementTree.getChildren(ElementTree.java:348)
        at org.eclipse.core.internal.resources.Container.getChildren(Container.java:142)
        at org.eclipse.core.internal.resources.Container.members(Container.java:270)
        at org.eclipse.core.internal.resources.Container.members(Container.java:249)
        at org.eclipse.jdt.internal.core.PackageFragmentRoot.computeFolderChildren(PackageFragmentRoot.java:224)
        at org.eclipse.jdt.internal.core.PackageFragmentRoot.computeFolderChildren(PackageFragmentRoot.java:250)
        at org.eclipse.jdt.internal.core.PackageFragmentRoot.computeFolderChildren(PackageFragmentRoot.java:250)
        at org.eclipse.jdt.internal.core.PackageFragmentRoot.computeFolderChildren(PackageFragmentRoot.java:250)
        at org.eclipse.jdt.internal.core.PackageFragmentRoot.computeFolderChildren(PackageFragmentRoot.java:250)
        at org.eclipse.jdt.internal.core.PackageFragmentRoot.computeFolderChildren(PackageFragmentRoot.java:250)
        at org.eclipse.jdt.internal.core.PackageFragmentRoot.computeFolderChildren(PackageFragmentRoot.java:250)
        at org.eclipse.jdt.internal.core.PackageFragmentRoot.computeFolderChildren(PackageFragmentRoot.java:250)
        at org.eclipse.jdt.internal.core.PackageFragmentRoot.computeChildren(PackageFragmentRoot.java:198)
        at org.eclipse.jdt.internal.core.JavaProjectElementInfo.initializePackageNames(JavaProjectElementInfo.java:253)
        at org.eclipse.jdt.internal.core.JavaProjectElementInfo.getProjectCache(JavaProjectElementInfo.java:226)
        at org.eclipse.jdt.internal.core.JavaProjectElementInfo.newNameLookup(JavaProjectElementInfo.java:291)
        at org.eclipse.jdt.internal.core.JavaProject.newNameLookup(JavaProject.java:2329)
        at org.eclipse.jdt.internal.core.SearchableEnvironment.<init>(SearchableEnvironment.java:59)
        at org.eclipse.jdt.internal.core.SearchableEnvironment.<init>(SearchableEnvironment.java:66)
        at org.eclipse.jdt.internal.core.CancelableNameEnvironment.<init>(CancelableNameEnvironment.java:26)
        at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:178)
        at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:271)
        at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.makeConsistent(ReconcileWorkingCopyOperation.java:191)
        at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:90)
        at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:729)
        at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:789)
        at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1247)
        at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:126)
        at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.access$0(JavaReconcilingStrategy.java:108)
org.eclipse.swt.SWTException: Widget is disposed
        at org.eclipse.swt.SWT.error(SWT.java:4441)
        at org.eclipse.swt.SWT.error(SWT.java:4356)
        at org.eclipse.swt.SWT.error(SWT.java:4327)
        at org.eclipse.swt.widgets.Widget.error(Widget.java:476)
        at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:348)
        at org.eclipse.swt.widgets.Shell.isVisible(Shell.java:1170)
        at org.eclipse.ui.internal.progress.ProgressManagerUtil.getDefaultParent(ProgressManagerUtil.java:387)
        at org.eclipse.ui.internal.statushandlers.InternalDialog.<init>(InternalDialog.java:154)
        at org.eclipse.ui.internal.statushandlers.WorkbenchStatusDialogManagerImpl.doAddStatusAdapter(WorkbenchStatusDialogManagerImpl.java:260)
        at org.eclipse.ui.internal.statushandlers.WorkbenchStatusDialogManagerImpl.addStatusAdapter(WorkbenchStatusDialogManagerImpl.java:198)
        at org.eclipse.ui.statushandlers.WorkbenchStatusDialogManager.addStatusAdapter(WorkbenchStatusDialogManager.java:158)
        at org.eclipse.ui.statushandlers.WorkbenchErrorHandler.showStatusAdapter(WorkbenchErrorHandler.java:105)
        at org.eclipse.ui.statushandlers.WorkbenchErrorHandler.access$0(WorkbenchErrorHandler.java:98)
        at org.eclipse.ui.statushandlers.WorkbenchErrorHandler$1.run(WorkbenchErrorHandler.java:65)
        at org.eclipse.ui.internal.UILockListener.doPendingWork(UILockListener.java:167)
        at org.eclipse.ui.internal.UISynchronizer$3.run(UISynchronizer.java:165)
        at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
        at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
        at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4147)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3764)
        at org.eclipse.swt.widgets.Display.release(Display.java:3817)
        at org.eclipse.swt.graphics.Device.dispose(Device.java:295)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
        at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
org.eclipse.swt.SWTException: Widget is disposed
        at org.eclipse.swt.SWT.error(SWT.java:4441)
        at org.eclipse.swt.SWT.error(SWT.java:4356)
        at org.eclipse.swt.SWT.error(SWT.java:4327)
        at org.eclipse.swt.widgets.Widget.error(Widget.java:476)
        at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:348)
        at org.eclipse.swt.widgets.Shell.isVisible(Shell.java:1170)
        at org.eclipse.ui.internal.progress.ProgressManagerUtil.getDefaultParent(ProgressManagerUtil.java:387)
        at org.eclipse.ui.internal.statushandlers.InternalDialog.<init>(InternalDialog.java:154)
        at org.eclipse.ui.internal.statushandlers.WorkbenchStatusDialogManagerImpl.doAddStatusAdapter(WorkbenchStatusDialogManagerImpl.java:260)
        at org.eclipse.ui.internal.statushandlers.WorkbenchStatusDialogManagerImpl.addStatusAdapter(WorkbenchStatusDialogManagerImpl.java:198)
        at org.eclipse.ui.statushandlers.WorkbenchStatusDialogManager.addStatusAdapter(WorkbenchStatusDialogManager.java:158)
        at org.eclipse.ui.statushandlers.WorkbenchErrorHandler.showStatusAdapter(WorkbenchErrorHandler.java:105)
        at org.eclipse.ui.statushandlers.WorkbenchErrorHandler.access$0(WorkbenchErrorHandler.java:98)
        at org.eclipse.ui.statushandlers.WorkbenchErrorHandler$1.run(WorkbenchErrorHandler.java:65)
        at org.eclipse.ui.internal.UILockListener.doPendingWork(UILockListener.java:167)
        at org.eclipse.ui.internal.UISynchronizer$3.run(UISynchronizer.java:165)
        at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
        at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
        at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4147)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3764)
        at org.eclipse.swt.widgets.Display.release(Display.java:3817)
        at org.eclipse.swt.graphics.Device.dispose(Device.java:295)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
        at org.eclipse.equinox.launcher.Main.main(Main.java:1438)

 

Categories
Technical

How to install MAVEN on your system?

The following article will help you understand the use and step by step installation guide (Maven in 5 minutes)

To set-up MAVEN 3.3.9 on Windows 7 64-bit machine, you could follow the below steps. This should be a piece of cake, if you are doing it all right in the first go itself. To install you would firstly require the MAVEN’s zip file from here, the official MAVEN downloads page

https://maven.apache.org/download.cgi )

  • Once you are able to download MAVEN successfully, you need to set-up the following variables
    • JAVA_HOME
    • M2_HOME
    • MAVEN_HOME
  • To do that, right-click on My Computer –> Properties –> Advanced System Properties –> Environment Variables –> System Variables
  • Click New and then click on Add
  • Considering that you would’ve already set-up your JAVA_HOME environment variable, go ahead and set the following variables:

JAVA_HOME=”YOUR JAVA HOME PATH”

  • M2_HOME and MAVEN_HOME=”YOUR MAVEN HOME PATH”

This should be the folder location where you would’ve unzipped the Maven from the downloaded zip file

The official documentation refers to M2_HOME, but there are programs that refer to MAVEN from MAVEN_HOME environment variable. So to be on a safer side, it is recommended to set these two variables with the same path.

Edit the Path environment Variable and add %M2_HOME%\bin; at the end of the existing path

  • Apply and Close the System Properties
  • Open a new command prompt and type
    • mvn –version

Following will be the message to confirm that MAVEN is successfully installed on your local system: