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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:58:15+00:00 2026-05-29T06:58:15+00:00

I have EJB TimeServiceEJB with remote interfce TimeService. In Deploy descriptor of my EJB

  • 0

I have EJB TimeServiceEJB with remote interfce TimeService. In Deploy descriptor of my EJB module there is:

<ejb-name>TimeServiceEJB</ejb-name>
...
<env-entry>
    <description>... </description>
    <env-entry-name>variable</env-entry-name>
    <env-entry-type>java.lang.Integer</env-entry-type>
    <env-entry-value>10</env-entry-value>
</env-entry>

I need to get this variable from client application and be able to edit it. I trying to do it this way:

Properties p = new Properties();
p.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
p.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
p.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
p.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
p.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
InitialContext iniCtx = new InitialContext(p);
Integer variable = (Integer) iniCtx.lookup("java:comp/ejb/TimeServiceEJB/variable");

But i got nothing. Tried to lookup in different ways (“java:global/ejb/TimeServiceEJB/variable”, “java:comp/env/TimeServiceEJB/variable”, “java:global/ear-name/module-name/TimeServiceEJB/) – always had “javax.naming.NameNotFoundException: No object bound for …”

Tried to set mappingName of this variable by annotaion @Resource(name=”variable”, mappedName=”env/variable”), and lookup by “env/variable”, but got NameNotFoundException.

Is there any ideas, how to get this variable? And the second question is: can i edit its value?

  • 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-29T06:58:16+00:00Added an answer on May 29, 2026 at 6:58 am

    Is there any ideas, how to get this variable?

    Environment entries are only visible in the application component’s naming context (i.e. java:comp/env from the InitialContext within the EJB or web module where it is declared). (Exception: Java EE 6 provides ways to declare and access module, application, and global-scoped environment entries, but those require specific environment entry prefixes. See EE.5.2.2 from the Java EE 6 specification for more information.)

    And the second question is: can i edit its value?

    Environment entry values cannot be modified in JNDI at runtime. I’d suggest exposing a separate method on your EJB that gets and sets this value locally.

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

Sidebar

Related Questions

I have a EJB module in remote Glassfish server and application client in my
I have Java EE application, and my EJB module have persistence.xml . I deploy
I have a EAR package that contains a web module and EJB. The EJB
I have ejb + JPA app on GF3 server and remote swing client. I
I have a @Stateless EJB using container managed transaction. Is there a way to
I have a remote EJB with a method that validates an object (returning true
I am facing another problem in my little test-webapp. I have an EJB module
I have ejb 2.1 deployed in JBOSS 5 server . The jndi name is
I have an EJB and a WEB module in my IntelliJ, created 5 entities
I have a two ejb's in an EAR on glassfish, both implementing remote interfaces

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.