Hi guys,
I shifted a few applications from tomee-plume 1.7.4 to 7.0.2
and the context.xml (in webapp's META-INF) resources stopped working as
it used to. The persistence mappings were found to be not JTA managed
and tomee was allocating hsql entries for them and causing issues. I
tried moving the resources to resources.xml and then naming lookups
under java:/comp/env/jdbc stopped working. I can get it all to work by
specifying the same resources in context.xml and resources.xml at the
same time and that does not look right.
Looking at the code, I figured that the JTA managed flag was
reported as missing because the resource properties, when loaded from
context.xml, was getting loaded as a "reference".
From context.xml
------------------------
{jndiName=jdbc/K11WriteDb, appName=localhost/k11, factory=null,
reference=ResourceRef[className=javax.sql.DataSource,factoryClassLocation=null,factoryClassName=org.apache.naming.factory.ResourceFactory,{type=scope,content=Shareable},{type=auth,content=Container},{type=singleton,content=true},{type=password,content=test},{type=maxIdle,content=10},{type=validationQuery,content=select
1},{type=JtaManaged,content=true},{type=driverClassName,content=org.postgresql.Driver},{type=maxWait,content=10000},{type=url,content=jdbc:postgresql://localhost:5432/k11?targetServerType=master},{type=maxActive,content=100},{type=username,content=k11}],
OriginalId=jdbc/K11WriteDb}
From resources.xml
--------------------------
{JtaManaged=true, JdbcDriver=org.postgresql.Driver,
JdbcUrl=jdbc:postgresql://localhost:5432/k11?targetServerType=master,
UserName=k11, Password=test, PasswordCipher=PlainText,
OpenEJBResourceClasspath=false, maxIdle=10, validationQuery=select 1,
maxWait=10000, maxActive=100}
I saw this flag, tomee.tomcat.datasource.wrap, in
TomcatWebAppBuilder.java that could force the loading of context.xml
resources in the resources.xml format (force datasource wrapping).
Setting this flag to true in system.properties file seems to make things
work as before (in tomee 1.7.4) without making any changes to my wars.
As I see no documentation regarding this flag, I am not sure if I
am supposed to use this and whether using this will have other side
effects. Can someone please confirm that it is ok to use this flag ?
-Regards
-SP
"Disclaimer: This message is being sent from Kalki Communication Technologies
Pvt Ltd (KALKITECH). and may contain information which is confidential or
privileged. If you are not the intended recipient, please advise the sender
immediately by reply e-mail and delete this message and any attachments
without retaining a copy. Any unauthorized use of the content of this message
can expose the responsible party to civil and/or criminal penalties,
and may constitute a more serious offense. Further the company does not accept
liability for any errors, omissions, viruses or computer problems
experienced as a result of this transmission. If you have received this
message in error, notice is hereby given that no representation, contract or
other binding obligation shall be created by this e-mail."