tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: Running war using uber jar doesn't load the jdbc driver in WEB-INF/lib folder
Date Wed, 04 May 2016 15:18:12 GMT
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 <sankar_ravi_c@yahoo.co.in.invalid>:

> 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
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message