tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Terje Hopsø <tehos...@online.no>
Subject RE: Database setup? - SOLVED
Date Thu, 29 May 2003 13:23:23 GMT
Thanks!!

It was out of order. Now it start without errors. I was not aware of that it
had to be in a spesific order.

- Terje


-----Original Message-----
From: Brian Buchanan [mailto:brianbuchanan@interfast.ca] 
Sent: 29. mai 2003 14:15
To: Tomcat Users List
Subject: RE: Database setup?



The order of the elements in the web.xml file must be in a specific order.

As the error message states, they must appear in this order:
(icon?,display-name?,description?,distributable?,context-param*,filter*,fil
ter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mappin
g*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,se
curity-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-loca
l-ref

You probably just have your nested elements out of order.  Perhaps you have
a <servlet> or <servlet-mapping> before your <context-param> which is
invalid.

If you want to know more about the format of the web.xml file, you can
download the servlet specification from Sun here:

http://java.sun.com/products/servlet/download.html

Here's a link to the 2.3 specification
http://www.jcp.org/aboutJava/communityprocess/final/jsr053/

and refer to chapter 13 - Deployment Descriptor

Once you have that sorted out you can see what next falls out.

I would also recommend that you learn on the latest version of Tomcat
available which is 4.1.24 right now.

http://jakarta.apache.org/tomcat/

http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.1.24/

FYI, If you happen to be using Windows I'd also like to offer this advice:

I used to download the .exe version and install it, but I would now
recommend the .ZIP version as it doesn't "fiddle" with your configuration.
Sure, getting it to run as a service is a bit trickier, but for development
the less fiddling the better.

As a zip file I start tomcat from the command line with

SET JAVA_HOME=(whichever jvm I want to use)
SET CATALINA_HOME=(Whever I unzipped tomcat to)
%CATALINA_HOME%\bin\startup.bat

Example:
SET JAVA_HOME=C:\j2sdk1.4.1_02
SET CATALINA_HOME=C:\jakarta-tomcat-4.1.24
%CATALINA_HOME%\bin\startup.bat

This way you can also try different JVM's and different tomcat installs
easily.

Good luck.

._. Brian Buchanan

-----Original Message-----
From: Terje Hopsø [mailto:tehosubs@online.no]
Sent: Thursday, May 29, 2003 7:45 AM
To: 'Tomcat Users List'
Subject: Database setup?


Hi,

I am trying to setup Tomcat according to the book "JavaServer Pages" page
157. But all I get when starting up tomcat is errors. I also tried JNDI but
that was less understandable so I will first try this simple setup, which I
cant understand why failes.

Anyone got a hint on what I have to to?

I have a standard Tomcat 4.1.18 and JSTL installed.

- Terje


Here is my setup in web.xml:
-------------------------
 <context-param>
  <param-name>
   javax.servlet.jsp.jstl.sql.DataSource
  </param-name>
  <param-value>

jdbc:mysql://db.server.no:3306/myuser,com.mysql.jdbc.Driver,myusername,mypas
sword
  </param-value>
 </context-param>
-------------------------
The error when starting tomcat is:
Starting service Tomcat-Standalone
Apache Tomcat/4.1.18
29.mai.2003 13:28:37 org.apache.commons.digester.Digester error
SEVERE: Parse Error at line 28 column 11: The content of element type
"web-app" must match
"(icon?,display-name?,description?,distributable?,context-param*,filter*,fil
ter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mappin
g*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,se
curity-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-loca
l-ref
*)".
org.xml.sax.SAXParseException: The content of element type "web-app" must
match
"(icon?,display-name?,description?,distributable?,context-param*,filter*,fil
ter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mappin
g*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,se
curity-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-loca
l-ref*)".
        at
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHand
lerWrapper.java:232)
        at
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHand
lerWrapper.java:232)
        at
org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:17
3)
        at
org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:37
1)
....
----------------------------------

In my jsp-file this works fine but I want to put the datasource parameters
into web.xml instead of each jsp-file where I access a database.
---
<sql:setDataSource var="ex" scope="application"
 driver="com.mysql.jdbc.Driver"
 url="jdbc:mysql://db.server.no:3306/myuser"
 user="myusername"
 password="mypassword"
/>
<sql:query var="init"
 dataSource="${ex}"
 sql="select name from adress"
/>

<c:forEach items="${init.rows}" var="row">
 <c:out value="${row.name}" /><br>
</c:forEach>
---


---------------------------------------------------------------------
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


Mime
View raw message