Thursday 7 April 2016

Spring logging

error :

java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component

include the common-logging dependency.

Commons Logging is the logging framework that Spring uses to log



Jersey :
com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.

In the service class provide the root path. if root is not provide or we have not annoted class with @Path.

ex :

@Service
@Path("/test")     // provide the root path
public class voice {

@Path("/hello")
public class HelloWorldService {

@GET
@Path("/{param}")
public Response getMsg(@PathParam("param") String msg) {

String output = "Jersey say : " + msg;

return Response.status(200).entity(output).build();

}

}

}
Spring

java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

1) configure the required spring dependency to pom.xml

or

2) configure the spring  maven dependency library to java build path.

ex :  go to properties->deployment assembly->add ->java build path 
Skipping Tests in maven

If you want to skip test of project enable the surefire plugin in pom.xml

configuration :

type : false - enables the test suite to run.
          true  - enables to skip the test.
command : mvn install -Dmaven.test.skip=true

pom.xml configuration :

<project>
  [...]
  <properties>
    <skipTests>true</skipTests>
  </properties>
  [...]
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.12.4</version>
        <configuration>
          <skipTests>${skipTests}</skipTests>
        </configuration>
      </plugin>
    </plugins>
  </build>
  [...]
</project>
Ref : maven
Spring jersey :

1) Download the blank spring jersey from maven archetype catalog.

url :  spring boot jersey blank

mvn command for  windows :

ex : 
mvn archetype:generate^
 -DarchetypeGroupId=am.ik.archetype^
 -DarchetypeArtifactId=spring-boot-jersey-blank-archetype^
 -DarchetypeVersion=1.0.2







REF : Spring jersey


Tuesday 5 April 2016