Skip to main content

Posts

Showing posts from April, 2018

javax.servlet.ServletException: Circular view path

Problem : javax.servlet.ServletException: Circular view path [error]: would dispatch back to the current handler URL [/latestOrder] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.) Solution : You've annotated the controller method as producing JSON or String or any other object . You probably want to annotate the method with @ResponseBody and change its return type to allow you to return an object representation of the JSON that you want to include in the response Preview: @RequestMapping (value= "latestOrders" ,method = RequestMethod. GET ) public @ResponseBody List<Order> listProducts(Model model) throws JMSException{ List<Order> list= new ArrayList(); list. add (staff1) return list; }

Run main thread before child thread.

As we all know in multi threading we cant guarantee the order of execution of threads .So in this example i will show you how to make sure one method calls after another. To implement this we are going to use JOIN() concept   of multi threading. Join()  : The join method allows one thread to wait for the completion of another.  MyThread1 t1 = new MyThread1(); if t1 is a Thread object whose thread is currently executing. t1.join(); causes the current thread to pause execution until t1   thread terminates. So to execute main thread before child thread it  should call join method on main thread and hence child thread has to wait until competing of main thread. Ruuner class:  package com. thread ; public class ThreadRun { //Main Thread public static void main (String args[]) { //Main thread reference MyThread1. mainThread = Thread. currentThread (); //Thread T-1 MyThread1 t1 = new MyThread1(); t1. setName...

Join on multiple threads in java

Join() : If a thread (name it T1) calls the join method on another Thread named T2, then T1 waits for T2 to complete its execution before it continues from that point. below is the example of thread join . Thread 1: package com. thread ; public class MyThread1 extends Thread { public void run () { //Thread T-2 MyThread2 t2 = new MyThread2(); t2. setName ( "t2" ); //T2 started t2. start (); try { //Thread T-1 wait till Thread T-2 get completed t2. join (); } catch (InterruptedException e1) { e1. printStackTrace (); } //Thread -1 logic for ( int i = 0 ; i < 5 ; i++) { System. out . println ( "child Thread -1 " + Thread. currentThread (). getName ()); try { Thread. sleep ( 1000 ); } catch (Exception e) { System. out . println (e); } } } } Thread 2: package com. thread ; public class MyThread2 extends Thread { public void run () { //Thread -2 logic ...

First Cucumber+java+maven project.

Prerequisite: following should be installed: Java Eclipse Maven maven-eclipse-plugin Cucumber-eclipse-plugin Step 1) Lets create a new project in eclipse by following steps: Click on new –> Other –> Maven –> Maven Project — > Next Step 2) Now click on Simple project and keep the default workspace location. Step 3) Provide details as Artifact id, Group id, name and description. and click on Finish. Step 4) This should create a basic maven project.  Create packages as shown in the below snapshot and create new files in the project. Feature file: Feature: Adding numbers with a Calculator In order to not learn math As someone who is bad at math I want to be able to add numbers using a Calculator Scenario: Add two positive numbers Given I have a Calculator When I add 1 and 1 Then the sum should be 2 Scenario: Add ...

java.lang.NoSuchMethodError: org.junit.runner.Description.createSuiteDescription(Ljava/lang/String;Ljava/io/Serializable;[Ljava/lang/annotation/Annotation;)Lorg/junit/runner/Description

Problem : java.lang.NoSuchMethodError: org.junit.runner.Description.createSuiteDescription(Ljava/lang/String;Ljava/io/Serializable;[Ljava/lang/annotation/Annotation;)Lorg/junit/runner/Description; at cucumber.runtime.junit.FeatureRunner.getDescription(FeatureRunner.java:43) at cucumber.api.junit.Cucumber.describeChild(Cucumber.java:90) at cucumber.api.junit.Cucumber.describeChild(Cucumber.java:38) at org.junit.runners.ParentRunner.getDescription(ParentRunner.java:226) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:85) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:70) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt....

Install cucumber plugin in eclipse

If you are trying to install Cucumber Eclipse Plugin from eclipse market place then it might not work for you as it is not the main cucumber plugin for running the test as BDD. Even this is not a mandatory plugin but it is quite handy ,and your feauture file look like plain text. Install Cucumber Eclipse Plugin It is easy to install Cucumber Eclipse Plugin, as it comes as a plugin for Eclipse IDE.  Steps to follow: 1) Launch the Eclipse IDE and from Help menu, click “Install New Software”. 2) You will see a dialog window, click “Add” button. 3) Type name as you wish, let’s assume “Cucumber plugin” and location “http://cucumber.github.com/cucumber-eclipse/update-site” . Click OK. 4) You come back to the previous window but this time you must see Cucumber Eclipse Plugin option in the available software list. Just Check the box and press “Next” button. 5) select and check Cucumber Eclipse Plugin from the list and click Next. 6) Click “I accept the terms of the lic...

You have not concluded your merge (MERGE_HEAD exists).

The problem is your previous pull failed to merge automatically and went to conflict state. And the conflict wasn't resolved properly before the next pull. 1) Undo the merge and pull again. To undo a merge: git merge --abort [Since git version 1.7.4] git reset --merge [prior git versions] 2) pull again 3) Merge again 2) Resolve the conflict properly 3) Don't forget to add and commit the merge. 4) git pull now everything should work fine. This should fix your problem.