How to configure datasource jboss 4.2.3 for a jar library that initialize connection in the default context? -


we have jar library util manage of logic of connection db , store data in memory. well, works fine in tomcat because can configure datasource in $catalina_home/conf/context.xml , work's fine.

how can configure datasource in jboss (4.2.3.ga) that's can see war, ear or apps deployed , of course jar util that's it's deployed in $jboss_home/server/<instance>/lib ?

thanks :)

update:

i want do:

"2a. shared resource configuration

use option if wish define datasource shared across multiple jboss web applications, or if prefer defining datasource in file.

this author has not had success here, although others have reported so. clarification appreciated here.

<resource name="jdbc/postgres" auth="container"           type="javax.sql.datasource" driverclassname="org.postgresql.driver"           url="jdbc:postgresql://127.0.0.1:5432/mydb"           username="myuser" password="mypasswd" maxactive="20" maxidle="10" maxwait="-1"/> 

source: https://docs.jboss.org/jbossweb/2.1.x/jndi-datasource-examples-howto.html

well, i'm in part of "clarification appreciated here"...

create jboss datasource

add datasource configuration (*-ds.xml file) $jboss_home/sever/<server-name>/deploy directory.

this stackoverflow answer has more details: how create datasource in jboss application server

the link jboss 5, don't think datasource configuration changed between 4.2.3 , 5.

configure tomcat resource reference

configure tomcat resource reference point jboss datasource. configuration identify datasource jndi name in order retrieve connections jboss datasource.

step 1 of accepted answer stackoverflow question has more details: jndi path tomcat vs. jboss

note resource configuration defining new data source, not reusing jboss definition.

look data source jndi

the same answer explains how this, note uri different depending on whether lookup done within client code outside of ejb container, or code within ejb container.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -