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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:56:12+00:00 2026-06-05T15:56:12+00:00

I am trying to deploy my JPA application on 2 separate instances within the

  • 0

I am trying to deploy my JPA application on 2 separate instances within the same glassfish 3 domain. Both instances will be looking up a datasource using the same JNDI name, but I want them to find different datasources.
I tried to define 2 datasources and bind them to different targets, but the DAS does not allow 2 datasources using the same JNDI name even though they are bound to different targets.

I tried to use property substitution but that didn’t work. Does anyone know how to solve this? It seems unlikely that there’s no way to deploy an application twice in the same domain.

  • 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-05T15:56:13+00:00Added an answer on June 5, 2026 at 3:56 pm

    A JNDI name is an address for a specific object, and they must be unique. Having two JNDI names is like when you have 2 numbers in your cellphone for “alex”. There is no way to know which are you dialing.

    What I would do, which should work for any JPA implementation, is to have two PUs on your persistent.xml, one with a JNDI datasource and another for the other JNDI datasource. This also makes sense because you might not have the same business objects on both datasources.

    Then, when you get you EntityManager, specify explicitly which PU you want. You might set this in a configuration file or decide it dynamically some other way.

    entfactory = OpenJPAPersistence.createEntityManagerFactory( *persistentUnitName*, (String) null );
    

    Hope this helps —

    -Alex

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

Sidebar

Related Questions

I'm using JSF2 and JPA Eclipse Link on Glassfish 3.1. I developed an application
Trying to deploy application using ClickOnce to a webserver running sharepoint. I can publish
I am trying to deploy a PHP application using subversion and post-commit script. I've
Hi I am trying to deploy an application using webstart. I have a requirement
Running JBoss 4.2.3.GA and trying to deploy a WAR that is using Spring/Hibernate/JPA. I'm
I am trying to deploy my application and web service to weblogic using the
I am trying to deploy a Spring application on WAS 6.0 (JDK 1.4.2). Day
I am trying to deploy my Ruby on Rails application on Media Temple. The
I'm trying to deploy a java application to appspot (google appengine). I'm new to
I'm trying to deploy my application to a locally running GoogleAppEngine development server, but

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.