java - How to access JNDI DataSource with Play Framework -


according documentation:

https://www.playframework.com/documentation/2.5.x/javadatabase#exposing-the-datasource-through-jndi

i need entry in application.conf expose datasource in jndi:

db.default.driver=org.h2.driver db.default.url="jdbc:h2:mem:play" db.default.jndiname=defaultds 

i've added "tyrex" % "tyrex" % "1.0.1" librarydepenencies in build.sbt.

from reading several other posts on this, sound should able use

datasource ds = (datasource) play.api.libs.jndi.initialcontext().lookup("defaultds"); 

to fetch datasource jndi. however, when try throws following exception:

javax.naming.namenotfoundexception: defaultds not found     @ tyrex.naming.memorycontext.internallookup(unknown source)     @ tyrex.naming.memorycontext.lookup(unknown source)     @ javax.naming.initialcontext.lookup(initialcontext.java:417) 

the main reason i'm trying quartz can re-use datasource/connectionpool created play instead of defining in quartz.properties. according docs:

http://www.quartz-scheduler.org/documentation/quartz-2.x/configuration/configdatasources.html

i should need following 2 lines in quartz.properties:

org.quartz.jobstore.datasource = h2 org.quartz.datasource.h2.jndiurl = defaultds 

however, quartz throws bunch of exceptions:

java.sql.sqlexception: not retrieve datasource via jndi url 'defaultds' javax.naming.namenotfoundexception: defaultds not found [see nested exception: java.sql.sqlexception: not retrieve datasource via jndi url 'defaultds' javax.naming.namenotfoundexception: defaultds not found] 

i'm not sure go next. appreciated.

thanks.

found it.

i needed add jdbc librarydependencies in build.sbt. created , exposed datasource in jndi.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -