If you need global JTA resources then there they should get managed on the
container level. This is a clean separation of concerns. The app says „I need
resource X“ and the whole configuration and setup is done on container level
depending on the system. Different stages or even customers obviously have
different database credentials for example ;)
At the end it’s a chicken-egg problem. You cannot configure a ‚global‘ resource
‚locally‘ in an app.
Otoh, if you like to use just resource-local transactions (no JTA) then you can
easily configure all this on an application level. You might look at DeltaSpike
@Transactional + the configuration for this. You can provide a default config
inside your application but also ‚override‘ it from outside.
E.g.
@ApplicationScoped
public class EmProducer {
@Inject
@PersistenceUnitInfo(„samplePU“
private EntityManagerFactory emf;
@Produces
@RequestScoped
public EntityManager createEm() {
return emf.createEntityManager();
}
public void dispose(@Disposes @Default EntityManager entityManager) {
entityManager.close();
}
}
The configuration can be provided in a file persistence-yourpuname.properties,
e.g. [2].
Of course this gets loaded via the DeltaSpike PropertyLoader, means you can
‚overwrite‘ parts of the config via providing another property file with the
same name in an additional classpath. Just add a ‚deltaspike_ordinal=200‘
inside the property files to make it ‚more important‘ than the default config.
Be aware that this is a CDI only solution. EJB needs global config.
LieGrue,
strub
[1] http://deltaspike.apache.org/documentation/jpa.html
[2]
https://github.com/struberg/lightweightEE/blob/cdi11/backend/src/main/resources/persistence-CaroLine.properties
> Am 11.02.2016 um 16:27 schrieb Romain Manni-Bucau <[email protected]>:
>
> System property openejb.configuration can take tomee.xml but you can also
> import a tomee.xml in the main tomee.xml (from head <Import path=...|>).
>
> For libs: either use resources.xml to use app loader or you can use
> classpath property of resources.
> Le 11 févr. 2016 16:06, "Manas21" <[email protected]> a écrit :
>
>> Hi,
>> I would like to keep application specific resources eg: application
>> jars,
>> tome.xml outside the tomee binary package. How can I implement this ? Is
>> there any file where I can specify the location of the "libs" and
>> "tomee.xml" ?
>>
>>
>>
>> --
>> View this message in context:
>> http://tomee-openejb.979440.n4.nabble.com/Change-the-location-of-tomee-xml-tp4677596.html
>> Sent from the TomEE Users mailing list archive at Nabble.com.
>>