Hi
global config (system props or tomee.xml) uses tomee classloader,
resources.xml uses webapp classloader.
Think you want to add a WEB-INF/resources.xml:
<resources>
JdbcDriver = ${db.driver-:org.h2.Driver}
JdbcUrl = ${db.url}
UserName = ${db.user}
....
</resources>
and set these system properties: -Ddb.url=... -Ddb.user=...
Side note: -: is the unix syntax for default we reuse there.
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>
2016-05-04 17:15 GMT+02:00 ravi sankar <[email protected]>:
> java -Dmyowndatasource=new://Resource?type=javax.sql.DataSource
> -Dmyowndatasource.jdbcDriver=org.h2.Driver
> -Dmyowndatasource.jdbcUrl=jdbc:h2:tcp://localhost/~/mydb
> -Dmyowndatasource.username=sa
> -Dmyowndatasource.password=sa
> -jar tomee-embedded-7.0.0-20160504.041353-343-uber.jar
> --path tomee_embedded.war
>
> throws java.lang.ClassNotFoundException: org.h2.Driver
>
> Is this a tomee limitation?
>
> As you suggested in another mail the workaround is working
> java -Dmyowndatasource=new://Resource?type=javax.sql.DataSource
> -Dmyowndatasource.jdbcDriver=org.h2.Driver
> -Dmyowndatasource.jdbcUrl=jdbc:h2:tcp://localhost/~/mydb
> -Dmyowndatasource.username=sa
> -Dmyowndatasource.password=sa
> -cp tomee-embedded-7.0.0-20160504.041353-343-uber.jar:h2-1.4.191.jar
> org.apache.tomee.embedded.Main
> --path tomee_embedded.war
>