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 8379981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:20:12+00:00 2026-06-09T16:20:12+00:00

I am creating a simple REST service, which owns only REST resource (java class

  • 0

I am creating a simple REST service, which owns only REST resource (java class with Jersey annotations). This REST resource needs several Java objects to work. These Java objects are very big, a few hundred MB, so it’s slow to load them into RAM. Therefore, I am trying to add these objects as static members of this REST class. However, when I send a request to the REST service, it always throws a NullPonterException. Can anyone explain why these static members are not instantiated before the REST resources(classes) are loaded? Or it’s some other reasons?

Thanks you guys in advance.

Note: those static members are just some Maps, and Lists objects, created by a class in a dependency jar.

Edit: assume the InfoConstructor below is one utility class which is responsible for creating those static objects.

code for my REST resource class is as below:

@Path("test")
public class TestResource {
    public static Map<String, Integer> vocMap = InfoConstructor.getVocMap();

    @Get
    @Produce(Media.TEXT_HTML)
    public String testGet() {
         return vocMap.hashCode();
    }
}
  • 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-06-09T16:20:14+00:00Added an answer on June 9, 2026 at 4:20 pm

    Based on the comments it sounds like the static resources are initialized correctly. More of an issue resolving class path resources. Have a look at Classpath resource within jar

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

Sidebar

Related Questions

I have a very simple Java JTable question. I am creating this class to
While creating a simple client for a REST service which I have stubbed out,
I am new to WCF Services. We are creating a REST WCF Service which
I creating simple tree with rest service on Extjs 4.1 . How can I
i am creating simple call filter application which restrict unwanted calls. i use following
When creating a simple Flex 4.6 App, where the creationComplete-handler looks like this: protected
I am creating a simple REST API that outputs JSON data. However I am
This could be the most basic json question ever. I'm creating a WCF REST
I was creating a simple program that simulates a coin toss for my class.
I am creating a web application and REST service Using ExpressJS + NodeJS +

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.