tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kris Schneider <k...@dotech.com>
Subject Re: Unable to use JNDI Datasource name with JSTL on jrun 4
Date Wed, 09 Feb 2005 02:17:58 GMT
Try changing the <jndi-name> element in jrun-resources.xml from this:

<jndi-name>myDatasource</jndi-name>

to this:

<jndi-name>jdbc/myDatasource</jndi-name>

If that doesn't work, try the following code to be sure the data source can 
be located in the same manner as JSTL:

Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/myDatasource");

It looks like JRun 4 implements some sort of "shorthand" for JNDI lookups 
that might conflict with what JSTL is trying to do. I haven't used JRun 
before, so I could be way off...

Dipak Bhandari wrote:
> Hi
> I've not been able to make my web application use JNDI dataSource name  
> with JSTL 1.0 on JRUN 4. However, when I use jdbc url instead of JNDI 
> name the database connection is established. Please find below the 
> relevant entries in web.xml and jrun-resources.xml  along with the error 
> message thrown by JRUN 4.
> 
> web.xml entries:
> 
> <context-param>
>    <param-name>
>      javax.servlet.jsp.jstl.sql.dataSource
>    </param-name>
>    <param-value>
>     jdbc/myDatasource
>    </param-value>
>   </context-param>
> 
> jrun-resources.xml entries:
> 
> <data-source>
>    <dbname>myDatasource</dbname>
>    <driver>oracle.jdbc.driver.OracleDriver</driver>
>    <url>jdbc:oracle:thin:@host:1521:sid</url>
>    <username>username</username>
>    <password>password</password>
>    <encrypted>true</encrypted>
>    <encryption-class>jrun.security.JRunCrypterForTwofish</encryption-class>
>    <native-results>true</native-results>
>    <remove-on-exceptions>true</remove-on-exceptions>
>    <pool-statements>true</pool-statements>
>    <initial-connections>1</initial-connections>
>    <connection-timeout>1200</connection-timeout>
>    <transaction-timeout>20</transaction-timeout>
>    <cache-enabled>false</cache-enabled>
>    <cache-size>5</cache-size>
>    <cache-refresh-interval>30</cache-refresh-interval>
>    <jndi-name>myDatasource</jndi-name>
>    <poolname>Pool</poolname>
>    <minimum-size>0</minimum-size>
>    <maximum-size>2147483647</maximum-size>
>    <user-timeout>20</user-timeout>
>    <skimmer-frequency>420</skimmer-frequency>
>    <shrink-by>5</shrink-by>
>    <maximum-soft>true</maximum-soft>
>    <debugging>false</debugging>
>    <disable-pooling>false</disable-pooling>
>    <description />
>    <isolation-level>READ_COMMITTED</isolation-level>
>  </data-source>
> 
> The error thrown is:
> 
> javax.servlet.jsp.JspException: Unable to get connection, DataSource 
> invalid: "No suitable driver"
>     at 
> org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:309)

> 
>     at 
> org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:192)

> 
>     at 
> org.apache.taglibs.standard.tag.el.sql.QueryTag.doStartTag(QueryTag.java:125) 
> 
>     at jrun__test2ejsp9._jspService(jrun__test2ejsp9.java:117)
>     at jrun.jsp.runtime.HttpJSPServlet.service(HttpJSPServlet.java:43)
>     at jrun.jsp.JSPServlet.service(JSPServlet.java:119)
>     at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
>     at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
>     at 
> jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:252)
>     at 
> jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527)
>     at jrun.servlet.http.WebService.invokeRunnable(WebService.java:168)
>     at 
> jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:451) 
> 
>     at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
> 
> 
> however, the database connection is established if in my deployment 
> descriptor I replace
> <param-value>
>     jdbc/myDatasource
>    </param-value>
> with
> <param-value>
>       
> jdbc:oracle:thin:@host:1521:SID,oracle.jdbc.driver.OracleDriver,user,password 
> 
>    </param-value>
> 
> I'd appreciate any help to find a solution to use JNDI name on JRUN4.
> 
> Much appreciated,
> Dipak Bhandari
> d.bhandari@qut.edu.au
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org

-- 
Kris Schneider <mailto:kris@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message