tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravi sankar <sankar_rav...@yahoo.co.in.INVALID>
Subject Re: Running war using uber jar doesn't load the jdbc driver in WEB-INF/lib folder
Date Wed, 04 May 2016 16:18:20 GMT
Thanks Romain,With this configuration it is working as I expected.
<resources>
    <Resource id="myowndatasource" type="DataSource">
        JdbcDriver ${db.driver:-org.h2.Driver}
        JdbcUrl ${db.url}
        UserName ${db.username}
        Password ${db.password}
    </Resource>
</resources>
Thanks,Ravisankar Challa
 

    On Thursday, 5 May 2016 1:18 AM, Romain Manni-Bucau <rmannibucau@gmail.com> wrote:
 

 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 |  Blog | Github | LinkedIn | Tomitriber | JavaEE Factory
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