Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6219133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:43:38+00:00 2026-05-24T07:43:38+00:00

I got a null pointer exception fault in java servlet. Could someone tell me

  • 0

I got a “null pointer exception” fault in java servlet. Could someone tell me what happens? And how to avoid that?

I know java servlet can be used as part of a hybrid solution, could support many different programming languages. How would the different programs execute/call each other and exchange information? (could someone tell me some words but codes). In addition, values extracted from a session object have to be converted(cast) to a specific type, but why?

For example, how can I store a variable of type “int” in a session object. Could someone help me to figure it out?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T07:43:39+00:00Added an answer on May 24, 2026 at 7:43 am

    I got a “null pointer exception” fault in java servlet. Could someone tell me what happens? And how to avoid that?

    That happens when you’re trying to access/invoke some reference which is actually null.

    SomeObject someObject = null;
    someObject.doSomething(); // Throws NullPointerException.
    

    You need to make sure that you only access/invoke it when it is not null.

    SomeObject someObject = null;
    if (someObject != null) {
        someObject.doSomething(); // Won't throw NullPointerException.
    }
    

    It’s just matter of logical thinking and understanding basic Java.


    Another thing, I know java servlet can be used as part of a hybrid solution, could support many different programming languages. But how would the different programs execute/call each other and exchange information?(could someone tell me some words but codes).

    Pass them as method parameter(s).


    In addition, values extracted from a session object have to be converted(cast) to a specific type, but why? For example, how can I store a variable of type “int” in a session object. Could someone help me to figure it out?

    Use Integer instead and/or profit Java 1.5’s autoboxing capabilities.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got exception about convert NULL to Int32. I've got a table from database
I have got a field that has been setup to allow for Null, but
How could we handle null for a datetime field (got from SQL Server) in
I've been at this one for a bit now. I've got a null pointer
I've got a problem with java's instanceof. Here's a gap of code that causes
i got a pointer to char in my class that would later be used
I am very surprised by the strange exception, that I got. class Threads {
Got this: Table a ID RelatedBs 1 NULL 2 NULL Table b AID ID
I got RJS error: TypeError: element is null while using ajax. I used in
I got the following code inside an NSTimer selector: [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:2.0];

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.