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="jdbc:oracle:oci9:@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.