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

  • Home
  • SEARCH
  • 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 3323198
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:16:24+00:00 2026-05-17T23:16:24+00:00

This is my persistence.xml : <persistence> <persistence-unit name=MyUnit> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>jdbc/abcDS</jta-data-source> </persistence-unit> </persistence> This is

  • 0

This is my persistence.xml:

<persistence>
  <persistence-unit name="MyUnit">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <jta-data-source>jdbc/abcDS</jta-data-source>
  </persistence-unit>
</persistence>

This is jndi.properties file from src/test/resources which is supposed to create a datasource during testing, since a real application server with a real datasource is absent:

java.naming.factory.initial=org.apache.openejb.client.LocalInitialContextFactory
jdbc/abcDS=new://Resource?type=DataSource
jdbc/abcDS.JdbcDriver=org.hsqldb.jdbcDriver
jdbc/abcDS.JdbcUrl=jdbc:hsqldb:mem:testdb
jdbc/abcDS.JtaManaged=true
jdbc/abcDS.DefaultAutoCommit=false
jdbc/abcDS.UserName=sa
jdbc/abcDS.Password=

This is the test class:

public class FinderTest {
  @BeforeClass
  public static void startEJB() throws Exception {
    InitialContext ic = new InitialContext();
    ic.lookup("jdbc/abcDS");
  }
}

Unfortunately, the datasource is not created and this is what I keep seeing:

[...]
javax.naming.NameNotFoundException: Name "jdbc/abcDS" not found.
at org.apache.openejb.core.ivm.naming.IvmContext.federate(IvmContext.java:193)
at org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:150)
at org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:124)
at org.apache.openejb.core.ivm.naming.ContextWrapper.lookup(ContextWrapper.java:115)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.XXX.FinderTest.startEJB(FinderTest.java:31)
[...]

What am I doing wrong? Please help!

ps. By the way it works this way (what’s going on???):

ic.lookup("java:/openejb/Resource/jdbc/abcDS");
  • 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-17T23:16:25+00:00Added an answer on May 17, 2026 at 11:16 pm

    Should be found if you lookup openejb:Resource/jdbc/abcDS

    As well you can get injection in your TestCase. Basically, you:

    1. add an empty src/test/resources/META-INF/application-client.xml or ejb-jar.xml
    2. Annotate your test with @LocalClient
    3. Call initialContext.bind("inject", this)

    See the testcase-injection example in the examples.zip

    EDIT If the lookup still fails, post your log output (the console output).

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

Sidebar

Related Questions

A quote from persistence.xml : <persistence-unit name=test transaction-type=RESOURCE_LOCAL> <properties> <property name=hibernate.archive.autodetection value=class /> <property
What value should I place into <jta-data-source> of my persistence.xml ? In glassfish admin
I have one persistence unit configured in my persistence.xml but i have two databases.
This past summer I was developing a basic ASP.NET/SQL Server CRUD app, and unit
I have parametrized persistence.xml. I am trying to generate ddl schema using hbm2ddl. How
In a web application using struts2 ejb hibernate, is it possible to tell the
i'm working on a project in which i use JPA, Hibernate and all this
This is the directory structure of the project (maven2 is used): pom.xml /src /main
I'm developing a web application using Wicket+Spring+JPA+Hibernate. This is my first project with this
I am using jdo and configuring the persistence manager with jdoconfig.xml However everywhere I

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.