• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 616
  • Last Modified:

Tomcat JDBC Sample

Trying to follow the jdbc connectivity example in Chopra, Li and Geneder's Apache Tomcat 6 book and i keep seeing ths 'quote symbol expected' at 3,20.  In which one of the files is this 3,20 that needs the quote symbol?   The only files i've added since the example last worked is a context.xml file.  Also I've made some changes to the server.xml file and the web .xml file.

To server.xml i added

<Resource name=”jdbc/WroxTC6” auth=”Container”
         type=”javax.sql.DataSource
         maxActive=”20”
         maxIdle=”30”
         maxWait=”10000”
         username=”empro”
         password=”empass”
         driverClassName=”com.mysql.jdbc.Driver”
         url=”jdbc:mysql://localhost:3306/test?autoReconnect=true
/>

To web.xml i added:

<env-entry>
<env-entry-name>foo/name4</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<env-entry-value>10</env-entry-value>
</env-entry>

Prior to that my tomcat would startup without error.   Now when i try startup i get this quotes error.


INFO: Deploying web application directory examples
Apr 8, 2011 1:39:21 PM org.apache.catalina.startup.HostConfig deployDirectory
SEVERE: Error deploying web application directory examples
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Inval
id byte 1 of 1-byte UTF-8 sequence.
        at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF
8Reader.java:684)
        at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader
.java:554)
        at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEnti
tyScanner.java:1742)
        at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipSpaces(X
MLEntityScanner.java:1492)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l.scanAttribute(XMLDocumentFragmentScannerImpl.java:1533)



*********************************************************************************************************************************

Apr 8, 2011 11:21:50 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /jsp/wroxjdbc/JDBCTest.jsp(3,20) quote symbol expected
      at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
      at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
      at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
      at org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:198)
      at org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:148)
      at org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:160)

context.xml
0
xoxomos
Asked:
xoxomos
1 Solution
 
Amitkumar PSr. ConsultantCommented:
Replace with " in your xml file.

or

update the context.xml with the following

<Context>
<Resource name="jdbc/WroxTC6"
auth="Container"
type="javax.sql.DataSource"
maxActive="20"
maxIdle="30"
maxWait="10000"
username="empro"
password="empass"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/test?autoReconnect=true"
/>
</Context>

Basically, you may have copied and pasted code from the book. Due to this, (”) is used rather than (").

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now