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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:38:25+00:00 2026-06-08T03:38:25+00:00

Im having trouble mapping a Weblogic (12c) defined JNDI Datasource to a local jndi

  • 0

Im having trouble mapping a Weblogic (12c) defined JNDI Datasource to a local jndi name.

I have a datasource in weblogic mysql datasource defined as “mysqltestds”, and I want to map i within a web application to a local name “localds”

My web.xml properties are

<resource-ref>
   <res-ref-name>localds</res-ref-name>
   <res-type>javax.sql.DataSource</res-type>
   <res-auth>Container</res-auth>
</resource-ref>

with the weblogic.xml

<weblogic-web-app>
   <resource-description>
      <res-ref-name>localds</res-ref-name>
      <jndi-name>mysqltestds</jndi-name>lls
   </resource-description>
</weblogic-web-app>

When I get the datasource using the global name “mysqltestds” it works correctly.

Context initialContext = new InitialContext();
Object resource = initialContext.lookup("mysqltestds");
dataSource = (DataSource) resource; 

However, when I try “localds” it fails with the error:

Context initialContext = new InitialContext();
Object resource = initialContext.lookup("localds");
dataSource = (DataSource) resource; 

javax.naming.NameNotFoundException: Unable to resolve ‘localds’. Resolved ”; remaining name ‘localds’

Can anyone help. I followed the directions in this stackOverflow question Tomcat vs Weblogic JNDI Lookup , but I haven’t had any success.

  • 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-08T03:38:27+00:00Added an answer on June 8, 2026 at 3:38 am

    I ended up working this out by trial and error.

    It seems when you are using a local resource reference, you have to refer to it using the “java:comp/env/..” prefix, so my java code worked when I made the following changes:

    Context initialContext = new InitialContext();
    Object resource = initialContext.lookup("java:comp/env/localds");
    dataSource = (DataSource) resource; 
    

    Hope this is useful if anyone else is having similar problems

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

Sidebar

Related Questions

I am having a trouble mapping an embedded attribute of a class. I have
I'm having trouble mapping the following in NHibernate: I have two tables (these are
I'm having some trouble mapping a byte array to a MySQL database in Hibernate
I'm having trouble with a certain mapping. Let's say I have three assessments that
I'm using Hibernate's JPA impl to model some tables. I'm having trouble mapping a
I am having a trouble mapping a specific URL request to one of the
I am having trouble with inheritance mapping in Linq to Sql. I am using
I've been having trouble mapping data to a combobox in vaadin. My intention was
I am having trouble trying to map this object that contains a collection of
I am having trouble mapping the following database structure (shortened for brevity with just

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.