Subject | Re: Configuring Tomcat JNDI and Firebird |
---|---|
Author | grndeveloper |
Post date | 2006-10-18T08:02:21Z |
Hi Rick,
I replied your message yestarday, but it seems that didn't reach
the mailing list.
Do you Know how can I contact the responsible of this mailing list
to see if something wrong has happened with the message. Otherwise I
will have to write it again...
Thanks.
I replied your message yestarday, but it seems that didn't reach
the mailing list.
Do you Know how can I contact the responsible of this mailing list
to see if something wrong has happened with the message. Otherwise I
will have to write it again...
Thanks.
--- In Firebird-Java@yahoogroups.com, Rick Fincher <rnf@...> wrote:
>
> Hi,
>
> You still need the resource-ref in WEBB.xml. The context stuff just
> sets up the Tomcat server. The WEB.xml stuff sets up your web app to
> connect to the data source from the Tomcat server's context.
>
> It looks as though Tomcat is unable to load the driver. This doesn't
> make sense if you are able to create the data source from the Admin
> Tool, because Tomcat has to load the driver then or it can't create
the
> data source to begin with.
>
> Is the exception being thrown in the Ibatis code or when the Tomcat
starts?
>
> Try starting with a clean log file directory, starting Tomcat with your
> data source, but without running the app. Check to see if you get an
> error in the log. If not, it would indicate a problem in Ibatis.
>
> Also try starting a simple web app that just gets a connection from the
> Tomcat Data Source, no Ibatis or anything else, just get a connection.
>
> A JSP wth the following is an example:
>
> // Get a connection to the database from the dataSource.
> DataSource ds=null;
> Connection connRSFind=null;
>
> try
> {
> Context ctx = new InitialContext();
>
> if(ctx == null )
> throw new Exception("Boom - No Context");
>
> ds = (DataSource)ctx.lookup("java:comp/env/jdbc/link_to_sg2_bbdd");
>
> try
> {
> connRSFind = ds.getConnection();
> }
> catch (SQLException e)
> {
> System.out.println("getting new data source connection failed!
> Error: "+e+"\n");
> }
>
> }
> catch (Exception e)
> {
> System.out.println("Could Not get data source, error: "+e+"\n");
> }
>
>
> If that works, it would indicate a problem with the Ibatis setup.
>
> If you get erors with a smple connection, post the entire stack
trace so
> we can narrow down the problem.
>
> Rick
>
> grndeveloper wrote:
>
> > Hello Rick,
> >
> > I think I have implemented your solution, but I get the same mistake.
> >
> > I have created a Datasource from Tomcat Administration, and I have
> > not modified it manually. Now it looks like:
> >
> > <Resource
> > name="sg2_bbdd"
> > type="javax.sql.DataSource"
> > password="masterkey"
> > driverClassName="org.firebirdsql.jdbc.FBDriver"
> > maxIdle="2"
> > maxWait="5000"
> > validationQuery="select cast(1 as integer) from rdb$database"
> > username="sysdba"
> > url="jdbc:firebirdsql:192.168.2.2/3050:home/sg2/sg2JAVA.fdb"
> > maxActive="5"/>
> >
> > I have created a new file /META-INF/context.xml which generates me the
> > file /conf/Catalina/localhost/jaume1.xml , which looks like:
> >
> > <Context docBase="jaume1" path="/jaume1" >
> > <ResourceLink name="link_to_sg2_bbdd"
> > global="sg2_bbdd" type="javax.sql.DataSource"/>
> > </Context>
> >
> > Besides that I also have this portion of code in the web.xml file, but
> > I guess it's not necessary.
> >
> > <resource-ref>
> > <res-ref-name>jdbc/link_to_sg2_bbdd</res-ref-name>
> > <res-type>javax.sql.DataSource</res-type>
> > <res-auth>Container</res-auth>
> > <res-sharing-scope>Shareable</res-sharing-scope>
> > </resource-ref>
> >
> > Is there anything else, that I am missing?
> >
> > Thanks in advance.
> >
> > --- In Firebird-Java@yahoogroups.com
> > <mailto:Firebird-Java%40yahoogroups.com>, Rick Fincher <rnf@> wrote:
> > >
> > > Hi,
> > >
> > > With Tomcat 5.5.x you should not be modifying the server.xml
file. Go
> > > into the tomcat administrator application and create your data
sources
> > > there. The administrator app has a link on the Tomcat splash page.
> > >
> > > In the <CATALINA_HOME>/conf/Catalina/localhost directory you should
> > see
> > > an XML file with the name of your web app. If you do not, your
context
> > > is not set up properly.
> > >
> > > This file gets generated by Tomcat from your context.xml file
that is
> > > located in the META-INF folder of your web application.
> > >
> > > It should look something like this:
> > >
> > > <Context docBase="webAppName" path="/webAppName" >
> > > <ResourceLink name="jdbc/yourDataSourceName"
> > > global="jdbc/yourDataSourceName" type="javax.sql.DataSource"/>
> > > </Context>
> > >
> > > There should be a resource link for each data source you want to
use.
> > >
> > > By doing things this way, Tomcat can launch your web apps and add or
> > > drop data sources without restarting Tomcat and disrupting everybody
> > > elses web apps.
> > >
> > > Put your server.xml file back to the default and restart Tomcat.
Then
> > > go in the administrator to create your Data Sources. A good
validation
> > > query for Firebird is: SELECT CAST(1 AS INTEGER) FROM
rdb$database. It
> > > should always work.
> > >
> > > Check to be sure your context.xml file for your web app got
created as
> > > described above.
> > >
> > > Your username will have to be listed as an administrator in whatever
> > > login database scheme you are using (tomcat-users.xml, etc.) for
you to
> > > have access to the administrator application.
> > >
> > > Hope this helps!
> > >
> > > Rick
> > >
> > > grndeveloper wrote:
> > >
> > > > We are on Tomcat version 5.5.9 and we are using Jaybird 2.1.0 with
> > IBATIS.
> > > > We have IBATIS working in a simple DATASOURCE configuration,
and now
> > > > we are trying to configure our application to use JNDI and
connection
> > > > pooling.
> > > >
> > > >
> > > > We have made this modifications in the following files:
> > > >
> > > > >>>>server.xml >>>>>>>>
> > > > ...
> > > > <GlobalNamingResources>
> > > > ...
> > > > <Resource name="sg2_bbdd" auth="Container"
> > > > type="javax.sql.DataSource"/>
> > > > <ResourceParams name="sg2_bbdd">
> > > > <parameter>
> > > > <name>validationQuery</name>
> > > > <value>select x_idio.idio_codi from x_idio</value>
> > > > </parameter>
> > > > <parameter>
> > > > <name>maxWait</name>
> > > > <value>5000</value>
> > > > </parameter>
> > > > <parameter>
> > > > <name>maxActive</name>
> > > > <value>10</value>
> > > > </parameter>
> > > > <parameter>
> > > > <name>username</name>
> > > > <value>sysdba</value>
> > > > </parameter>
> > > > <parameter>
> > > > <name>password</name>
> > > > <value>masterkey</value>
> > > > </parameter>
> > > > <parameter>
> > > > <parameter>
> > > > <name>url</name>
> > > >
> > > >
<value>jdbc:firebirdsql:192.168.2.2/3050:home/sg2/sg2JAVA.fdb</value>
> > > > </parameter>
> > > > <parameter>
> > > > <name>driverClassName</name>
> > > > <value>org.firebirdsql.jdbc.FBDriver</value>
> > > > </parameter>
> > > > <parameter>
> > > > <name>maxIdle</name>
> > > > <value>5</value>
> > > > </parameter>
> > > > </ResourceParams>
> > > > </GlobalNamingResources>
> > > > ...
> > > > <Host
> > > > appBase="webapps"
> > > > name="localhost">
> > > > <DefaultContext>
> > > > <ResourceLink
> > > > global="sg2_bbdd"
> > > > name="jdbc/link_to_sg2_bbdd"
> > > > type="javax.sql.DataSource"/>
> > > > </DefaultContext>
> > > > </Host>
> > > >
> > > >
> > > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> > > >
> > > > >>>web.xml >>>>>>>>
> > > > .....
> > > > <resource-ref>
> > > > <res-ref-name>jdbc/link_to_sg2_bbdd</res-ref-name>
> > > > <res-type>javax.sql.DataSource</res-type>
> > > > <res-auth>Container</res-auth>
> > > > <res-sharing-scope>Shareable</res-sharing-scope>
> > > > </resource-ref>
> > > > .....
> > > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> > > >
> > > > >>>>sql-map-config.xml (Ibatis configuration
> > > > file)>>>>>>>>>>>>>>>>>>>>>>>>
> > > >
> > > > ....
> > > > <transactionManager type="JDBC">
> > > > <dataSource type="JNDI">
> > > > <property value="java:comp/env/jdbc/link_to_sg2_bbdd"
> > > > name="DataSource"/>
> > > > </dataSource>
> > > > </transactionManager>
> > > > ....
> > > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> > > >
> > > > We also have put the jaybird-full-2.1.0.jar into the
> > > > [CATALINA_HOME]/common/lib directory. In our application there
is no
> > > > reference to jaybird-full-2.1.0.jar
> > > >
> > > > With all this changes all we get from Tomcat logs is the following
> > > > error message:
> > > > org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
> > > > driver of class '' for connect URL 'null'
> > > > ...
> > > > Caused by: java.sql.SQLException: No suitable driver"
> > > > ...
> > > >
> > > > I think the problem we have has nothing to do with IBATIS, it
is just
> > > > we are doing something wrong with the driver or the tomcat
> > configuration.
> > > > Does anyone could give us some help?
> > > >
> > > > Thanks in advance.
> > > >
> > > > _
> > > >
> > > >
> > >
> > >
> > >
> > >
> > > [Non-text portions of this message have been removed]
> > >
> >
> >
>
>
>
>
> [Non-text portions of this message have been removed]
>