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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:11:00+00:00 2026-05-23T00:11:00+00:00

I have the following environment set up: Java 1.5 Sun Application Server 8.2 Oracle

  • 0

I have the following environment set up:

  • Java 1.5
  • Sun Application Server 8.2
  • Oracle 10 XE
  • Struts 2
  • Hibernate

I’m interested to know how I can write code for a Java client (i.e. outside of a web application) that can reference the JNDI datasource provided by the application server.

The ports for the Sun Application Server are all at their defaults. There is a JNDI datasource named jdbc/xxxx in the server configuration, but I noticed that the Hibernate configuration for the web application uses the name java:comp/env/jdbc/xxxx instead.

Most of the examples I’ve seen so far involve code like

Context ctx = new InitialContext();
ctx.lookup("jdbc/xxxx");

But it seems I’m either using the wrong JNDI name, or I need to configure a jndi.properties or other configuration file to correctly point to a listener? I have appserv-rt.jar from the Sun Application Server which has a jndi.properties inside of it, but it does not seem to help.

There’s a similar question here, but it doesn’t give any code / refers to having iBatis obtain the JNDI Datasource automatically: Accessing Datasource from Outside A Web Container (through JNDI)

  • 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-23T00:11:01+00:00Added an answer on May 23, 2026 at 12:11 am

    I got stuck on this exact same problem. I wrote a small tutorial. Basically you have to create your own implementation of the DataSource objects and add them to your own custom initial context. There are source examples here:

    Running Beans Locally that use Application Server Data Sources

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

Sidebar

Related Questions

I have a following batch file echo Setting visual studio 2010 environment variables set
I have the following environment: Tomcat 5.5.30 Java 6 JAX-WS RI 2.1 My main
I have tried following how-set-up-your-own-private-git-server-linux and private-remote-git-repositories-ubuntu-linode but I am still having problems. My
Following this snippet , I have set-up in my rails application to highlight the
How do you setup a multi-developer XDebug PHP environment? I have the following setup:
Is it possible to set environment variable with maven (OS: Linux)? I already have
I'm facing a weird production problem. Environment is the following: JBOSS 4.0.2 SQL Server
I have the following code: EventLog el1 = new EventLog(); el1.Log = Application; el1.Source
I have developed an application using Entity Framework , SQL Server 2000, Visual Studio
I have set JAVA_HOME = C:\Program Files\Java\jdk1.6.0_26 in user defined variables and system variables

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.