java - How to configure JSP app to handle JNDI transparently on Jboss and Tomcat -


i developed application running on jboss jndi, i'd run on tomcat minimal reconfiguration user given .war file.

is possible, , how?

jboss 7.1.3 tomcat 7.0

edit:

this part of code i'm using jboss:

<%@page import="java.sql.*"%> connection conn = null; context initialcontext = new initialcontext(); string datasource_context = initialcontext.lookup("java:comp/env/dbjndids").tostring(); datasource datasource = (datasource) initialcontext.lookup(datasource_context); conn = datasource.getconnection(); 

this jndi definition in standalone.xml:

<xa-datasource jta="true" jndi-name="java:jboss/datasources/mydatasource" pool-name="mydatasource" enabled="true" use-java-context="true" use-ccm="true">     <xa-datasource-property name="url">         jdbc:sqlserver://localhost;database=mydatabase;sendstringparametersasunicode=false;username=sa;password=sa     </xa-datasource-property>     <xa-datasource-class>com.microsoft.sqlserver.jdbc.sqlserverxadatasource</xa-datasource-class>     <driver>sqljdbc</driver>     <xa-pool>         <min-pool-size>2</min-pool-size>         <max-pool-size>1000</max-pool-size>         <prefill>true</prefill>         <is-same-rm-override>false</is-same-rm-override>     </xa-pool>     <validation>         <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mssql.mssqlvalidconnectionchecker"/>     </validation> </xa-datasource> 

this jndi reference in web.xml (for jboss):

<env-entry>     <env-entry-name>dbjndids</env-entry-name>     <env-entry-type>java.lang.string</env-entry-type>     <env-entry-value>java:jboss/datasources/mydatasource</env-entry-value> </env-entry> 

so, i'd add web.xml jndi definition "dbjndids" (on reference in .jsp) work on tomcat along current jboss configuration, don't have recompile different version of project tomcat etc. also, nice see other possibilities, glassfish...


Comments

Popular posts from this blog

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -