Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Mobile Application - Device Null Pointer Exception

 
Ranch Hand
Posts: 57
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am trying to find whether the request is from mobile/tablet/normal browser. For that I followed below configuration

I have added spring-mobile-device1.0 jar to class path.


spring.xml
----------------


web.xml
------------


SessionFilter.java
--------------------


Problem: Null Pointer Exception at : Device currentDevice = DeviceUtils.getCurrentDevice(request);


Could any one please assist to resolve this issue..

 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the complete stack trace?
 
kiran nyala
Ranch Hand
Posts: 57
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is stack trace

 
Jayesh A Lalwani
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's very weird that you would have a Null Pointer Exception on a call to a static method. Are you sure there is no "Caused by" below that stack trace?. Are you sure line 14 is DeviceUtils.getcurrentDevice Do you have a catch clause inside DeviceUtils.getCurrentDevice method?
 
Greenhorn
Posts: 1
Spring Tomcat Server Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did any one solve this problem? Because I'm getting the same as you.

Here is the Class where I'm using the DeviceUtils.getCurrentDevice(request);





Here is my stacktrace error, pretty weird because I'm not getting the cause of the error in the trace...

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!