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

  • Home
  • SEARCH
  • 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 8499413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:39:36+00:00 2026-06-11T00:39:36+00:00

I am new to Java EE 6 and JNDI so please forgive me if

  • 0

I am new to Java EE 6 and JNDI so please forgive me if my problem seems trivial

I have added a custom resource to Glassfish 3.1.2 JNDI resources via tha admin console:

CommonTasks->Resources->JNDI->Custom Resources

  • JNDI Name: someNumber
  • Resource Type: java.lang.Integer
  • Factory Class: org.glassfish.resources.custom.factory.PrimitivesAndStringFactory
  • Additional Properties: [Name: digit; Value: 6]

Now I wish to look this resource up in my Java EE app I deploy to the glassfish server as ear.
I’ve tried this with no luck:

    InitialContext ctx = new InitialContext();     
    Object o =  ctx.lookup("someNumber");

I keep getting a NameNotFoundException.
Can you tell me what is it that I’m doing wrong? I know that you can pass an environment hashtable to the initial context constructor with a provider URL – is this the problem?

  • 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-11T00:39:37+00:00Added an answer on June 11, 2026 at 12:39 am

    Such a rookie mistake.

    Turns out the NameNotFoundException was actually caused by my integer jndi resource not having a value,
    I was stupid to think that the Additional Properties are custom like in a JMS message and I could look them up later after fetching the object. The “Additional Properties” is were I had to input the “value” property. After making this change everything works smoothly

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

Sidebar

Related Questions

I have the following code adding an ActionListener to a JTextField: chatInput.addMouseListener(new java.awt.event.MouseAdapter() {
i have a problem with JNDI in Tomcat: without tomcat I have used JNDI
I have an application which processes IQ stanzas via smack (eventbased java library). We
I'm trying to have my custom java application use our Active Directory Server for
I have a problem setting up my configuration for JNDI with Spring. I checked
When I start a new Java project in eclipse, the first popup screen allow
We are starting a new Java EE project and am looking for suggestions regarding
When creating a new Java project in IntelliJ IDEA, the following directories and files
I am starting a new Java web project that will be worked on by
Eclipse and MyEclipse create new Java files with an extra blank line after the

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.