You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Scott Mueller <sc...@acceleratebiz.com> on 2004/11/16 08:54:23 UTC

problem accessing datasource in 5.5.4 application

Someone please help me.  The same code that was working fine in tomcat
5.0.19 does not work anymore in 5.5.4 for accessing the database.  I have
the correct postgresql (jdk1.5 compatible) driver in the common/lib
directory.  In server.xml, I have the following resource as a child of the
GlobalNamingResources element:

<Resource name="data/ispmanagerpg" auth="Container"

        type="javax.sql.DataSource" driverClassName="org.postgresql.Driver"

        url="jdbc:postgresql://manager.acceleratebiz.com/xxxxxxx"

        username="xxxxxxx" password="xxxxxxx" maxActive="20" maxIdle="10"
maxWait="-1"/>

 

That seems to work fine, because in my
webapps/ispmanager/META-INF/context.xml file, I have the following Realm:

<Context docBase="ispmanager" path="">

  <Realm className="org.apache.catalina.realm.DataSourceRealm"
dataSourceName="data/ispmanagerpg" debug="99" roleNameCol="Rolename"
userCredCol="Password" userNameCol="Username" userRoleTable="Account_Roles"
userTable="Account"/>

</Context>

 

This works perfectly.  I can login with the correct username/password in my
postgresql database and it works as expected.  The problem is when actually
logged in and referencing a servlet that accesses the database through the
data/ispmanagerpg datasource.  It gives the error below.  This was working
fine in 5.0.19 as I explained above.  Not sure what's different or what I
may have inadvertently changed. I have the correct resource-ref element in
my WEB-INF/web.xml file.

 

2004-11-16 03:41:48,354 ERROR [http-69.60.97.166-443-Processor25]
servlet.CustomXmlProducer (CustomXmlProducer.java:60) - unable to get result
set for this entity

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of
class '' for connect URL 'null'

        at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource
.java:780)

        at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.ja
va:540)

        at
com.acceleratebiz.manager.util.Database.getConnection(Database.java:31)

        at
com.acceleratebiz.manager.servlet.CustomXmlProducer.getCustomerId(CustomXmlP
roducer.java:54)

        at
com.acceleratebiz.manager.servlet.CustomXmlProducer.initialize(CustomXmlProd
ucer.java:41)

        at
com.acceleratebiz.manager.controlpanel.Traffic.produceXml(Traffic.java:30)

        at org.mis.xsltfront.servlet.XmlSource.produceXml(XmlSource.java:33)

        at org.mis.xsltfront.servlet.XsltServlet.doGet(XsltServlet.java:56)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:237)

        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:157)

        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:214)

        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:178)

        at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
.java:482)

        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126
)

        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105
)

        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:107)

        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)

        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)

        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:731)

        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.jav
a:526)

        at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWo
rkerThread.java:80)

        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:684)

        at java.lang.Thread.run(Thread.java:595)

Caused by: java.lang.NullPointerException

        at java.util.StringTokenizer.<init>(StringTokenizer.java:182)

        at org.postgresql.Driver.parseURL(Driver.java:251)

        at org.postgresql.Driver.acceptsURL(Driver.java:159)

        at java.sql.DriverManager.getDriver(DriverManager.java:232)

        at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource
.java:773)

        ... 24 more

 

 

The last 7 lines of my web.xml file if it helps anyone:

        <resource-ref>

                <description>ispmanager database</description>

                <res-ref-name>data/ispmanagerpg</res-ref-name>

                <res-type>javax.sql.DataSource</res-type>

                <res-auth>Container</res-auth>

        </resource-ref>

</web-app>

 

Scott Mueller

AccelerateBiz Managed Hosting

http://www.acceleratebiz.com <http://www.acceleratebiz.com/> 

Phone: (800) 360-7360

Fax: (270) 778-3081 

 


RE: problem accessing datasource in 5.5.4 application

Posted by Scott Mueller <sc...@acceleratebiz.com>.
Hi Remy,

Yes, what you said worked thanks!  I had a ResourceLink previously, but I
ALSO had a Resource element without the attributes in my context.xml file.
That didn't work, so I removed both Resource* elements from my context.xml.
That didn't work either.  Removing JUST the Resource element worked:

  <Resource auth="Container" description="IspManager database"
name="data/ispmanagerpg" type="javax.sql.DataSource"/>
  <ResourceLink global="data/ispmanagerpg" name="data/ispmanagerpg"
type="javax.sql.DataSource"/>
</Context>  

That worked fine in 5.0.x.  Not in 5.5.4, so I removed the 2 Resource*
elements and it still didn't work.  What finally worked was ONLY removing
the Resource element.

-----Original Message-----
From: Remy Maucherat [mailto:remy.maucherat@gmail.com] 
Sent: Tuesday, November 16, 2004 6:06 AM
To: Tomcat Users List
Subject: Re: problem accessing datasource in 5.5.4 application

On Tue, 16 Nov 2004 02:54:23 -0500, Scott Mueller
<sc...@acceleratebiz.com> wrote:
> Someone please help me.  The same code that was working fine in tomcat
> 5.0.19 does not work anymore in 5.5.4 for accessing the database.

I don't see how it could have worked without a ResourceLink element
for your context. You can define the ResourceLink globally in
conf/context.xml if all your contexts will need it.

-- 
xxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Developer & Consultant
JBoss Group (Europe) SàRL
xxxxxxxxxxxxxxxxxxxxxxxxx

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



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


Re: problem accessing datasource in 5.5.4 application

Posted by Remy Maucherat <re...@gmail.com>.
On Tue, 16 Nov 2004 02:54:23 -0500, Scott Mueller
<sc...@acceleratebiz.com> wrote:
> Someone please help me.  The same code that was working fine in tomcat
> 5.0.19 does not work anymore in 5.5.4 for accessing the database.

I don't see how it could have worked without a ResourceLink element
for your context. You can define the ResourceLink globally in
conf/context.xml if all your contexts will need it.

-- 
xxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Developer & Consultant
JBoss Group (Europe) SàRL
xxxxxxxxxxxxxxxxxxxxxxxxx

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