Data is not being persisted

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

Data is not being persisted

This post was updated on .
Thank you so much for your valuable input Ludovic :)
I no longer get the error. However I have ran into another problem now.


1.       Data is not getting persisted.

2.       Upon using em.persist(user), we don't see the SQL query on the console

3.       I see "0 enlisted resource" even if it was able to read "1 resource(s) [jdbc/testDS]"  on Line:220 (as below)

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/ssubudhi/.m2/repository/org/slf4j/slf4j-simple/1.6.4/slf4j-simple-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/ssubudhi/.m2/repository/org/slf4j/slf4j-log4j12/1.7.5/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
70 [main] INFO - Bitronix Transaction Manager version 2.1.4
70 [main] WARN - cannot get this JVM unique ID. Make sure it is configured and you only use ASCII characters. Will use IP address instead (unsafe for production usage!).
80 [main] INFO - JVM unique ID: <>
210 [main] INFO - recovery committed 0 dangling transaction(s) and rolled back 0 aborted transaction(s) on 1 resource(s) [jdbc/testDS] (restricted to serverId '')
log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See for more info.
Hibernate: drop table if exists Patient cascade
Hibernate: create table Patient (userId  serial not null, userName varchar(255), primary key (userId))
1621 [main] WARN - executing transaction with 0 enlisted resource
1621 [main] INFO - shutting down Bitronix Transaction Manager
Please find the modified file attached with this email.

Thanks a lot,

From: Ludovic Orban-2 [via Bitronix Transaction Manager] []
Sent: Wednesday, April 15, 2015 11:51 PM
To: Subudhi, Suchi
Subject: Re: javax.naming.NoInitialContextException -Standalone program

I couldn't run your sample until the end as it expects a postgres
database to be up and running, but I nevertheless found a few problems
that are easy to fix:

1) must be in src/main/resources and not in src/main.
That's the way maven works.
2) Your datasource(s) and transaction manager *must* be initialized
before hibernate. Simply make sure that you create your
PoolingDataSource and call init on it and call
TransactionManagerServices.getTransactionManager() before you call
Persistence.createEntityManagerFactory() otherwise hibernate will try
to initialize the transaction manager itself and will complain about
missing datasources and such.
3) There is no need to bind the datasources in JNDI yourself: *all*
the initialized PoolingDataSource's *automatically* are available via
the BitronixInitialContext as soon as they are initialized and are
removed from the latter when they get closed. Keep in mind that the
bitronix JNDI is not a full JNDI provider, it merely is a read-only,
partial implementation that allows you (and 3rd party libs) to lookup
objects that are managed by BTM.

Hopefully this should help you getting started.

On Thu, Apr 16, 2015 at 1:29 AM, suchi <[hidden email]</user/SendEmail.jtp?type=node&node=1711&i=0>> wrote:

> I'm trying to make JPA and JTA to work together via Hibernate and Bitronix
> Transaction Manager.
> Please see the attached "" attachment for details.
> I keep running into javax.naming.NoInitialContextException inspite of
> defining and pooling datasource.
> --
> View this message in context:
> Sent from the Bitronix Transaction Manager mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:

To unsubscribe from this list, please visit:

If you reply to this email, your message will be added to the discussion below:
To unsubscribe from javax.naming.NoInitialContextException -Standalone program, click here<>.
NAML<> (28K) <>
Reply | Threaded
Open this post in threaded view

Re: Data is not being persisted

This post was updated on .
I was able to resolve this issue, by commenting out the properties in the "persistence.xml" which were setting up the datasource