File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes problem with Connection pooling in tomcat 5.5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "problem with Connection pooling in tomcat 5.5" Watch "problem with Connection pooling in tomcat 5.5" New topic
Author

problem with Connection pooling in tomcat 5.5

Sri Dharan
Ranch Hand

Joined: Aug 21, 2008
Posts: 74
Hello friends,
I am doing small web application ,in that I am doing connection pooling.I followed these steps:
1.In Conf/server.xml - added below code
<Server port="8005" shutdown="SHUTDOWN">...

<Resource name="jdbc/myoracle" auth="Container"
type="javax.sql.DataSource"
description="Oracle 9i database that can be updated and saved"
factory="oracle.jdbc.driver.OracleDriver"
url="jdbcracleci9:@oracle"
username="scott" password="tiger" maxActive="20" maxIdle="10" maxWait="-1""/>
....
</Server>

2. In web.xml of my web application:
<web-app>...
<resource-ref>
<description>Oracle Datasource example</description>
<res-ref-name>jdbc/myoracle</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

...</web-app>

3.In my class :

Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
Connection con = ds.getConnection();


4. I started tomcat 5.5 server , it is not starting and getting error in log file like:

Nov 18, 2008 11:31:22 PM org.apache.tomcat.util.digester.Digester fatalError
SEVERE: Parse Fatal Error at line 42 column 85: Element type "Resource" must be followed by either attribute specifications, ">" or "/>".
org.xml.sax.SAXParseException: Element type "Resource" must be followed by either attribute specifications, ">" or "/>".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1561)
at org.apache.catalina.startup.Catalina.load(Catalina.java:475)
at org.apache.catalina.startup.Catalina.load(Catalina.java:512)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:243)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:408)




I am not able to run tha server.Could you please help inthis concern.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8866
    
    8

It looks like you have an extra quote mark here:

The easiest way to spot errors in XML is to use an editor which checks your text against the XML's DTD. There are many. I use JEdit with the XML plugin.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Sri Dharan
Ranch Hand

Joined: Aug 21, 2008
Posts: 74
Thank you for your valuable reply...
I reomved that quotations and tried then server is running but same error is coming.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8866
    
    8

The easiest way to spot errors in XML is to use an editor which checks your text against the XML's DTD. There are many. I use JEdit with the XML plugin.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with Connection pooling in tomcat 5.5