I'm writing a few unit tests to test an entity class and I'm running these tests from within Eclipse.
In my persistence.xml I am referencing the JNDI name of a datasource that is set up in GlassFish.
When running the unit test from Eclipse, I get the following exception:
Exception Description: Cannot acquire data source [JNDI-NAME-FROM-APP-SERVER].
Could this be because I am not within the context of the appserver and if so, what would be the 'nicest' way to get around this?
Pass a properties Map to Persistence.createEntityManagerFactory(pu, properties) with your test database url and user/password.
Or have a separate persistence unit defined for Java SE testing.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.