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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:04:03+00:00 2026-06-17T09:04:03+00:00

I have a question about JTA with Glassfish. For days Iam trying to solve

  • 0

I have a question about JTA with Glassfish. For days Iam trying to solve this problem. I want to write an Entity in a database. To keep it simple I use the GlassfishDB. In the Glassfish-Admin Console I use the

jdbc/__default

as Resource. The Ping of the Connection-Pool is working. In the persistence.xml I have declared that Iam using JTA and that jdbc/__ default is my Resource. If I try to create tables from fields I get an Exception:

[EL Info]: EclipseLink, version: Eclipse Persistence Services - 2.0.1.v20100213-r6600
java.lang.NullPointerException
at `enter code here`com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:297)
at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:271)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:430)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:569)
at javax.naming.InitialContext.lookup(InitialContext.java:415)
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:110)
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:94)
at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:584)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:228)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:369)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:151)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:207)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:195)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.perform(Main.java:85)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:76)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:63)
[EL Severe]: Local Exception Stack: 
Exception [EclipseLink-7060] (Eclipse Persistence Services - 2.0.1.v20100213-r6600):           
org.eclipse.persistence.exceptions.ValidationException
Exception Description: Cannot acquire data source [jdbc/__default].
Internal Exception: javax.naming.NamingException: Lookup failed for 'jdbc/__default' in   
SerialContext  [Root exception is javax.naming.NamingException: Unable to acquire   
SerialContextProvider for SerialContext  [Root exception is   
java.lang.NullPointerException]]
at org.eclipse.persistence.exceptions.ValidationException.cannotAcquireDataSource(ValidationException.java:451)
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:116)
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:94)
at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:584)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:228)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:369)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:151)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:207)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:195)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.perform(Main.java:85)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:76)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:63)
 Caused by: javax.naming.NamingException: Lookup failed for 'jdbc/__default' in    
 SerialContext  [Root exception is javax.naming.NamingException: Unable to acquire      
 SerialContextProvider for SerialContext  [Root exception is  
 java.lang.NullPointerException]]

The persistence.xml is:

 <?xml version="1.0" encoding="UTF-8"?>
   <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"   
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence   
    http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
 <persistence-unit name="Test" transaction-type="JTA">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>jdbc/__default</jta-data-source>
 </persistence-unit>
   </persistence>

The <resources>-part of the domain.xml of Glassfish is:

-<resources> 
  <jdbc-resource object-type="system-admin" jndi-name="jdbc/__TimerPool" pool-  
  name="__TimerPool"/> 
  <jdbc-resource jndi-name="jdbc/__default" pool-name="DerbyPool"/> 
 -<jdbc-connection-pool name="__TimerPool" res-type="javax.sql.XADataSource"  
   datasource-classname="org.apache.derby.jdbc.EmbeddedXADataSource"> 
  <property name="databaseName"   
   value="${com.sun.aas.instanceRoot}/lib/databases/ejbtimer"/> 
  <property name="connectionAttributes" value=";create=true"/> 
  </jdbc-connection-pool>  
  -<jdbc-connection-pool name="DerbyPool" res-type="javax.sql.DataSource" datasource- 
   classname="org.apache.derby.jdbc.ClientDataSource" is-isolation-level-
   guaranteed="false"> <property name="PortNumber" value="1527"/> 
   <property name="Password" value="APP"/> 
   <property name="User" value="APP"/> <property name="serverName" value="localhost"/>  
   <property name="DatabaseName" value="sun-appserv-samples"/> 
   <property name="connectionAttributes" value=";create=true"/> 
   </jdbc-connection-pool> 
   -<jdbc-connection-pool name="PostSQLPool" res-type="javax.sql.DataSource"  
    datasource-classname="org.postgresql.ds.PGSimpleDataSource" ping="true"> 
   <property name="databaseName" value="PostSQLDatenbank"/> 
   <property name="password" value="philipp"/> <property name="portNumber" 
   value="5432"/> 
   <property name="serverName" value="localhost"/> 
   <property name="user" value="postgres"/> 
   <property name="URL" value="URL=jdbc:postgresql://localhost:5432/Time"/> 
   </jdbc-connection-pool> -
   <jdbc-connection-pool name="PostPool" res-
   type="javax.sql.DataSource" datasource- 
   classname="org.postgresql.ds.PGSimpleDataSource" ping="true"> 
   <property name="Url" value="jdbc:postgresql://localhost:5432/PostSQLDatenbank"/> 
   <property name="URL" value="jdbc:postgresql://localhost:5432/PostSQLDatenbank"/>  
   <property name="databaseName" value="PostSQLDatenbank"/> 
   <property name="password" value="philipp"/> 
   <property name="portNumber" value="5432"/> 
   <property name="serverName" value="localhost"/> 
   <property name="user" value="postgres"/> 
   </jdbc-connection-pool> 
 </resources>
  • 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-17T09:04:04+00:00Added an answer on June 17, 2026 at 9:04 am

    From your stack trace it seems you are running outside of Glassfish, to use a Glassfish DataSource you need to be running inside the server.

    If you want to run outside of Glassfish you need to specify the JDBC connection URL directly.

    See,
    http://en.wikibooks.org/wiki/Java_Persistence/Runtime#Java_Standard_Edition

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

Sidebar

Related Questions

I have question about XSLT1.0. The task is to write out in HTML all
I have a question about this formula from a book: EFW (cm,kg)= 10^(-1,7492+(0,166*BPD)+(0,046*AC)-(2,646*AC*BPD/1000)) The
I have question about database optimizing, indexing. I have table that called projects and
I have question about the sql query. I am trying to make the query
I have question about how to correctly write my application. I would like to
I have question about this plugin system: .NET 4.0 ASP.NET MVC 3 plug-in architecture
I have no Idea about JTA,to understand the overall scenarios please follow this link
I have question about python and sqlite3. I want to drop a table from
i have question about finding maximum x or y-value in text file. This is
Today I have question about Eclipse . I use this IDE very long and

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.