Saturday, July 30, 2016

HAX kernel module is not installed

Hi Guys,
You might have seen this error message when you try to run for application in Android Developer Studio . There can be several reasons for this .
1. You have not installed Intel x86 emulator Accelerator .
Solution : Go to android Sdk Manager and check the option   Intel x86 emulator Accelerator . Android Developer Studio will download it to your Skd path . Go to your SDK Path and install it .

2. Virtualization is disabled in your BIOS setting .
Solution : If you get the same error after solution 1.  Go to BIOS menu and enable Hardware Virtualization .

3. Microsoft-Hyper-V is enabled 
Solution : You need to disble Microsoft-Hyper-V if it is enabled .

Monday, July 25, 2016

org.hibernate.exception.SQLGrammarException

Following are reasons of SQLGrammarException:

1. if the  type of id is different than the type of object passed as a parameter to session.get method .

Sunday, July 24, 2016

415 Unsupported Media Type

Hi Guys,

You might face this error while hitting a rest service which consumes request in JSON format.
Developers this might face this error when they are testing a spring based rest service.
Even if you have the dependent jars in place and spring application is successfully deployed you may still face this issue. The solution to this is include the following dependency in your pom.ml if you are using maven project.

<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.8.1</version>
</dependency>

This is actually required when your spring controller is using @RequestBody.Eventhough the spring documentation site mentions this in their site you will not be prompted for a compilation error or runtime error even if you do not include the above dependency.

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.


ec2-user@ec2 Permission denied