Sunday, July 24, 2016

Error getting reflective information for class org.springframework.web.servlet.DispatcherServlet

Hi Guys ,
You might experience Error getting reflective information for class org.springframework.web.servlet.DispatcherServlet error while deploying any spring MVC project to wildfly.

Full stack trace is as below:


12:37:48,987 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC000001: Failed to start service jboss.deployment.unit."org.myProject.question.model.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."org.myProject.question.model.war".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment "org.myProject.question.model.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_91]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_91]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_91]
Caused by: java.lang.RuntimeException: JBAS018757: Error getting reflective information for class org.springframework.web.servlet.DispatcherServlet with ClassLoader ModuleClassLoader for Module "deployment.org.myProject.question.model.war:main" from Service Module Loader
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:72) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:107)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:92)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:77)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
... 5 more
Caused by: java.lang.NoClassDefFoundError: org/springframework/web/context/request/async/CallableProcessingInterceptor
at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.8.0_91]
at java.lang.Class.privateGetDeclaredFields(Class.java:2583) [rt.jar:1.8.0_91]
at java.lang.Class.getDeclaredFields(Class.java:1916) [rt.jar:1.8.0_91]
at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:68) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
... 10 more
Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.request.async.CallableProcessingInterceptor from [Module "deployment.org.myProject.question.model.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:197) [jboss-modules.jar:1.3.0.Final-redhat-2]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:443) [jboss-modules.jar:1.3.0.Final-redhat-2]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:431) [jboss-modules.jar:1.3.0.Final-redhat-2]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:373) [jboss-modules.jar:1.3.0.Final-redhat-2]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:118) [jboss-modules.jar:1.3.0.Final-redhat-2]
... 15 more

12:37:49,000 ERROR [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "org.myProject.question.model.war" was rolled back with the following failure message: 
{"JBAS014671: Failed services" => {"jboss.deployment.unit.\"org.myProject.question.model.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"org.myProject.question.model.war\".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment \"org.myProject.question.model.war\"
    Caused by: java.lang.RuntimeException: JBAS018757: Error getting reflective information for class org.springframework.web.servlet.DispatcherServlet with ClassLoader ModuleClassLoader for Module \"deployment.org.myProject.question.model.war:main\" from Service Module Loader
    Caused by: java.lang.NoClassDefFoundError: org/springframework/web/context/request/async/CallableProcessingInterceptor
    Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.request.async.CallableProcessingInterceptor from [Module \"deployment.org.myProject.question.model.war:main\" from Service Module Loader]"}}
12:37:49,065 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment org.myProject.question.model.war (runtime-name: org.myProject.question.model.war) in 65ms


You might have notices the  root cause is java.lang.NoClassDefFoundError: org/springframework/web/context/request/async/CallableProcessingInterceptor

If you have the same root cause , you can try the following solutions that worked for me:
1. If you are using maven delete all the repositories , do a fresh clean install and deploy the war file again.
2. If you are using eclipse to add the project to wildfly , use wildfly admin console.

References :
SO



Friday, July 22, 2016

Spring Transactions

Hello Guys ,
Let us explore spring transactions API.
Transaction Management is a part of Data Access.
Let us understand through an example.We will use Hibernate framework in this example for data access. To make spring aware of our this we have to define the bean in spring configuration xml as below:

<bean id="myTxnManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="mySessionFactory"/>
</bean>

<tx:annotation-driver transaction-manager="myTxnManager" >

The use of transaction manager is maintain data consistency.


Wednesday, June 15, 2016

Maven

Maven is a building tool.
Features of maven :
pom.xml  : an XML for project as well as a module . You can specify the build related information in pom.xml  and maven takes care of build , packaging etc.
Unit Testing : You can run your junit as part of the build , maven also generates report for the test result.
Repository : maven has its own repository with almost all major library jars available.
Local repository : its a directory in users PC which has the jars downloaded from the server repository.
Resources: maven automatically takes care of moving your xmls,property files appropriate places. You can add the xmls,property files to resources folder.

Set up Maven :
Repository :
You can set the location of maven repository in file setting.xml  at path MAVEN_HOME/conf




Saturday, June 11, 2016

spring mvc simple example


Hadoop Simple Example


Three friends went on trip , each paying bills which needs to be split among them.

We need to write a MapReduce Job

References

Hadoop


Hadoop is a programming framework used to process Big Data over a network. First we need to understand big data.The definition of Big data is as follows:

extremely large data sets that may be analysed computationally to reveal patterns, trends, and associations, especially relating to human behaviour and interactions.

Let us classify Big data into 3 types:
  • Structured Data
  • Semi Structured Data
  • Unstructured Data

Structured data is like the data stored in the SQL tables of Relational database.

Semi Structured data is like the data stored in the XMLs.

Unstructured Data is the data stored in word document or pdf .

To process big data over a network google has developed an algorithm known as MapReduce which Hadoop has made use of.

Let's try a Simple Example to understand

References

ec2-user@ec2 Permission denied