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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:47:51+00:00 2026-05-26T21:47:51+00:00

I am preparing a J2EE web application that should hopefully be packaged and sold

  • 0

I am preparing a J2EE web application that should hopefully be packaged and sold to clients as a war file. Each client will deploy the package into his preferred application server and will use the app with his preferred Data Source.

I am wondering what’s the best portable way to define the necessary mappings to the Data Source.

The application uses the EclipseLink JPA Persistence Provider. The entry point is something like:

@PersistenceContext(unitName = "myPersistenceUnit")
private EntityManager em;

myPersistenceUnit is described in persistence.xml as follows:

  <persistence-unit name="myPersistenceUnit" transaction-type="JTA">
    <jta-data-source>myDataSource</jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties/>
  </persistence-unit>

Now my guess is that I need to map myDataSource to the application server JNDI resource name somehow, but I am lost on how to do it. If I use the code auto-generated by NetBeans on GlassFish server, it creates the glassfish-resources.xml descriptor for the purpose. This approach works, but isn’t portable to other App Servers and produces a duplication of the Connection Pool’s properties (that are already defined in the Application Server).

  • 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-26T21:47:52+00:00Added an answer on May 26, 2026 at 9:47 pm

    Use relative JNDI mappings and link them in your web.xml.

    You have to create a resource-ref entry in your web.xml.

    Depending on application server the resource-ref entry in the web.xml will do. Others may require additional files.

    Check the examples here for the web.xml part.

    http://download.oracle.com/docs/cd/E12840_01/wls/docs103/webapp/configureresources.html
    http://wiki.eclipse.org/Jetty/Howto/Configure_JNDI_Datasource
    http://tomcat.apache.org/tomcat-7.0-doc/jndi-datasource-examples-howto.html

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

Sidebar

Related Questions

I am preparing to develop a web application that will (hopefully) be used by
I'm preparing project for web application with large AJAX usage, which should work on
I'm preparing a string that will be eval 'ed. The string will contain a
I am preparing a custom action that copies a file to a specific location.
I'm preparing a website that will send email notifications to registered users. From my
I am preparing an interactive PDF document that will be read in an iPad.I
I am preparing an application for Android which will display current status of some
I am preparing to deploy a web service that uses SqlConnection primarily as its
I'm preparing to deploy my Django app and I noticed that when I change
My application is preparing a cover-sheet for submitting documents by fax. I identify 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.